- Mar 30, 2017
-
-
Alex Lorenz authored
an ObjC object pointer When ARC is enabled in Objective-C++, comparisons between a pointer and Objective-C object pointer typically result in errors like this: "invalid operands to a binary expression". This error message can be quite confusing as it doesn't provide a solution to the problem, unlike the non-C++ diagnostic: "implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast" (it also provides fix-its). This commit forces comparisons between pointers and Objective-C object pointers in ARC to use the Objective-C semantic rules to ensure that a better diagnostic is reported. rdar://31103857 Differential Revision: https://reviews.llvm.org/D31177 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299080 91177308-0d34-0410-b5e6-96231b3b80d8
-
Nirav Dave authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299079 91177308-0d34-0410-b5e6-96231b3b80d8
-
Alex Lorenz authored
warning for methods that resemble the setters of readonly properties rdar://30415679 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299078 91177308-0d34-0410-b5e6-96231b3b80d8
-
Haojian Wu authored
Reviewers: ioeric Reviewed By: ioeric Subscribers: alexshap, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D31492 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299073 91177308-0d34-0410-b5e6-96231b3b80d8
-
Craig Topper authored
Turns out integerPartWidth only explicitly defines the width of the tc functions in the APInt class. Functions that aren't used by APInt implementation itself. Many places in the code base already assume APInt is made up of 64-bit pieces. Explicitly assuming 64-bit here doesn't make that situation much worse. A full audit would need to be done if it ever changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299058 91177308-0d34-0410-b5e6-96231b3b80d8
-
Reid Kleckner authored
Fixes this clang warning on Windows: warning: implicit truncation from 'clang::LangOptions::FPContractModeKind' to bit-field changes value from 2 to -2 [-Wbitfield-constant-conversion] fp_contract = LangOptions::FPC_Fast; ^ ~~~~~~~~~~~~~~~~~~~~~ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299045 91177308-0d34-0410-b5e6-96231b3b80d8
-
Dean Michael Berris authored
This should unbreak some bots. Follow-up on D30388. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299044 91177308-0d34-0410-b5e6-96231b3b80d8
-
Dean Michael Berris authored
Summary: The -fxray-always-instrument= and -fxray-never-instrument= flags take filenames that are used to imbue the XRay instrumentation attributes using a whitelist mechanism (similar to the sanitizer special cases list). We use the same syntax and semantics as the sanitizer blacklists files in the implementation. As implemented, we respect the attributes that are already defined in the source file (i.e. those that have the [[clang::xray_{always,never}_instrument]] attributes) before applying the always/never instrument lists. Reviewers: rsmith, chandlerc Subscribers: jfb, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D30388 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299041 91177308-0d34-0410-b5e6-96231b3b80d8
-
Eric Christopher authored
Patch by Zhizhou Yang git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299037 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Mar 29, 2017
-
-
Adam Nemet authored
FPContractModeKind is the codegen option flag which is already ternary (off, on, fast). This makes it universally the type for the contractable info across the front-end: * In FPOptions (i.e. in the Sema + in the expression nodes). * In LangOpts::DefaultFPContractMode which is the option that initializes FPOptions in the Sema. Another way to look at this change is that before fp-contractable on/off were the only states handled to the front-end: * For "on", FMA folding was performed by the front-end * For "fast", we simply forwarded the flag to TargetOptions to handle it in LLVM Now off/on/fast are all exposed because for fast we will generate fast-math-flags during CodeGen. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. --- This is a recommit of r299027 with an adjustment to the test CodeGenCUDA/fp-contract.cu. The test assumed that even though -ffp-contract=on is passed FE-based folding of FMA won't happen. This is obviously wrong since the user is asking for this explicitly with the option. CUDA is different that -ffp-contract=fast is on by default. The test used to "work" because contract=fast and contract=on were maintained separately and we didn't fold in the FE because contract=fast was on due to the target-default. This patch consolidates the contract=on/fast/off state into a ternary state hence the change in behavior. --- Differential Revision: https://reviews.llvm.org/D31167 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299033 91177308-0d34-0410-b5e6-96231b3b80d8
-
Adam Nemet authored
This reverts commit r299027. It's causing a test failure in clang's CodeGenCUDE/fp-contract.cu git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299029 91177308-0d34-0410-b5e6-96231b3b80d8
-
Adam Nemet authored
FPContractModeKind is the codegen option flag which is already ternary (off, on, fast). This makes it universally the type for the contractable info across the front-end: * In FPOptions (i.e. in the Sema + in the expression nodes). * In LangOpts::DefaultFPContractMode which is the option that initializes FPOptions in the Sema. Another way to look at this change is that before fp-contractable on/off were the only states handled to the front-end: * For "on", FMA folding was performed by the front-end * For "fast", we simply forwarded the flag to TargetOptions to handle it in LLVM Now off/on/fast are all exposed because for fast we will generate fast-math-flags during CodeGen. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. Differential Revision: https://reviews.llvm.org/D31167 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299027 91177308-0d34-0410-b5e6-96231b3b80d8
-
Brian Kelley authored
Summary: After examining the remaining uses of LangOptions.ObjCAutoRefCount, found a some additional places to also check for ObjCWeak not covered by previous test cases. Added a test file to verify all the code paths that were changed. Reviewers: rsmith, doug.gregor, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31007 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299015 91177308-0d34-0410-b5e6-96231b3b80d8
-
Brian Kelley authored
Summary: clang should produce the same errors Objective-C classes that cannot be assigned to weak pointers under both -fobjc-arc and -fobjc-weak. Check for ObjCWeak along with ObjCAutoRefCount when analyzing pointer conversions. Add an -fobjc-weak pass to the existing arc-unavailable-for-weakref test cases to verify the behavior is the same. Reviewers: rsmith, doug.gregor, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31006 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299014 91177308-0d34-0410-b5e6-96231b3b80d8
-
Graydon Hoare authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299012 91177308-0d34-0410-b5e6-96231b3b80d8
-
Brian Kelley authored
Summary: -Warc-repeated-use-of-weak should produce the same warnings with -fobjc-weak as it does with -objc-arc. Also check for ObjCWeak along with ObjCAutoRefCount when recording the use of an evaluated weak variable. Add a -fobjc-weak run to the existing arc-repeated-weak test case and adapt it slightly to work in both modes. Reviewers: rsmith, doug.gregor, jordan_rose, rjmccall Reviewed By: rjmccall Subscribers: arphaman, rjmccall, cfe-commits Differential Revision: https://reviews.llvm.org/D31005 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299011 91177308-0d34-0410-b5e6-96231b3b80d8
-
Brian Kelley authored
Summary: Similar to ARC, in ObjCWeak Objective-C object pointers qualified with a weak lifetime are not POD or trivial types. Update the type trait code to reflect this. Copy and adapt the arc-type-traits.mm test case to verify correctness. Reviewers: rsmith, doug.gregor, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31004 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299010 91177308-0d34-0410-b5e6-96231b3b80d8
-
Graydon Hoare authored
Summary: When a PCH is included via -include-pch, clang should treat the current TU as dependent on the sourcefile that the PCH was generated from. This is currently _partly_ accomplished by InitializePreprocessor calling AddImplicitIncludePCH to synthesize an implicit #include of the sourcefile, into the preprocessor's Predefines buffer. For FrontendActions such as PreprocessOnlyAction (which is, curiously, what the driver winds up running one of in response to a plain clang -M) this is sufficient: the preprocessor cranks over its Predefines and emits a dependency reference to the initial sourcefile. For other FrontendActions (for example -emit-obj or -fsyntax-only) the Predefines buffer is reset to the suggested predefines buffer from the PCH, so the dependency edge is lost. The result is that clang emits a .d file in those cases that lacks a reference to the .h file responsible for the input (and in Swift's case, our .swiftdeps file winds up not including a reference to the source file for a PCH bridging header.) This patch fixes the problem by taking a different tack: ignoring the Predefines buffer (which seems a bit like a hack anyways) and directly attaching the CompilerInstance's DependencyCollectors (and legacy DependencyFileGenerator) to the ASTReader for the external AST. This approach is similar to the one chosen in earlier consultation with Bruno and Ben, and I think it's the least-bad solution, given several options. Reviewers: bruno, benlangmuir, doug.gregor Reviewed By: bruno, doug.gregor Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31378 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299009 91177308-0d34-0410-b5e6-96231b3b80d8
-
Brian Kelley authored
Summary: When adding an Objective-C retainable type member to a C++ class, also check the LangOpts.ObjCWeak flag and the lifetime qualifier so __weak qualified Objective-C pointer members cause the class to be a non-POD type with non-trivial special members, so the compiler always emits the necessary runtime calls for copying, moving, and destroying the weak member. Otherwise, Objective-C++ classes with weak Objective-C pointer members compiled with -fobjc-weak exhibit undefined behavior if the C++ class is classified as a POD type. Reviewers: rsmith, benlangmuir, doug.gregor, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31003 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299008 91177308-0d34-0410-b5e6-96231b3b80d8
-
Brian Kelley authored
Remove trailing whitespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299007 91177308-0d34-0410-b5e6-96231b3b80d8
-
Egor Churaev authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298992 91177308-0d34-0410-b5e6-96231b3b80d8
-
Egor Churaev authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298978 91177308-0d34-0410-b5e6-96231b3b80d8
-
Egor Churaev authored
Reviewers: cfe-commits, Anastasia Reviewed By: Anastasia Subscribers: yaxunl, bader Differential Revision: https://reviews.llvm.org/D31183 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298976 91177308-0d34-0410-b5e6-96231b3b80d8
-
Juergen Ributzka authored
This broke GreenDragon: http://lab.llvm.org:8080/green/job/clang-stage2-cmake-modulesRDA_build/4776/ Reverting this commit and all follow-up commits. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298967 91177308-0d34-0410-b5e6-96231b3b80d8
-
Juergen Ributzka authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298966 91177308-0d34-0410-b5e6-96231b3b80d8
-
Juergen Ributzka authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298965 91177308-0d34-0410-b5e6-96231b3b80d8
-
Eric Christopher authored
Default enable the rtm feature only on skylake and later for now because Intel disabled the feature on some haswell and broadwell processors: http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/core-m-processor-family-spec-update.pdf the -mrtm option will still work normally. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298956 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Mar 28, 2017
-
-
Artem Dergachev authored
If the value is known, but we cannot increment it, conjure a symbol to represent the result of the operation based on the operator expression, not on the sub-expression. In particular, no longer crash on comparing a result of a LocAsInteger increment to a constant integer. rdar://problem/31067356 Differential Revision: https://reviews.llvm.org/D31289 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298927 91177308-0d34-0410-b5e6-96231b3b80d8
-
Artem Dergachev authored
Adjustments should be considered properly; we should copy the unadjusted object over the whole temporary base region. If the unadjusted object is no longer available in the Environment, invalidate the temporary base region, and then copy the adjusted object into the adjusted sub-region of the temporary region. This fixes a regression introduced by r288263, that caused various false positives, due to copying only adjusted object into the adjusted region; the rest of the base region therefore remained undefined. Before r288263, the adjusted value was copied over the unadjusted region, which is incorrect, but accidentally worked better due to how region store disregards compound value bindings to non-base regions. An additional test machinery is introduced to make sure that despite making two binds, we only notify checkers once for both of them, without exposing the partially copied objects. This fix is a hack over a hack. The proper fix would be to model C++ temporaries in the CFG, and after that dealing with adjustments would no longer be necessary, and the values we need would no longer disappear from the Environment. rdar://problem/30658168 Differential Revision: https://reviews.llvm.org/D30534 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298924 91177308-0d34-0410-b5e6-96231b3b80d8
-
NAKAMURA Takumi authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298921 91177308-0d34-0410-b5e6-96231b3b80d8
-
Eric Liu authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298919 91177308-0d34-0410-b5e6-96231b3b80d8
-
Eric Liu authored
Summary: ... which applies a set of `AtomicChange`s on code. Reviewers: klimek, djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30777 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298913 91177308-0d34-0410-b5e6-96231b3b80d8
-
Eric Liu authored
Reviewers: hokein, aaron.ballman Reviewed By: aaron.ballman Subscribers: aaron.ballman, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D28671 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298912 91177308-0d34-0410-b5e6-96231b3b80d8
-
Erik Verbruggen authored
The getVirtualFile method would create entries for e.g. libclang's CXUnsavedFile but not mark them as valid. The effect is that a lookup through getFile where the file name is not exactly matching the virtual file (e.g. through mixing slashes and backslashes on Windows) would result in a normal file "lookup", and re-using the file entry found by using the UniqueID, and overwrite the file entry fields. Because the lookup involves opening the file, and moving it into the file entry, the file is now open. The SourceManager keys its buffers on the UniqueID (which is still the same), so it will find an already loaded buffer. Because only the loading a buffer from disk will close the file, the FileEntry will hold on to an open file for as long as the FileManager is around. As the FileManager will only get destroyed at a reparse, you can't safe to the "leaked" and locked file on Windows. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298905 91177308-0d34-0410-b5e6-96231b3b80d8
-
Erik Verbruggen authored
If there is an unresolved member access AST node, and the base is implicit, do not access/use it for generating candidate overloads for code completion results. Fixes PR31093. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298903 91177308-0d34-0410-b5e6-96231b3b80d8
-
Gor Nishanov authored
FIXME: ActOnReturnStmt expects a scope that is inside of the function, due to CheckJumpOutOfSEHFinally(*this, ReturnLoc, *CurScope->getFnParent()); S.getCurScope()->getFnParent() == nullptr at ActOnFinishFunctionBody when CoroutineBodyStmt is built. Figure it out and fix it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298893 91177308-0d34-0410-b5e6-96231b3b80d8
-
Gor Nishanov authored
Summary: If promise_type has get_return_object_on_allocation_failure defined, check if an allocation function returns nullptr, and if so, return the result of get_return_object_on_allocation_failure(). Reviewers: rsmith, EricWF Reviewed By: EricWF Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D31399 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298891 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Mar 27, 2017
-
-
Matthias Gehre authored
Summary: This patch implements parsing of [[clang::suppress(rule, ...)]] and [[gsl::suppress(rule, ...)]] attributes. C++ Core Guidelines depend heavily on tool support for rule enforcement. They also propose a way to suppress warnings [1] which is by annotating any ancestor in AST with the C++11 attribute [[gsl::suppress(rule1,...)]]. To have a mechanism to suppress non-C++ Core Guidelines specific, an additional spelling of [[clang::suppress]] is defined. For example, to suppress the warning cppcoreguidelines-slicing, one could do ``` [[clang::suppress("cppcoreguidelines-slicing")]] void f() { ... code that does slicing ... } ``` or ``` void g() { Derived b; [[clang::suppress("cppcoreguidelines-slicing")]] Base a{b}; [[clang::suppress("cppcoreguidelines-slicing")]] { doSomething(); Base a2{b}; } } ``` This parsing can then be used by clang-tidy, which includes multiple C++ Core Guidelines rules, to suppress warnings (see https://reviews.llvm.org/D24888). For the exact naming of the rule in the attribute, there are different possibilities, which will be defined in the corresponding clang-tidy patch. Currently, clang-tidy supports suppressing of warnings through "// NOLINT" comments. There are some advantages that the attribute has: - Suppressing specific warnings instead of all warnings - Suppressing warnings in a block (namespace, function, compound statement) - Code formatting may split a statement into multiple lines, thus a "// NOLINT" comment may be on the wrong line I'm looking forward to your comments! [1] https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#inforce-enforcement Reviewers: alexfh, aaron.ballman, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24886 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298880 91177308-0d34-0410-b5e6-96231b3b80d8
-
Adam Nemet authored
Sema holds the current FPOptions which is adjusted by 'pragma STDC FP_CONTRACT'. This then gets propagated into expression nodes as they are built. This encapsulates FPOptions so that this propagation happens opaquely rather than directly with the fp_contractable on/off bit. This allows controlled transitioning of fp_contractable to a ternary value (off, on, fast). It will also allow adding more fast-math flags later. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. Differential Revision: https://reviews.llvm.org/D31166 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298877 91177308-0d34-0410-b5e6-96231b3b80d8
-
Daniel Jasper authored
for unused values. This fixes a regression caused by r298676, where constructor calls to classes with non-trivial dtor were marked as unused if the first argument is an initializer list. This is inconsistent (as the test shows) and also warns on a reasonbly common code pattern where people just call constructors to create and immediately destroy an object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298853 91177308-0d34-0410-b5e6-96231b3b80d8
-