]> granicus.if.org Git - clang/log
clang
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

7 years ago[Serialization] Serialize DependentSizedExtVectorType
Alex Lorenz [Wed, 22 Mar 2017 10:04:48 +0000 (10:04 +0000)]
[Serialization] Serialize DependentSizedExtVectorType

rdar://30659700

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

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

7 years ago[nonnull] Teach Clang to attach the nonnull LLVM attribute to
Chandler Carruth [Wed, 22 Mar 2017 09:09:13 +0000 (09:09 +0000)]
[nonnull] Teach Clang to attach the nonnull LLVM attribute to
declarations and calls instead of just definitions, and then teach it to
*not* attach such attributes even if the source code contains them.

This follows the design direction discussed on cfe-dev here:
http://lists.llvm.org/pipermail/cfe-dev/2017-January/052066.html

The idea is that for C standard library builtins, even if the library
vendor chooses to annotate their routines with __attribute__((nonnull)),
we will ignore those attributes which pertain to pointer arguments that
have an associated size. This allows the widespread (and seemingly
reasonable) pattern of calling these routines with a null pointer and
a zero size. I have only done this for the library builtins currently
recognized by Clang, but we can now trivially add to this set. This will
be controllable with -fno-builtin if anyone should care to do so.

Note that this does *not* change the AST. As a consequence, warnings,
static analysis, and source code rewriting are not impacted.

This isn't even a regression on any platform as neither Clang nor LLVM
have ever put 'nonnull' onto these arguments for declarations. All this
patch does is enable it on other declarations while preventing us from
ever accidentally enabling it on these libc functions due to a library
vendor.

It will also allow any other libraries using this annotation to gain
optimizations based on the annotation even when only a declaration is
visible.

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

7 years agoAdd LibreOffice Clang plugin to ExternalClangExamples.rst
Stephan Bergmann [Wed, 22 Mar 2017 08:45:49 +0000 (08:45 +0000)]
Add LibreOffice Clang plugin to ExternalClangExamples.rst

Reviewers: rsmith, rizsotto.mailinglist

Subscribers: cfe-commits

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

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

7 years agoMove setting of LangOpts based on target flags out of CompilerInstance
Eric Christopher [Wed, 22 Mar 2017 06:36:09 +0000 (06:36 +0000)]
Move setting of LangOpts based on target flags out of CompilerInstance
and into TargetInfo::adjust so that it gets called in more places
throughout the compiler (AST serialization in particular).

Should fix PPC modules after removing of faltivec.

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

7 years agoSuppress warning on unreachable [[clang::fallthrough]] within a template instantiation.
Richard Smith [Wed, 22 Mar 2017 01:49:19 +0000 (01:49 +0000)]
Suppress warning on unreachable [[clang::fallthrough]] within a template instantiation.

We don't know whether some other instantiation of the template might be able to
reach the annotation, so warning on it has a high chance of false positives.

Patch by Ahmed Asadi!

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

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

7 years agoRemove -ffp-contract=fast from this test
Adam Nemet [Wed, 22 Mar 2017 00:58:18 +0000 (00:58 +0000)]
Remove -ffp-contract=fast from this test

It does not need it and causes mismatch after -ffp-contract=fast is turned
into an FMF.

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

7 years agoChange -ffp-contract=fast test to run on Aarch64
Adam Nemet [Wed, 22 Mar 2017 00:58:15 +0000 (00:58 +0000)]
Change -ffp-contract=fast test to run on Aarch64

(I don't have powerpc enabled in my build and I am changing
how -ffp-contract=fast works.)

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

7 years ago[Modules] Rebuild modules on umbrella header mismatch
Bruno Cardoso Lopes [Wed, 22 Mar 2017 00:11:21 +0000 (00:11 +0000)]
[Modules] Rebuild modules on umbrella header mismatch

This restores behavior pre-r230064 since after PCMCache work (r298278)
we don't reload PCMs from disk within the same compiler invocation.

Testcases from r230064 are still left around since they still guarantee
the correct behavior we're expecting.

rdar://problem/19889777

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

7 years agoRemove the -faltivec alias option and replace it with -maltivec everywhere.
Eric Christopher [Tue, 21 Mar 2017 22:06:18 +0000 (22:06 +0000)]
Remove the -faltivec alias option and replace it with -maltivec everywhere.
The alias was only ever used on darwin and had some issues there,
and isn't used in practice much. Also fixes a problem with -mno-altivec
not turning off -maltivec.

Also add a diagnostic for faltivec/fno-altivec that directs users to use
maltivec options and include the altivec.h file explicitly.

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

7 years agoAdd support for -fno-auto-profile and -fno-profile-sample-use
Dehao Chen [Tue, 21 Mar 2017 21:40:53 +0000 (21:40 +0000)]
Add support for -fno-auto-profile and -fno-profile-sample-use

Summary: We need to be able to disable samplepgo for specific files by supporting -fno-auto-profile and -fno-profile-sample-use

Reviewers: davidxl, dnovillo, echristo

Reviewed By: echristo

Subscribers: echristo, cfe-commits

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

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

7 years agoApply clang-tidy's performance-unnecessary-value-param to parts of clang.
Benjamin Kramer [Tue, 21 Mar 2017 21:35:04 +0000 (21:35 +0000)]
Apply clang-tidy's performance-unnecessary-value-param to parts of clang.

No functionality change intended.

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

7 years ago[c-index-test] Fix memory leak in c-index-test tool.
Argyrios Kyrtzidis [Tue, 21 Mar 2017 21:34:05 +0000 (21:34 +0000)]
[c-index-test] Fix memory leak in c-index-test tool.

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

7 years agoiFix Test deprecation behavior in C89 mode as a result of r298410
Erich Keane [Tue, 21 Mar 2017 20:14:46 +0000 (20:14 +0000)]
iFix Test deprecation behavior in C89 mode as a result of r298410

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

7 years agoLet llvm.objectsize be conservative with null pointers
George Burgess IV [Tue, 21 Mar 2017 20:09:35 +0000 (20:09 +0000)]
Let llvm.objectsize be conservative with null pointers

D28494 adds another parameter to @llvm.objectsize. Clang needs to be
sure to pass that third arg whenever applicable.

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

7 years agoClang change: Do not inline hot callsites for samplepgo in thinlto compile phase.
Dehao Chen [Tue, 21 Mar 2017 19:55:46 +0000 (19:55 +0000)]
Clang change: Do not inline hot callsites for samplepgo in thinlto compile phase.

Summary:
Because SamplePGO passes will be invoked twice in ThinLTO build: once at compile phase, the other at backend. We want to make sure the IR at the 2nd phase matches the hot part in pro
file, thus we do not want to inline hot callsites in the first phase.

Reviewers: tejohnson, eraman

Reviewed By: tejohnson

Subscribers: mehdi_amini, cfe-commits, Prazek

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

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

7 years ago[X86][MS-compatability][clang] allow MS TYPE/SIZE/LENGTH operators as a part of a...
Coby Tayree [Tue, 21 Mar 2017 19:33:32 +0000 (19:33 +0000)]
[X86][MS-compatability][clang] allow MS TYPE/SIZE/LENGTH operators as a part of a compound expression

This patch introduces X86AsmParser with the ability to handle the aforementioned ops within compound "MS" arithmetical expressions.
Currently - only supported as a stand alone Operand, e.g.:
"TYPE X"
now allowed :
"4 + TYPE X * 128"

LLVM side: https://reviews.llvm.org/D31173
Differential Revision: https://reviews.llvm.org/D31174

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

7 years ago[CMake] fix CLANG_INCLUDE_DIRS CMake export
Guillaume Papin [Tue, 21 Mar 2017 19:17:53 +0000 (19:17 +0000)]
[CMake] fix CLANG_INCLUDE_DIRS CMake export

Summary:
This change should fixes the export of CLANG_INCLUDE_DIRS variable in ClangConfig.cmake.

Unlike for the other variables, CLANG_INSTALL_PREFIX wasn't escaped meaning CLANG_INCLUDE_DIRS
resulting in the path "/include" instead of "${CLANG_INSTALL_PREFIX}/include".

Reviewers: beanz

Subscribers: mgorny

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

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

7 years agoFix array sizes where address space is not yet known
Konstantin Zhuravlyov [Tue, 21 Mar 2017 18:55:39 +0000 (18:55 +0000)]
Fix array sizes where address space is not yet known

For variables in generic address spaces, for example:

```
unsigned char V[6442450944];
...
```

the address space is not yet known when we get into
*getConstantArrayType*, it is 0. AMDGCN target's
address space 0 has 32 bits pointers, so when we
call *getPointerWidth* with 0, the array size is
trimmed to 32 bits, which is not right.

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

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

7 years agoModules: Remove an invalid check in unit tests for r298278
Duncan P. N. Exon Smith [Tue, 21 Mar 2017 18:26:18 +0000 (18:26 +0000)]
Modules: Remove an invalid check in unit tests for r298278

This is a fixup for the unit tests from r298278 (originally r298165).

Since the buffer that RawB2 pointed at was later deleted, a new call to
getBuffer may very well return a buffer at the same/old address.  Which is
fine.  Just delete the spurious check.

A Windows bot was occasionally hitting this in practice:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7086

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

7 years agoCorrect class-template deprecation behavior
Erich Keane [Tue, 21 Mar 2017 17:49:17 +0000 (17:49 +0000)]
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.

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

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

7 years agoUpdate Clang for LLVM rename AttributeSet -> AttributeList
Reid Kleckner [Tue, 21 Mar 2017 16:57:30 +0000 (16:57 +0000)]
Update Clang for LLVM rename AttributeSet -> AttributeList

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

7 years ago[index/AST] Determine if a typedef shares a name and spelling location with its under...
Argyrios Kyrtzidis [Tue, 21 Mar 2017 16:56:02 +0000 (16:56 +0000)]
[index/AST] Determine if a typedef shares a name and spelling location with its underlying tag type

In such a case, as when using the NS_ENUM macro, for indexing purposes treat the typedef as 'transparent',
meaning we treat its references as symbols of the underlying tag symbol.
Also provide a libclang API to check for such typedefs.

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