]> granicus.if.org Git - clang/log
clang
7 years ago[msan] Turn off lifetime markers even when use after scope checking is on.
Benjamin Kramer [Fri, 31 Mar 2017 09:19:25 +0000 (09:19 +0000)]
[msan] Turn off lifetime markers even when use after scope checking is on.

Since r299174 use after scope checking is on by default. Even though
msan doesn't check for use after scope it gets confused by the lifetime
markers emitted for it, making unit tests fail. This is covered by
ninja check-msan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299191 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert test added in r299152
Teresa Johnson [Fri, 31 Mar 2017 04:29:07 +0000 (04:29 +0000)]
Revert test added in r299152

Removing the test until I can figure out how to get the ThinLTO backend
invocation of clang to use the correct target.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299181 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd target-cpu
Teresa Johnson [Fri, 31 Mar 2017 03:49:52 +0000 (03:49 +0000)]
Add target-cpu

Sigh, another follow-on fix needed for test in r299152 causing bot
failures. We also need the target-cpu for the ThinLTO BE clang
invocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299178 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd more target triples to test
Teresa Johnson [Fri, 31 Mar 2017 03:27:47 +0000 (03:27 +0000)]
Add more target triples to test

Third and hopefully final fix to test for r299152 that is causing bot
failures: make sure the target triple specified for the ThinLTO backend
clang invocations as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299176 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]
Kuba Mracek [Fri, 31 Mar 2017 03:00:09 +0000 (03:00 +0000)]
[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]

AddressSanitizer has an optional compile-time flag, -fsanitize-address-use-after-scope, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using -DLLVM_USE_SANITIZER=Address), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set true as the default value for AsanUseAfterScope. This also causes the lifetime markers to be generated whenever fsanitize=address is used. This has some nice consequences, e.g. we now have line numbers for all local variables.

Differential Revision: https://reviews.llvm.org/D31479

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299174 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix new compile command in test
Teresa Johnson [Fri, 31 Mar 2017 02:55:31 +0000 (02:55 +0000)]
Fix new compile command in test

My previous attempt to fix bot failures from r299152 didn't add the
necessary option to get bitcode out of the cc1 step.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299173 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd triple to new test
Teresa Johnson [Fri, 31 Mar 2017 02:36:47 +0000 (02:36 +0000)]
Add triple to new test

Attempt to fix bot errors from r299152 by using clang_cc1 and specifying
target triple to compile step.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299170 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backends
Teresa Johnson [Fri, 31 Mar 2017 02:05:15 +0000 (02:05 +0000)]
[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backends

Summary:
This involved refactoring out pieces of
EmitAssemblyHelper::CreateTargetMachine for use in runThinLTOBackend.

Subsumes D31114.

Reviewers: mehdi_amini, pcc

Subscribers: Prazek, cfe-commits

Differential Revision: https://reviews.llvm.org/D31508

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299152 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate x86-64 ABI link with the one from linuxbase.org since the other
Eric Christopher [Fri, 31 Mar 2017 01:59:40 +0000 (01:59 +0000)]
Update x86-64 ABI link with the one from linuxbase.org since the other
seems to be down.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299151 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix typo, defind -> defined.
Eric Christopher [Fri, 31 Mar 2017 01:45:39 +0000 (01:45 +0000)]
Fix typo, defind -> defined.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299148 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agofixup: use CHECK for non-atttribute sets
Dean Michael Berris [Thu, 30 Mar 2017 22:46:49 +0000 (22:46 +0000)]
fixup: use CHECK for non-atttribute sets

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299127 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XRay][clang] Fix the -fxray-instruction-threshold flag processing
Dean Michael Berris [Thu, 30 Mar 2017 22:46:45 +0000 (22:46 +0000)]
[XRay][clang] Fix the -fxray-instruction-threshold flag processing

Summary:
The refactoring introduced a regression in the flag processing for
-fxray-instruction-threshold which causes it to not get passed properly.
This change should restore the previous behaviour.

Reviewers: rnk, pelikan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D31491

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299126 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoClang changes for alloc_align attribute
Erich Keane [Thu, 30 Mar 2017 21:48:55 +0000 (21:48 +0000)]
Clang changes for alloc_align attribute

GCC has the alloc_align attribute, which is similar to assume_aligned, except the attribute's parameter is the index of the integer parameter that needs aligning to.

Differential Revision: https://reviews.llvm.org/D29599

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299117 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCorrecting a typo; NFC.
Aaron Ballman [Thu, 30 Mar 2017 18:11:20 +0000 (18:11 +0000)]
Correcting a typo; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299094 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSpelling mistakes in comments. NFCI. (PR27635)
Simon Pilgrim [Thu, 30 Mar 2017 14:13:19 +0000 (14:13 +0000)]
Spelling mistakes in comments. NFCI. (PR27635)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299083 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and
Alex Lorenz [Thu, 30 Mar 2017 13:48:33 +0000 (13:48 +0000)]
[ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and
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

7 years agoMove NumRegParameters Module Flag. NFCI.
Nirav Dave [Thu, 30 Mar 2017 13:41:44 +0000 (13:41 +0000)]
Move NumRegParameters Module Flag. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299079 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema][ObjC] Avoid the "type of property does not match type of accessor"
Alex Lorenz [Thu, 30 Mar 2017 13:33:51 +0000 (13:33 +0000)]
[Sema][ObjC] Avoid the "type of property does not match type of accessor"
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

7 years agoAdd `replace` interface with range in AtomicChange.
Haojian Wu [Thu, 30 Mar 2017 13:07:38 +0000 (13:07 +0000)]
Add `replace` interface with range in AtomicChange.

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

7 years ago[APInt] Remove references to integerPartWidth and integerPart outside of APFloat...
Craig Topper [Thu, 30 Mar 2017 05:48:58 +0000 (05:48 +0000)]
[APInt] Remove references to integerPartWidth and integerPart outside of APFloat implentation.

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

7 years agoUse 'unsigned' for enum bitfields
Reid Kleckner [Thu, 30 Mar 2017 01:12:08 +0000 (01:12 +0000)]
Use 'unsigned' for enum bitfields

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

7 years ago[XRay][clang] Use llvm::to_string instead of std::string
Dean Michael Berris [Thu, 30 Mar 2017 01:05:09 +0000 (01:05 +0000)]
[XRay][clang] Use llvm::to_string instead of std::string

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

7 years ago[XRay] Add -fxray-{always,never}-instrument= flags to clang
Dean Michael Berris [Thu, 30 Mar 2017 00:29:36 +0000 (00:29 +0000)]
[XRay] Add -fxray-{always,never}-instrument= flags to clang

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

7 years agoAdd the -grecord-gcc-switches option and pass the flags down on the compile unit.
Eric Christopher [Wed, 29 Mar 2017 23:34:20 +0000 (23:34 +0000)]
Add the -grecord-gcc-switches option and pass the flags down on the compile unit.

Patch by Zhizhou Yang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299037 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse FPContractModeKind universally
Adam Nemet [Wed, 29 Mar 2017 21:54:24 +0000 (21:54 +0000)]
Use FPContractModeKind universally

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

7 years agoRevert "Use FPContractModeKind universally"
Adam Nemet [Wed, 29 Mar 2017 21:24:19 +0000 (21:24 +0000)]
Revert "Use FPContractModeKind universally"

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

7 years agoUse FPContractModeKind universally
Adam Nemet [Wed, 29 Mar 2017 20:39:49 +0000 (20:39 +0000)]
Use FPContractModeKind universally

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

7 years ago[Objective-C] Miscellaneous -fobjc-weak Fixes
Brian Kelley [Wed, 29 Mar 2017 18:16:38 +0000 (18:16 +0000)]
[Objective-C] Miscellaneous -fobjc-weak Fixes

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

7 years ago[Objective-C] Fix "weak-unavailable" warning with -fobjc-weak
Brian Kelley [Wed, 29 Mar 2017 18:09:02 +0000 (18:09 +0000)]
[Objective-C] Fix "weak-unavailable" warning with -fobjc-weak

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

7 years agoUnbreak windows bot.
Graydon Hoare [Wed, 29 Mar 2017 17:58:41 +0000 (17:58 +0000)]
Unbreak windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299012 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Objective-C] Fix "repeated use of weak" warning with -fobjc-weak
Brian Kelley [Wed, 29 Mar 2017 17:55:11 +0000 (17:55 +0000)]
[Objective-C] Fix "repeated use of weak" warning with -fobjc-weak

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

7 years ago[Objective-C] Fix __weak type traits with -fobjc-weak
Brian Kelley [Wed, 29 Mar 2017 17:40:35 +0000 (17:40 +0000)]
[Objective-C] Fix __weak type traits with -fobjc-weak

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

7 years ago[PCH] Attach instance's dependency collectors to PCH external AST sources.
Graydon Hoare [Wed, 29 Mar 2017 17:33:09 +0000 (17:33 +0000)]
[PCH] Attach instance's dependency collectors to PCH external AST sources.

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

7 years ago[Objective-C] C++ Classes with __weak Members non-POD Types when using -fobjc-weak
Brian Kelley [Wed, 29 Mar 2017 17:31:42 +0000 (17:31 +0000)]
[Objective-C] C++ Classes with __weak Members non-POD Types when using -fobjc-weak

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

7 years agoTest Commit
Brian Kelley [Wed, 29 Mar 2017 17:18:05 +0000 (17:18 +0000)]
Test Commit

Remove trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299007 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReapplied r298976 [OpenCL] Added parsing for OpenCL vector types.
Egor Churaev [Wed, 29 Mar 2017 12:09:39 +0000 (12:09 +0000)]
Reapplied r298976 [OpenCL] Added parsing for OpenCL vector types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298992 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReverted r298976 [OpenCL] Added parsing for OpenCL vector types.
Egor Churaev [Wed, 29 Mar 2017 05:40:45 +0000 (05:40 +0000)]
Reverted r298976 [OpenCL] Added parsing for OpenCL vector types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298978 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Added parsing for OpenCL vector types.
Egor Churaev [Wed, 29 Mar 2017 05:08:18 +0000 (05:08 +0000)]
[OpenCL] Added parsing for OpenCL vector types.

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

7 years agoRevert "Added `applyAtomicChanges` function."
Juergen Ributzka [Wed, 29 Mar 2017 00:24:36 +0000 (00:24 +0000)]
Revert "Added `applyAtomicChanges` function."

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

7 years agoRevert "Try to unbreak buildbots after r298913."
Juergen Ributzka [Wed, 29 Mar 2017 00:24:34 +0000 (00:24 +0000)]
Revert "Try to unbreak buildbots after r298913."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298966 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "clangToolingRefactor: Add libdeps upon clangFormat in r298913."
Juergen Ributzka [Wed, 29 Mar 2017 00:24:32 +0000 (00:24 +0000)]
Revert "clangToolingRefactor: Add libdeps upon clangFormat in r298913."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298965 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDefault enable the rtm feature only on skylake and later for now because Intel disabl...
Eric Christopher [Tue, 28 Mar 2017 23:03:19 +0000 (23:03 +0000)]
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

7 years ago[analyzer] Fix symbolication for unknown unary increment/decrement results.
Artem Dergachev [Tue, 28 Mar 2017 15:57:12 +0000 (15:57 +0000)]
[analyzer] Fix symbolication for unknown unary increment/decrement results.

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

7 years ago[analyzer] When creating a temporary object, properly copy the value into it.
Artem Dergachev [Tue, 28 Mar 2017 15:43:26 +0000 (15:43 +0000)]
[analyzer] When creating a temporary object, properly copy the value into it.

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

7 years agoclangToolingRefactor: Add libdeps upon clangFormat in r298913.
NAKAMURA Takumi [Tue, 28 Mar 2017 14:18:10 +0000 (14:18 +0000)]
clangToolingRefactor: Add libdeps upon clangFormat in r298913.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298921 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTry to unbreak buildbots after r298913.
Eric Liu [Tue, 28 Mar 2017 13:56:19 +0000 (13:56 +0000)]
Try to unbreak buildbots after r298913.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298919 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdded `applyAtomicChanges` function.
Eric Liu [Tue, 28 Mar 2017 13:05:32 +0000 (13:05 +0000)]
Added `applyAtomicChanges` function.

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

7 years ago[ASTMatchers] add typeAliasTemplateDecl matcher.
Eric Liu [Tue, 28 Mar 2017 12:56:47 +0000 (12:56 +0000)]
[ASTMatchers] add typeAliasTemplateDecl matcher.

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

7 years agoFileManager: mark virtual file entries as valid entries
Erik Verbruggen [Tue, 28 Mar 2017 09:18:05 +0000 (09:18 +0000)]
FileManager: mark virtual file entries as valid entries

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

7 years ago[libclang] Fix crash in member access code completion with implicit base
Erik Verbruggen [Tue, 28 Mar 2017 07:22:21 +0000 (07:22 +0000)]
[libclang] Fix crash in member access code completion with implicit base

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

7 years agoUse BuildReturnStmt in SemaCoroutine to unbreak sanitizer tests.
Gor Nishanov [Tue, 28 Mar 2017 02:51:45 +0000 (02:51 +0000)]
Use BuildReturnStmt in SemaCoroutine to unbreak sanitizer tests.

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

7 years ago[coroutines] Handle get_return_object_on_allocation_failure
Gor Nishanov [Mon, 27 Mar 2017 23:36:59 +0000 (23:36 +0000)]
[coroutines] Handle get_return_object_on_allocation_failure

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

7 years agoAdd [[clang::suppress(rule, ...)]] attribute
Matthias Gehre [Mon, 27 Mar 2017 19:45:24 +0000 (19:45 +0000)]
Add [[clang::suppress(rule, ...)]] attribute

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

7 years agoEncapsulate FPOptions and use it consistently
Adam Nemet [Mon, 27 Mar 2017 19:17:25 +0000 (19:17 +0000)]
Encapsulate FPOptions and use it consistently

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

7 years agoLook through CXXBindTemporaryExprs when checking CXXFunctionCastExprs
Daniel Jasper [Mon, 27 Mar 2017 16:29:41 +0000 (16:29 +0000)]
Look through CXXBindTemporaryExprs when checking CXXFunctionCastExprs
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

7 years ago[ARM] Add a driver option for +no-neg-immediates
Sanne Wouda [Mon, 27 Mar 2017 15:34:52 +0000 (15:34 +0000)]
[ARM] Add a driver option for +no-neg-immediates

Reviewers: olista01, rengolin, javed.absar, samparker

Reviewed By: samparker

Subscribers: samparker, llvm-commits, aemerson

Differential Revision: https://reviews.llvm.org/D31197

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298850 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPublish one more parser RAII for external use.
Vassil Vassilev [Mon, 27 Mar 2017 13:11:32 +0000 (13:11 +0000)]
Publish one more parser RAII for external use.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298842 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Extended mapping of parcing CodeGen arguments
Egor Churaev [Mon, 27 Mar 2017 10:38:01 +0000 (10:38 +0000)]
[OpenCL] Extended mapping of parcing CodeGen arguments

Summary: Enable cl_mad_enamle and cl_no_signed_zeros options when user turns on cl_unsafe_math_optimizations or cl_fast_relaxed_math options.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

Differential Revision: https://reviews.llvm.org/D31324

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298838 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XRay][clang] Remove dependency on libatomic for XRay builds
Dean Michael Berris [Mon, 27 Mar 2017 07:14:11 +0000 (07:14 +0000)]
[XRay][clang] Remove dependency on libatomic for XRay builds

Summary:
This change depends on D31381 where we change the implementation to use
sanitizer_common provided atomic operations library.

Fixes http://llvm.org/PR32274.

Reviewers: pelikan, dblaikie

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D31382

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298835 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r298742 "[ODRHash] Add error messages for mismatched parameters in methods."
Vassil Vassilev [Sun, 26 Mar 2017 21:39:16 +0000 (21:39 +0000)]
Revert r298742 "[ODRHash] Add error messages for mismatched parameters in methods."

I failed to revert this in r298816.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298824 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert 298754 and 298742.
Vassil Vassilev [Sun, 26 Mar 2017 18:32:53 +0000 (18:32 +0000)]
Revert 298754 and 298742.

They broke llvm modules builds and our internal modules infrastructure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298816 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[coroutines] Add codegen for await and yield expressions
Gor Nishanov [Sun, 26 Mar 2017 02:18:05 +0000 (02:18 +0000)]
[coroutines] Add codegen for await and yield expressions

Details:

Emit suspend expression which roughly looks like:

auto && x = CommonExpr();
if (!x.await_ready()) {
   llvm_coro_save();
   x.await_suspend(...);     (*)
   llvm_coro_suspend(); (**)
}
x.await_resume();
where the result of the entire expression is the result of x.await_resume()

(*) If x.await_suspend return type is bool, it allows to veto a suspend:
if (x.await_suspend(...))
   llvm_coro_suspend();
(**) llvm_coro_suspend() encodes three possible continuations as a switch instruction:

%where-to = call i8 @llvm.coro.suspend(...)
switch i8 %where-to, label %coro.ret [ ; jump to epilogue to suspend
  i8 0, label %yield.ready   ; go here when resumed
  i8 1, label %yield.cleanup ; go here when destroyed
]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298784 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago_CALL_LINUX is only defined on 64-bit ppc linux platforms, not 32-bit.
Eric Christopher [Sat, 25 Mar 2017 19:26:04 +0000 (19:26 +0000)]
_CALL_LINUX is only defined on 64-bit ppc linux platforms, not 32-bit.
Adjust and add a test for the 32-bit side.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298778 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Make AMDGPUTargetInfo::AS private
Yaxun Liu [Sat, 25 Mar 2017 11:34:41 +0000 (11:34 +0000)]
[AMDGPU] Make AMDGPUTargetInfo::AS private

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298773 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128.
Eric Christopher [Sat, 25 Mar 2017 06:38:57 +0000 (06:38 +0000)]
Update the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298771 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.
Eric Christopher [Sat, 25 Mar 2017 06:37:23 +0000 (06:37 +0000)]
Add the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298770 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDefine __HAVE_BSWAP__ on ppc to match gcc since we support both builtins as well.
Eric Christopher [Sat, 25 Mar 2017 05:40:13 +0000 (05:40 +0000)]
Define __HAVE_BSWAP__ on ppc to match gcc since we support both builtins as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298769 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Switch address space mapping by triple environment amdgiz
Yaxun Liu [Sat, 25 Mar 2017 03:46:25 +0000 (03:46 +0000)]
[AMDGPU] Switch address space mapping by triple environment amdgiz

For target environment amdgiz and amdgizcl (giz means Generic Is Zero), AMDGPU will use new address space mapping where generic address space is 0 and private address space is 5. The data layout is also changed correspondingly.

Differential Revision: https://reviews.llvm.org/D31210

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298767 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd the _CALL_LINUX preprocessor define for ppc linux platforms.
Eric Christopher [Sat, 25 Mar 2017 03:33:59 +0000 (03:33 +0000)]
Add the _CALL_LINUX preprocessor define for ppc linux platforms.

This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but
our ppc suppport post-dates this and it should work on all linux platforms. It
is guaranteed to work on all elfv2 platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298765 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago__BIGGEST_ALIGNMENT__ has always been 16 on all power platforms rather
Eric Christopher [Sat, 25 Mar 2017 02:55:21 +0000 (02:55 +0000)]
__BIGGEST_ALIGNMENT__ has always been 16 on all power platforms rather
than the default of 8 in clang, fix and update tests accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298761 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd preprocessor defines for a bare powerpc64le triple/cpu.
Eric Christopher [Sat, 25 Mar 2017 02:29:18 +0000 (02:29 +0000)]
Add preprocessor defines for a bare powerpc64le triple/cpu.
The le triple didn't exist until power8, so use that as a default (this
also matches what gcc does).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298759 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ODRHash] Add support for array and decayed types.
Richard Trieu [Sat, 25 Mar 2017 00:48:52 +0000 (00:48 +0000)]
[ODRHash] Add support for array and decayed types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298754 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ODRHash] Add error messages for mismatched parameters in methods.
Richard Trieu [Fri, 24 Mar 2017 21:17:48 +0000 (21:17 +0000)]
[ODRHash] Add error messages for mismatched parameters in methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298742 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix a test so that it actually checks the output.
Peter Collingbourne [Fri, 24 Mar 2017 19:32:20 +0000 (19:32 +0000)]
Fix a test so that it actually checks the output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298728 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix MSVC 'not all control paths return a value' warning.
Simon Pilgrim [Fri, 24 Mar 2017 16:59:14 +0000 (16:59 +0000)]
Fix MSVC 'not all control paths return a value' warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298712 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL][Bug 10573] Don't set CXXOperatorNames flag
Anastasia Stulova [Fri, 24 Mar 2017 16:43:51 +0000 (16:43 +0000)]
[OpenCL][Bug 10573] Don't set CXXOperatorNames flag

The flag CXXOperatorNames was overwritten unconditionally
after being set for OpenCL.

There seems to be no necessity to set it, so removing the line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298709 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] MisusedMovedObject: Remove deprecated callback. NFC
Artem Dergachev [Fri, 24 Mar 2017 10:16:08 +0000 (10:16 +0000)]
[analyzer] MisusedMovedObject: Remove deprecated callback. NFC

wantsRegionChangeUpdate() checker callback is no longer used since recently.

Fixes a buildbot warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298699 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Add MisusedMovedObjectChecker for detecting use-after-move errors.
Artem Dergachev [Fri, 24 Mar 2017 09:52:30 +0000 (09:52 +0000)]
[analyzer] Add MisusedMovedObjectChecker for detecting use-after-move errors.

The checker currently warns on copying, moving, or calling methods on an object
that was recently std::move'd from. It understands a set of "state reset"
methods that bring a moved-from object back to a well-specified state.

Patch by Peter Szecsi!

Differential Revision: https://reviews.llvm.org/D24246

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298698 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libclang] Bury dead TemporaryFiles
Krasimir Georgiev [Fri, 24 Mar 2017 09:49:54 +0000 (09:49 +0000)]
[libclang] Bury dead TemporaryFiles

Summary:
AllocatedCXCodeCompleteResults::TemporaryFiles have turned into zombies.
Seven years ago they used to do their job during [[ https://github.com/llvm-mirror/clang/commit/313e26c4e81f0e467490a530548450f4c824a6c4/tools/CIndex/CIndexCodeCompletion.cpp#diff-02d3e692ad507b10af9458b775c5750bL261 | file remapping]], but now they are created just to be torn down in the destructor.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D31288

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298697 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r298491 and r298494 which changed Clang's handling of 'nonnull'
Chandler Carruth [Fri, 24 Mar 2017 09:11:57 +0000 (09:11 +0000)]
Revert r298491 and r298494 which changed Clang's handling of 'nonnull'
attributes.

These patches don't work because we can't currently access the parameter
information in a reliable way when building attributes. I thought this
would be relatively straightforward to fix, but it seems not to be the
case. Fixing this will requrie a substantial re-plumbing of machinery to
allow attributes to be handled in this location, and several other fixes
to the attribute machinery should probably be made at the same time. All
of this will make the patch .... substantially more complicated.

Reverting for now as there are active miscompiles caused by the current
version.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298695 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix handling of initialization from parenthesized initializer list.
Richard Smith [Fri, 24 Mar 2017 01:14:25 +0000 (01:14 +0000)]
Fix handling of initialization from parenthesized initializer list.

This change fixes a crash on initialization of a reference from ({}) during
template instantiation and incidentally improves diagnostics.

This reverts a prior attempt to handle this in r286721. Instead, we teach the
initialization code that initialization cannot be performed if a source type
is required and the initializer is an initializer list (which is not an
expression and does not have a type), and likewise for function-style cast
expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298676 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XRay] Do not depend on C++ stdlib for XRay builds
Dean Michael Berris [Fri, 24 Mar 2017 00:20:05 +0000 (00:20 +0000)]
[XRay] Do not depend on C++ stdlib for XRay builds

Summary:
Now that XRay doesn't require a runtime dependency on a C++ standard
library, we remove that dependency from the clang linker flags.

Reviewers: saugustine, pelikan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D31313

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298670 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove uses of std::binary_function, removed in C++17.
Richard Smith [Thu, 23 Mar 2017 23:32:03 +0000 (23:32 +0000)]
Remove uses of std::binary_function, removed in C++17.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298663 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove all uses of std::mem_fun and std::bind1st removed in C++17.
Richard Smith [Thu, 23 Mar 2017 23:17:58 +0000 (23:17 +0000)]
Remove all uses of std::mem_fun and std::bind1st removed in C++17.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298657 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile...
Dehao Chen [Thu, 23 Mar 2017 21:20:17 +0000 (21:20 +0000)]
Update the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile phase.

Summary: This is the test added for https://reviews.llvm.org/D31217

Reviewers: tejohnson, mehdi_amini

Reviewed By: tejohnson

Subscribers: cfe-commits, Prazek

Differential Revision: https://reviews.llvm.org/D31219

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298647 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ThinLTO] Clang support for emitting minimized bitcode for thin link
Teresa Johnson [Thu, 23 Mar 2017 19:47:49 +0000 (19:47 +0000)]
[ThinLTO] Clang support for emitting minimized bitcode for thin link

Summary:
Clang companion patch to LLVM patch D31027, which adds support
for emitting minimized bitcode file for use in the thin link step.
Add a cc1 option -fthin-link-bitcode=<file> to trigger this behavior.

Depends on D31027.

Reviewers: mehdi_amini, pcc

Subscribers: cfe-commits, Prazek

Differential Revision: https://reviews.llvm.org/D31050

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298639 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCorrect class-template deprecation behavior-REDUX
Erich Keane [Thu, 23 Mar 2017 18:51:54 +0000 (18:51 +0000)]
Correct class-template deprecation behavior-REDUX

Correct class-template deprecation behavior

Based on the comment in the test, and my reading of the standard, a deprecated warning should be issued in the following case:
template<typename T> [[deprecated]] class Foo{}; Foo<int> f;

This was not the case, because the ClassTemplateSpecializationDecl creation did not also copy the deprecated attribute.

Note: I did NOT audit the complete set of attributes to see WHICH ones should be copied, so instead I simply copy ONLY the deprecated attribute.

Previous DiffRev: https://reviews.llvm.org/D27486, was reverted.
This patch fixes the issues brought up here by the reverter: https://reviews.llvm.org/rL298410

Differential Revision: https://reviews.llvm.org/D31245

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298634 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[index] When indexing system headers make sure to report important reference relations
Argyrios Kyrtzidis [Thu, 23 Mar 2017 16:34:47 +0000 (16:34 +0000)]
[index] When indexing system headers make sure to report important reference relations

Even if we exclude plain reference occurrences, we should include relation-based references, like the 'base' one.

rdar://31010737

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298622 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPublish RAIIObjectsForParser.h for external usage.
Vassil Vassilev [Thu, 23 Mar 2017 15:11:07 +0000 (15:11 +0000)]
Publish RAIIObjectsForParser.h for external usage.

Some clients (eg the cling interpreter) need to recover their parser from
errors.

Patch by Axel Naumann (D31190)!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298606 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSupport attributes for Objective-C categories
Alex Lorenz [Thu, 23 Mar 2017 11:44:25 +0000 (11:44 +0000)]
Support attributes for Objective-C categories

rdar://31095315

Differential Revision: https://reviews.llvm.org/D31179

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298589 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen] Emit a CoreFoundation link guard when @available is used
Alex Lorenz [Thu, 23 Mar 2017 11:14:27 +0000 (11:14 +0000)]
[CodeGen] Emit a CoreFoundation link guard when @available is used

After r297760, __isOSVersionAtLeast in compiler-rt loads the CoreFoundation
symbols at runtime. This means that `@available` will always fail when used in a
binary without a linked CoreFoundation.

This commit forces Clang to emit a reference to a CoreFoundation symbol when
`@available` is used to ensure that linking will fail when CoreFoundation isn't
linked with the build product.

rdar://31039592

Differential Revision: https://reviews.llvm.org/D30977

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298588 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ObjC][ARC] Avoid -Warc-performSelector-leaks for performSelector variations
Alex Lorenz [Thu, 23 Mar 2017 10:46:05 +0000 (10:46 +0000)]
[ObjC][ARC] Avoid -Warc-performSelector-leaks for performSelector variations
that became supported after r297019

The commit r297019 expanded the performSelector ObjC method family heuristic
to ensure that -Wobjc-unsafe-perform-selector covers all performSelector
variations. However, this made the -Warc-performSelector-leaks too noisy, as
that warning produces mostly false positives since the selector is unknown.
This commit reverts the ObjC method family heuristics introduced in r297019.
This ensures that -Warc-performSelector-leaks isn't too noisy. The commit still
preserves the coverage of -Wobjc-unsafe-perform-selector.

rdar://31124629

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298587 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix issues in clang-format's AlignConsecutive modes.
Nikola Smiljanic [Thu, 23 Mar 2017 02:51:25 +0000 (02:51 +0000)]
Fix issues in clang-format's AlignConsecutive modes.

Patch by Ben Harper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298574 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[coroutines] Implement unhandled_exception changes.
Eric Fiselier [Thu, 23 Mar 2017 00:33:33 +0000 (00:33 +0000)]
[coroutines] Implement unhandled_exception changes.

Summary:
This patch adopts the recent changes that renamed `set_exception(exception_pointer)` to `unhandled_exception()`.

Additionally `unhandled_exception()` is now required, and so an error is emitted when exceptions are enabled but the promise type does not provide the member.
When exceptions are disabled a warning is emitted instead of an error, The warning notes that the `unhandled_exception()` function is required when exceptions are enabled.

Reviewers: rsmith, GorNishanov, aaron.ballman, majnemer

Reviewed By: GorNishanov

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D30859

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298565 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoActually install scan-build / ccc-analyzer / c++-analyzer on windows
Jonathan Roelofs [Wed, 22 Mar 2017 21:13:49 +0000 (21:13 +0000)]
Actually install scan-build / ccc-analyzer / c++-analyzer on windows

Before, we were only installing the wrappers... oops.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298549 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Implement __readgsqword (and the rest) as builtins (PR32373)
Hans Wennborg [Wed, 22 Mar 2017 19:13:13 +0000 (19:13 +0000)]
[X86] Implement __readgsqword (and the rest) as builtins (PR32373)

It seems MS headers have started using __readgsqword, and since it's
used in a header that doesn't include intrin.h, we can't implement it as
an inline function anymore.

That was already the case for __readfsdword, which Saleem added support
for in r220859. This patch reuses that codegen to implement all of
__read[fg]s{byte,word,dword,qword}.

Differential Revision: https://reviews.llvm.org/D31248

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298538 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][MMX] Add tests for _mm_set*_* intrinsics
Simon Pilgrim [Wed, 22 Mar 2017 14:55:43 +0000 (14:55 +0000)]
[X86][MMX] Add tests for _mm_set*_* intrinsics

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298511 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Correct class-template deprecation behavior"
Martin Bohme [Wed, 22 Mar 2017 13:34:37 +0000 (13:34 +0000)]
Revert "Correct class-template deprecation behavior"

This reverts commit r298410 (which produces incorrect warnings, see
comments on https://reviews.llvm.org/rL298410).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298504 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "iFix Test deprecation behavior in C89 mode as a result of r298410"
Martin Bohme [Wed, 22 Mar 2017 13:33:03 +0000 (13:33 +0000)]
Revert "iFix Test deprecation behavior in C89 mode as a result of r298410"

This reverts commit r298433. (Required to revert r298410, see comments
there.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298503 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove an overly aggressive assert in r298491 and leave a comment
Chandler Carruth [Wed, 22 Mar 2017 10:38:07 +0000 (10:38 +0000)]
Remove an overly aggressive assert in r298491 and leave a comment
explaining why we have to ignore errors here even though in other parts
of codegen we can be more strict with builtins.

Also add a test case based on the code in a TSan test that found this
issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298494 91177308-0d34-0410-b5e6-96231b3b80d8