opencl/clang.git
3 years ago[CodeGen] Unify generation of scalar and struct-path TBAA tags master
Ivan A. Kosarev [Thu, 5 Oct 2017 11:08:17 +0000 (11:08 +0000)]
[CodeGen] Unify generation of scalar and struct-path TBAA tags

This patch makes it possible to produce access tags in a uniform
manner regardless whether the resulting tag will be a scalar or a
struct-path one. getAccessTagInfo() now takes care of the actual
translation of access descriptors to tags and can handle all
kinds of accesses. Facilities that specific to scalar accesses
are eliminated.

Some more details:
* DecorateInstructionWithTBAA() is not responsible for conversion
  of types to access tags anymore. Instead, it takes an access
  descriptor (TBAAAccessInfo) and generates corresponding access
  tag from it.
* getTBAAInfoForVTablePtr() reworked to
  getTBAAVTablePtrAccessInfo() that now returns the
  virtual-pointer access descriptor and not the virtual-point
  type metadata.
* Added function getTBAAMayAliasAccessInfo() that returns the
  descriptor for may-alias accesses.
* getTBAAStructTagInfo() renamed to getTBAAAccessTagInfo() as now
  it is the only way to generate access tag by a given access
  descriptor. It is capable of producing both scalar and
  struct-path tags, depending on options and availability of the
  base access type. getTBAAScalarTagInfo() and its cache
  ScalarTagMetadataCache are eliminated.
* Now that we do not need to care about whether the resulting
  access tag should be a scalar or struct-path one,
  getTBAAStructTypeInfo() is renamed to getBaseTypeInfo().
* Added function getTBAAAccessInfo() that constructs access
  descriptor by a given QualType access type.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

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

3 years agoRevert r314977 "[CodeGen] Unify generation of scalar and struct-path TBAA tags"
Ivan A. Kosarev [Thu, 5 Oct 2017 11:05:43 +0000 (11:05 +0000)]
Revert r314977 "[CodeGen] Unify generation of scalar and struct-path TBAA tags"

D37826 has been mistakenly committed where it should be the patch from D38503.

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

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

3 years ago[CodeGen] Unify generation of scalar and struct-path TBAA tags
Ivan A. Kosarev [Thu, 5 Oct 2017 10:47:51 +0000 (10:47 +0000)]
[CodeGen] Unify generation of scalar and struct-path TBAA tags

This patch makes it possible to produce access tags in a uniform
manner regardless whether the resulting tag will be a scalar or a
struct-path one. getAccessTagInfo() now takes care of the actual
translation of access descriptors to tags and can handle all
kinds of accesses. Facilities that specific to scalar accesses
are eliminated.

Some more details:
* DecorateInstructionWithTBAA() is not responsible for conversion
  of types to access tags anymore. Instead, it takes an access
  descriptor (TBAAAccessInfo) and generates corresponding access
  tag from it.
* getTBAAInfoForVTablePtr() reworked to
  getTBAAVTablePtrAccessInfo() that now returns the
  virtual-pointer access descriptor and not the virtual-point
  type metadata.
* Added function getTBAAMayAliasAccessInfo() that returns the
  descriptor for may-alias accesses.
* getTBAAStructTagInfo() renamed to getTBAAAccessTagInfo() as now
  it is the only way to generate access tag by a given access
  descriptor. It is capable of producing both scalar and
  struct-path tags, depending on options and availability of the
  base access type. getTBAAScalarTagInfo() and its cache
  ScalarTagMetadataCache are eliminated.
* Now that we do not need to care about whether the resulting
  access tag should be a scalar or struct-path one,
  getTBAAStructTypeInfo() is renamed to getBaseTypeInfo().
* Added function getTBAAAccessInfo() that constructs access
  descriptor by a given QualType access type.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

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

3 years ago[analyzer] Fix leak false positives on stuff put in C++/ObjC initializer lists.
Artem Dergachev [Thu, 5 Oct 2017 08:43:32 +0000 (08:43 +0000)]
[analyzer] Fix leak false positives on stuff put in C++/ObjC initializer lists.

The analyzer now realizes that C++ std::initializer_list objects and
Objective-C boxed structure/array/dictionary expressions can potentially
maintain a reference to the objects that were put into them. This avoids
false memory leak posivites and a few other issues.

This is a conservative behavior; for now, we do not model what actually happens
to the objects after being passed into such initializer lists.

rdar://problem/32918288
Differential Revision: https://reviews.llvm.org/D35216

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

3 years agoEnabling new pass manager in LTO (and thinLTO) link step.
Sean Fertile [Thu, 5 Oct 2017 01:50:48 +0000 (01:50 +0000)]
Enabling new pass manager in LTO (and thinLTO) link step.

Passes 'new-pass-manager' option to the linker plugin when the new pass
manager is enabled.

Patch by Graham Yiu.

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

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

3 years ago[Analyzer Tests] Fix misc bugs in analyzer reference results updater.
George Karpenkov [Thu, 5 Oct 2017 01:02:20 +0000 (01:02 +0000)]
[Analyzer Tests] Fix misc bugs in analyzer reference results updater.

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

3 years agoAdd testcase for r314956:
Richard Smith [Thu, 5 Oct 2017 00:48:18 +0000 (00:48 +0000)]
Add testcase for r314956:

PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.

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

3 years agoPR33924: Merge block-scope anonymous declarations if there are multiple definitions...
Richard Smith [Thu, 5 Oct 2017 00:47:24 +0000 (00:47 +0000)]
PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.

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

3 years agoRemove PendingBody mechanism for function and ObjC method deserialization.
Richard Smith [Thu, 5 Oct 2017 00:43:38 +0000 (00:43 +0000)]
Remove PendingBody mechanism for function and ObjC method deserialization.

In its place, track on the canonical function declaration whether there is a
declaration with a body (and if so, which one). This brings function definition
handling in line with what we do in all other contexts, and is necessary to
allow us to merge declarations within multiple definitions of the same function
(eg, PR33924).

No functionality change intended.

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

3 years agoFix 'section' warning behavior with tentatively-defined values
Erich Keane [Wed, 4 Oct 2017 22:16:24 +0000 (22:16 +0000)]
Fix 'section' warning behavior with tentatively-defined values

As reported on cfe-commits, r314262 resulted in tentatively-defined
variables not being excluded for the warning.

Patch By: Elizabeth Andrews

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

3 years ago[OpenCL] Clean up and add missing fields for block struct
Yaxun Liu [Wed, 4 Oct 2017 20:32:17 +0000 (20:32 +0000)]
[OpenCL] Clean up and add missing fields for block struct

Currently block is translated to a structure equivalent to

struct Block {
  void *isa;
  int flags;
  int reserved;
  void *invoke;
  void *descriptor;
};
Except invoke, which is the pointer to the block invoke function,
all other fields are useless for OpenCL, which clutter the IR and
also waste memory since the block struct is passed to the block
invoke function as argument.

On the other hand, the size and alignment of the block struct is
not stored in the struct, which causes difficulty to implement
__enqueue_kernel as library function, since the library function
needs to know the size and alignment of the argument which needs
to be passed to the kernel.

This patch removes the useless fields from the block struct and adds
size and align fields. The equivalent block struct will become

struct Block {
  int size;
  int align;
  generic void *invoke;
 /* custom fields */
};
It also changes the pointer to the invoke function to be
a generic pointer since the address space of a function
may not be private on certain targets.

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

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

3 years ago[Hexagon] Move getHexagonTargetFeatures to Hexagon.cpp (NFC)
Sumanth Gundapaneni [Wed, 4 Oct 2017 19:09:29 +0000 (19:09 +0000)]
[Hexagon] Move getHexagonTargetFeatures to Hexagon.cpp (NFC)

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

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

3 years ago[analyzer] Fix autodetection of binding types.
Artem Dergachev [Wed, 4 Oct 2017 15:59:40 +0000 (15:59 +0000)]
[analyzer] Fix autodetection of binding types.

In ProgramState::getSVal(Location, Type) API which dereferences a pointer value,
when the optional Type parameter is not supplied and the Location is not typed,
type should have been guessed on a best-effort basis by inspecting the Location
more deeply. However, this never worked; the auto-detected type was instead
a pointer type to the correct type.

Fixed the issue and added various test cases to demonstrate which parts of the
analyzer were affected (uninitialized pointer argument checker, C++ trivial copy
modeling, Google test API modeling checker).

Additionally, autodetected void types are automatically replaced with char,
in order to simplify checker APIs. Which means that if the location is a void
pointer, getSVal() would read the first byte through this pointer
and return its symbolic value.

Fixes pr34305.

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

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

3 years ago[OpenMP] Initial implementation of teams distribute code generation
Carlo Bertolli [Wed, 4 Oct 2017 14:12:09 +0000 (14:12 +0000)]
[OpenMP] Initial implementation of teams distribute code generation

https://reviews.llvm.org/D38371

This patch implements codegen for the combined 'teams distribute" OpenMP pragma and adds regression tests for all its clauses.

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

3 years ago[test] Pass in fixed triple for openmp-offload.c
Jonas Hahnfeld [Wed, 4 Oct 2017 13:54:09 +0000 (13:54 +0000)]
[test] Pass in fixed triple for openmp-offload.c

This should fix the test on other architectures.

Related to: https://reviews.llvm.org/D38372

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

3 years ago[OpenMP] Fix passing of -m arguments correctly
Jonas Hahnfeld [Wed, 4 Oct 2017 13:32:59 +0000 (13:32 +0000)]
[OpenMP] Fix passing of -m arguments correctly

The recent fix in D38258 was wrong: getAuxTriple() only returns
non-null values for the CUDA toolchain. That is why the now added
test for PPC and X86 failed.

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

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

3 years agoFix assertion failure in thread safety analysis (PR34800).
Alexander Kornienko [Wed, 4 Oct 2017 10:24:36 +0000 (10:24 +0000)]
Fix assertion failure in thread safety analysis (PR34800).

Summary:
Fix an assertion failure (http://llvm.org/PR34800) and clean up unused code relevant to the fixed logic.

A bit of context: when `SExprBuilder::translateMemberExpr` is called on a member expression that involves a conversion operator, for example, `til::Project` constructor can't just call `getName()` on it, since the name is not a simple identifier. In order to handle this case I've introduced an optional string to print the member name to. I discovered that the other two `til::Project` constructors are not used, so it was better to delete them instead of ensuring they work correctly with the new logic.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

3 years agoMove verbosity check for opt remarks to the diag handler.
Adam Nemet [Wed, 4 Oct 2017 04:25:31 +0000 (04:25 +0000)]
Move verbosity check for opt remarks to the diag handler.

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

3 years agoWe allow implicit function declarations as an extension in all C dialects. Remove...
Richard Smith [Wed, 4 Oct 2017 01:58:22 +0000 (01:58 +0000)]
We allow implicit function declarations as an extension in all C dialects. Remove OpenCL special case.

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

3 years agoPR34822: Fix a collection of related bugs with our handling of C89 implicit function...
Richard Smith [Wed, 4 Oct 2017 01:49:22 +0000 (01:49 +0000)]
PR34822: Fix a collection of related bugs with our handling of C89 implicit function declarations.

We were injecting the function into the wrong semantic context, resulting in it
failing to be registered as a global for redeclaration lookup. As a
consequence, we accepted invalid code since r310616.

Fixing that resulted in the "out-of-scope declaration" diagnostic firing a lot
more often. It turned out that warning codepath was non-conforming, because it
did not cause us to inject the implicitly-declared function into the enclosing
block scope. We now only warn if the type of the out-of-scope declaration
doesn't match the type of an implicitly-declared function; in all other cases,
we produce the normal warning for an implicitly-declared function.

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

3 years ago[ExprConstant] Allow constexpr ctor to modify non static data members
Erik Pilkington [Wed, 4 Oct 2017 00:18:55 +0000 (00:18 +0000)]
[ExprConstant] Allow constexpr ctor to modify non static data members

Fixes PR19741.

Differential revision: https://reviews.llvm.org/D38483

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

3 years ago[Analyzer] Re-apply r314820 with a fix for StringRef lifetime.
George Karpenkov [Tue, 3 Oct 2017 23:15:35 +0000 (23:15 +0000)]
[Analyzer] Re-apply r314820 with a fix for StringRef lifetime.

Fixes the test failure: temporary is now bound to std::string, tests
fully pass on Linux.

This reverts commit b36ee0924038e1d95ea74230c62d46e05f80587e.

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

3 years ago[CMake] Minor updates to Apple CMake caches
Chris Bieneman [Tue, 3 Oct 2017 21:59:53 +0000 (21:59 +0000)]
[CMake] Minor updates to Apple CMake caches

* Turn off embedded compiler-rt builds in stage1
* Support generating Xcode toolchains from Stage2 build configurations

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

3 years agoSuppress -Wmissing-braces warning when aggregate-initializing a struct with a single...
Richard Smith [Tue, 3 Oct 2017 20:36:00 +0000 (20:36 +0000)]
Suppress -Wmissing-braces warning when aggregate-initializing a struct with a single field that is itself an aggregate.

In C++, such initialization of std::array<T, N> types is guaranteed to work by
the standard, is completely idiomatic, and the "suggested" alternative from
Clang was technically invalid.

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

3 years ago[OPENMP] Allow use of declare target directive inside struct
Alexey Bataev [Tue, 3 Oct 2017 20:00:00 +0000 (20:00 +0000)]
[OPENMP] Allow use of declare target directive inside struct
declaration.

Patch allows using of the `#pragma omp declare target`| `#pragma omp end
declare target` directives inside the structures if we need to mark as
declare target only some static members.

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

3 years agoRevert r314820 "[Analyzer] More granular special casing in RetainCountChecker"
Tim Shen [Tue, 3 Oct 2017 19:39:02 +0000 (19:39 +0000)]
Revert r314820 "[Analyzer] More granular special casing in RetainCountChecker"

The test retain-release.m fails with this patch.

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

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

3 years ago[Analyzer] More granular special casing in RetainCountChecker
George Karpenkov [Tue, 3 Oct 2017 18:12:15 +0000 (18:12 +0000)]
[Analyzer] More granular special casing in RetainCountChecker

Only assume that IOBSDNameMatching and friends increment a reference counter
if their return type is a CFMutableDictionaryRef.

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

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

3 years ago[OpenCL] Fix checking of vector type casting
Yaxun Liu [Tue, 3 Oct 2017 14:34:29 +0000 (14:34 +0000)]
[OpenCL] Fix checking of vector type casting

Currently clang allows the following code

int a;
int b = (const int) a;
However it does not the following code

int4 a;
int4 b = (const int4) a;
This is because Clang compares the qualified types instead of unqualified types for vector type casting, which causes the inconsistency.

This patch fixes that.

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

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

3 years ago[CodeGen] Fix propagation of TBAA info for atomic accesses
Ivan A. Kosarev [Tue, 3 Oct 2017 11:31:42 +0000 (11:31 +0000)]
[CodeGen] Fix propagation of TBAA info for atomic accesses

This patch fixes clang to propagate complete TBAA information for
atomic accesses and not just the final access types. Prepared
against D38456 and requires it to be committed first.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

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

3 years ago[CodeGen] Introduce generic TBAA access descriptors
Ivan A. Kosarev [Tue, 3 Oct 2017 10:52:39 +0000 (10:52 +0000)]
[CodeGen] Introduce generic TBAA access descriptors

With this patch we implement a concept of TBAA access descriptors
that are capable of representing both scalar and struct-path
accesses in a generic way.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

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

3 years agoR34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.
Richard Smith [Tue, 3 Oct 2017 01:58:15 +0000 (01:58 +0000)]
R34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.

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

3 years agoAdd parens around the boolean condition of one of the added asserts in r314747 ...
Faisal Vali [Tue, 3 Oct 2017 01:33:36 +0000 (01:33 +0000)]
Add parens around the boolean condition of one of the added asserts in r314747 ...
  ... in the hopes of teaching the bots the gift of silence ;)

For quick reference: https://reviews.llvm.org/rL314747

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

3 years ago[ubsan] Skip alignment checks which are folded away
Vedant Kumar [Tue, 3 Oct 2017 01:27:26 +0000 (01:27 +0000)]
[ubsan] Skip alignment checks which are folded away

Don't emit alignment checks which the IR constant folder throws away.

I've tested this out on X86FastISel.cpp. While this doesn't decrease
end-to-end compile-time significantly, it results in 122 fewer type
checks (1% reduction) overall, without adding any real complexity.

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

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

3 years ago[ubsan] Save the result of getLLVMContext. NFC.
Vedant Kumar [Tue, 3 Oct 2017 01:27:26 +0000 (01:27 +0000)]
[ubsan] Save the result of getLLVMContext. NFC.

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

3 years ago[ubsan] Add helpers to decide when null/vptr checks are required. NFC.
Vedant Kumar [Tue, 3 Oct 2017 01:27:25 +0000 (01:27 +0000)]
[ubsan] Add helpers to decide when null/vptr checks are required. NFC.

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

3 years ago[ubsan] Save a ptrtoint when emitting alignment checks
Vedant Kumar [Tue, 3 Oct 2017 01:27:24 +0000 (01:27 +0000)]
[ubsan] Save a ptrtoint when emitting alignment checks

The alignment check emits a ptrtoint instruction which can be reused in
the call to the diagnostic handler.

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

3 years agoRemove an assertion I added from the refactoring of pasteTokens (https://reviews...
Faisal Vali [Tue, 3 Oct 2017 01:20:40 +0000 (01:20 +0000)]
Remove an assertion I added from the refactoring of pasteTokens (https://reviews.llvm.org/rL314747).
  - it made the bots v angry!

I'm not exactly sure why the assertion doesn't hold - if anyone has any insight - would appreciate it.

Thanks!

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

3 years ago[NFC] Refactor PasteTokens so that it can be passed the Token Stream and Index to...
Faisal Vali [Tue, 3 Oct 2017 00:52:14 +0000 (00:52 +0000)]
[NFC] Refactor PasteTokens so that it can be passed the Token Stream and Index to start concatenating at.
  In passing:
    - change the name of the function to pasteTokens c/w coding standards
    - rename CurToken to CurTokenIdx (since it is not the token, but the index)
    - add doxygen comments to document some of pasteTokens' functionality
    - use parameter names different from the data member names.

This will be useful for implementing __VA_OPT__ (https://reviews.llvm.org/D35782#inline-322587)

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

3 years ago[clang-cl] Claim ignored /O[12xd] arguments
Reid Kleckner [Tue, 3 Oct 2017 00:14:03 +0000 (00:14 +0000)]
[clang-cl] Claim ignored /O[12xd] arguments

Fixes PR34809

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

3 years agoPR33839: Fix -Wunused handling for structured binding declarations.
Richard Smith [Mon, 2 Oct 2017 22:43:36 +0000 (22:43 +0000)]
PR33839: Fix -Wunused handling for structured binding declarations.

We warn about a structured binding declaration being unused only if none of its
bindings are used.

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

3 years ago[Analyzer] Avoid copy and modifying passed reference in BodyFarm::create_call_once
George Karpenkov [Mon, 2 Oct 2017 21:01:46 +0000 (21:01 +0000)]
[Analyzer] Avoid copy and modifying passed reference in BodyFarm::create_call_once

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

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

3 years agoAdd std::move in RefactoringActionRulesTest.cpp
Alex Lorenz [Mon, 2 Oct 2017 19:02:42 +0000 (19:02 +0000)]
Add std::move in RefactoringActionRulesTest.cpp

Should fix http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental

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

3 years agoAdd support for Myriad ma2x8x series of CPUs
Walter Lee [Mon, 2 Oct 2017 18:50:57 +0000 (18:50 +0000)]
Add support for Myriad ma2x8x series of CPUs

Summary:
Also:
- Add support for some older Myriad CPUs that were missing.
- Fix some incorrect compiler defines for exisitng CPUs.

Reviewers: jyknight

Subscribers: fedor.sergeev

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

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

3 years ago[refactor] Simplify the refactoring interface
Alex Lorenz [Mon, 2 Oct 2017 18:42:43 +0000 (18:42 +0000)]
[refactor] Simplify the refactoring interface

This commit simplifies the interface for the refactoring action rules and the
refactoring requirements. It merges the selection constraints and the selection
requirements into one class. The refactoring actions rules must now be
implemented using subclassing instead of raw function / lambda pointers. This
change also removes a bunch of template-based traits and other
template definitions that are now redundant.

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

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

3 years agoAdd a testcase to check that debug info is upgraded when compiling LLVM IR
Adrian Prantl [Mon, 2 Oct 2017 18:31:52 +0000 (18:31 +0000)]
Add a testcase to check that debug info is upgraded when compiling LLVM IR
through clang.

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

3 years agoRevert "Add /System/Library/PrivateFrameworks as a header search path."
Douglas Gregor [Mon, 2 Oct 2017 18:22:19 +0000 (18:22 +0000)]
Revert "Add /System/Library/PrivateFrameworks as a header search path."

This reverts commit f7a95215a435aa8d5f64f43a8bb23ba077270755.

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

3 years ago[Analyzer] Make testing scripts flake8 compliant
George Karpenkov [Mon, 2 Oct 2017 17:59:12 +0000 (17:59 +0000)]
[Analyzer] Make testing scripts flake8 compliant

Differential Review: https://reviews.llvm.org/D38213

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

3 years ago[CUDA] Fix name of __activemask()
Jonas Hahnfeld [Mon, 2 Oct 2017 17:50:11 +0000 (17:50 +0000)]
[CUDA] Fix name of __activemask()

The name has two underscores in the official CUDA documentation:
http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#warp-vote-functions

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

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

3 years agoRevert "[Sema] Warn on attribute nothrow conflicting with language specifiers"
Reid Kleckner [Mon, 2 Oct 2017 17:16:14 +0000 (17:16 +0000)]
Revert "[Sema] Warn on attribute nothrow conflicting with language specifiers"

This reverts r314461.

It is warning on user code that uses END_COM_MAP(), which expands to
declare QueryInterface with conflicting exception specifers. I've spent
a while trying to understand why, but haven't been able to extract a
reduced test case. Let's revert and I'll keep trying.

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

3 years agoUpdate IUnknown lit test to pass on Win32
Erich Keane [Mon, 2 Oct 2017 16:49:32 +0000 (16:49 +0000)]
Update IUnknown lit test to pass on Win32

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

3 years ago[OPENMP] Capture argument of `device` clause for target-based
Alexey Bataev [Mon, 2 Oct 2017 16:32:39 +0000 (16:32 +0000)]
[OPENMP] Capture argument of `device` clause for target-based
directives.

The argument of the `device` clause in target-based executable
directives must be captured to support codegen for the `target`
directives with the `depend` clauses.

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

3 years ago[clang-format] Fix regression about short functions after #else
Krasimir Georgiev [Mon, 2 Oct 2017 15:53:37 +0000 (15:53 +0000)]
[clang-format] Fix regression about short functions after #else

Summary:
This patch fixes a regression introduced in r312904, where the formatter confuses
the `else` in `#else` with an `else` of an `if-else` statement.
For example, formatting this code with google style
```
#ifdef A
int f() {}
#else
int f() {}
#endif
```
resulted in
```
#ifdef A
int f() {}
#else
int f() {
}
#endif
```

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

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

3 years ago[OPENMP] Fix test, NFC.
Alexey Bataev [Mon, 2 Oct 2017 14:35:31 +0000 (14:35 +0000)]
[OPENMP] Fix test, NFC.

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

3 years ago[OPENMP] Simplify codegen for non-offloading code.
Alexey Bataev [Mon, 2 Oct 2017 14:20:58 +0000 (14:20 +0000)]
[OPENMP] Simplify codegen for non-offloading code.

Simplified and generalized codegen for non-offloading part that works if
offloading is failed or condition of the `if` clause is `false`.

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

3 years agoDependent Address Space Support Test Fix
Andrew Gozillon [Mon, 2 Oct 2017 13:32:59 +0000 (13:32 +0000)]
Dependent Address Space Support Test Fix

Modifying a non-type template integer arguement that is causing errors
in some builds as it's too large for 32-bit longs. This hopefully (and
seems to when testing) should fix all of the build bot errors relating
to this test. I also modified the name of the function call to be more
apt.

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

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

3 years ago[CodeGen] Have a special function to get TBAA info for may-alias accesses
Ivan A. Kosarev [Mon, 2 Oct 2017 11:10:04 +0000 (11:10 +0000)]
[CodeGen] Have a special function to get TBAA info for may-alias accesses

This is part of D37826 reworked to be a separate patch to
simplify review.

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

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

3 years ago[CodeGen] Do not refer to complete TBAA info where we actually deal with just TBAA...
Ivan A. Kosarev [Mon, 2 Oct 2017 09:54:47 +0000 (09:54 +0000)]
[CodeGen] Do not refer to complete TBAA info where we actually deal with just TBAA access types

This patch fixes misleading names of entities related to getting,
setting and generation of TBAA access type descriptors.

This is effectively an attempt to provide a review for D37826 by
breaking it into smaller pieces.

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

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

3 years agoDependent Address Space Support Test File
Andrew Gozillon [Mon, 2 Oct 2017 06:31:25 +0000 (06:31 +0000)]
Dependent Address Space Support Test File

Adding regression test for Dependent Address Spaces in relation to
https://reviews.llvm.org/D33666 I forgot to svn add the test file
before commiting the prior changes. I appologies.

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

3 years agoDependent Address Space Support
Andrew Gozillon [Mon, 2 Oct 2017 06:25:51 +0000 (06:25 +0000)]
Dependent Address Space Support

This patch relates to: https://reviews.llvm.org/D33666 This adds support
for template parameters to be passed to the address_space attribute.
The main goal is to add further flexibility to the attribute and allow
for it to be used easily with templates.

The main additions are a new type (DependentAddressSpaceType) alongside
its TypeLoc and its mangling. As well as the logic required to support
dependent address spaces which mainly resides in TreeTransform.h and
SemaType.cpp.

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

3 years agoTest Commit.
Andrew Gozillon [Sun, 1 Oct 2017 12:16:24 +0000 (12:16 +0000)]
Test Commit.

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

3 years ago[Analysis] Remove unused makeLvalueToRValue variant.
Davide Italiano [Sat, 30 Sep 2017 21:49:15 +0000 (21:49 +0000)]
[Analysis] Remove unused makeLvalueToRValue variant.

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

3 years ago[NFC] Add assertion that we assume a valid macro argument index.
Faisal Vali [Sat, 30 Sep 2017 19:34:27 +0000 (19:34 +0000)]
[NFC] Add assertion that we assume a valid macro argument index.

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

3 years ago[NFC] Remove superfluous parameter
Faisal Vali [Sat, 30 Sep 2017 13:58:38 +0000 (13:58 +0000)]
[NFC] Remove superfluous parameter
 - MacroArgs already knows the maximum number of arguments that can be supplied to the macro.  No need to pass MacroInfo (information about the macro definition) to the call to getPreExpArgument (which by the way might benefit from being called getExpandedArgument() ?) for it to compute the number of arguments.

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

3 years agoclang/test/SemaCXX/ms-iunknown-template-function.cpp: Appease for targeting *-win32.
NAKAMURA Takumi [Sat, 30 Sep 2017 09:16:41 +0000 (09:16 +0000)]
clang/test/SemaCXX/ms-iunknown-template-function.cpp: Appease for targeting *-win32.

This expects the warning;

  File clang/test/SemaCXX/ms-iunknown-template-function.cpp Line 19: __declspec attribute 'novtable' is not supported

But for targeting *-win32, the warning is not seen.

  error: 'warning' diagnostics expected but not seen:
    File clang\test\SemaCXX\ms-iunknown-template-function.cpp Line 19 (directive at clang\test\SemaCXX\ms-iunknown-template-function.cpp:18): __declspec attribute 'novtable'

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

3 years ago[ODRHash] Add base classes to hashing CXXRecordDecl.
Richard Trieu [Sat, 30 Sep 2017 02:19:17 +0000 (02:19 +0000)]
[ODRHash] Add base classes to hashing CXXRecordDecl.

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

3 years ago[Analyzer] Add dummy implementation to call_once to avoid linkage warnings in tests.
George Karpenkov [Sat, 30 Sep 2017 01:15:35 +0000 (01:15 +0000)]
[Analyzer] Add dummy implementation to call_once to avoid linkage warnings in tests.

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

3 years ago[Analyzer] Document a gotcha: for C++ -analyze-function requires parameters in functi...
George Karpenkov [Sat, 30 Sep 2017 00:07:22 +0000 (00:07 +0000)]
[Analyzer] Document a gotcha: for C++ -analyze-function requires parameters in function name

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

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

3 years ago[Analyzer] Add nullability to the list of tested checkers in SATestBuild
George Karpenkov [Sat, 30 Sep 2017 00:05:24 +0000 (00:05 +0000)]
[Analyzer] Add nullability to the list of tested checkers in SATestBuild

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

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

3 years ago[Analyzer] Synthesize function body for std::call_once
George Karpenkov [Sat, 30 Sep 2017 00:03:22 +0000 (00:03 +0000)]
[Analyzer] Synthesize function body for std::call_once

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

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

3 years agoAdd a "vexing parse" warning for ambiguity between a variable declaration and a
Richard Smith [Fri, 29 Sep 2017 23:57:25 +0000 (23:57 +0000)]
Add a "vexing parse" warning for ambiguity between a variable declaration and a
function-style cast.

This fires for cases such as

  T(x);

... where 'x' was previously declared and T is a type. This construct declares
a variable named 'x' rather than the (probably expected) interpretation of a
function-style cast of 'x' to T.

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

3 years ago[PS4] Tidy up some debug-tuning v. triple decision-making.
Paul Robinson [Fri, 29 Sep 2017 21:25:07 +0000 (21:25 +0000)]
[PS4] Tidy up some debug-tuning v. triple decision-making.

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

3 years ago[Sema] Correct IUnknown to support Unknwnbase.h Header.
Erich Keane [Fri, 29 Sep 2017 21:06:00 +0000 (21:06 +0000)]
[Sema] Correct IUnknown to support Unknwnbase.h Header.

Apparently, the MSVC SDK has a strange implementation that
causes a number of implicit functions as well as a template member
function of the IUnknown type. This patch allows these as InterfaceLike
types as well.

Additionally, it corrects the behavior where extern-C++ wrapped around an
Interface-Like type would permit an interface-like type to exist in a namespace.

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

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

3 years agofixup, post rL314493
Coby Tayree [Fri, 29 Sep 2017 16:04:16 +0000 (16:04 +0000)]
fixup, post rL314493
'InlineAsmIdentifierInfo' is now a struct - notify Sema.h it isn't a class anymore

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

3 years ago[test] Disable leak checking on a clang crash test on Darwin
Francis Ricci [Fri, 29 Sep 2017 15:46:27 +0000 (15:46 +0000)]
[test] Disable leak checking on a clang crash test on Darwin

Suspected failure due to LSan's atexit and exit interception behavior.

Reviewers: kcc, kubamracek, bogner, hfinkel, alekseyshl, Hahnfeld, gtbercea

Subscribers: llvm-commits

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

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

3 years agoFix Modules/{builtin-import.mm,umbrella-header-include-builtin.mm} to be able to...
Filipe Cabecinhas [Fri, 29 Sep 2017 15:45:34 +0000 (15:45 +0000)]
Fix Modules/{builtin-import.mm,umbrella-header-include-builtin.mm} to be able to handle non-Darwin targets

Summary: Also makes them pass on Darwin, if the default target triple is a Linux triple.

Reviewers: bruno, rsmith

Subscribers: cfe-commits

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

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

3 years ago[docs][refactor] Add refactoring engine design documentation
Alex Lorenz [Fri, 29 Sep 2017 12:21:38 +0000 (12:21 +0000)]
[docs][refactor] Add refactoring engine design documentation

This commit adds a refactoring engine design document that talks about the
design and provides several example of how the engine can be used.

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

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

3 years ago[Sema] Suppress warnings for C's zero initializer
Daniel Marjamaki [Fri, 29 Sep 2017 09:44:41 +0000 (09:44 +0000)]
[Sema] Suppress warnings for C's zero initializer

Patch by S. Gilles!

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

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

3 years ago[X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediat...
Coby Tayree [Fri, 29 Sep 2017 07:02:49 +0000 (07:02 +0000)]
[X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediate expressions

Allow the proper recognition of Enum values and global variables inside ms inline-asm memory / immediate expressions, as they require some additional overhead and treated incorrect if doesn't early recognized.
supersedes D33278, D35774

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

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

3 years ago[NFC] Replace 'arguments' with 'parameters' in comments relating to lexing a macro...
Faisal Vali [Fri, 29 Sep 2017 02:43:22 +0000 (02:43 +0000)]
[NFC] Replace 'arguments' with 'parameters' in comments relating to lexing a macro definition.

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

3 years ago[NFC] Rename variable 'Arguments' to 'Parameters' when lexing the Macro Definition.
Faisal Vali [Fri, 29 Sep 2017 02:17:31 +0000 (02:17 +0000)]
[NFC] Rename variable 'Arguments' to 'Parameters' when lexing the Macro Definition.

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

3 years ago[Sema] Put nullability fix-it after the end of the pointer.
Volodymyr Sapsai [Thu, 28 Sep 2017 23:18:49 +0000 (23:18 +0000)]
[Sema] Put nullability fix-it after the end of the pointer.

Fixes nullability fix-it for `id<SomeProtocol>`. With this change
nullability specifier is inserted after ">" instead of between
"id" and "<".

rdar://problem/34260995

Reviewers: jordan_rose, doug.gregor, ahatanak, arphaman

Reviewed By: jordan_rose

Subscribers: cfe-commits

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

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

3 years ago[clang] Add getUnsignedPointerDiffType method
Alexander Shaposhnikov [Thu, 28 Sep 2017 23:11:31 +0000 (23:11 +0000)]
[clang] Add getUnsignedPointerDiffType method

C11 standard refers to the unsigned counterpart of the type ptrdiff_t
in the paragraph 7.21.6.1p7 where it defines the format specifier %tu.
In Clang (in PrintfFormatString.cpp, lines 508-510) there is a FIXME for this case,
in particular, Clang didn't diagnose %tu issues at all, i.e.
it didn't emit any warnings on the code printf("%tu", 3.14).
In this diff we add a method getUnsignedPointerDiffType for getting the corresponding type
similarly to how it's already done in the other analogous cases (size_t, ssize_t, ptrdiff_t etc)
and fix -Wformat diagnostics for %tu plus the emitted fix-it as well.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D38270

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

3 years agoProperly parse a postfix expression following a Boolean literal. Fixes PR34273.
Aaron Ballman [Thu, 28 Sep 2017 21:29:18 +0000 (21:29 +0000)]
Properly parse a postfix expression following a Boolean literal. Fixes PR34273.

Patch by Nicolas Lesser.

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

3 years ago[Sema] Correct nothrow inherited by noexcept
Erich Keane [Thu, 28 Sep 2017 20:47:10 +0000 (20:47 +0000)]
[Sema] Correct nothrow inherited by noexcept

As reported in https://bugs.llvm.org/show_bug.cgi?id=33235,
a noexcept function was unable to inherit from a nothrow defaulted
constructor. Attribute "nothrow" is supposed to be semantically
identical to noexcept, and in fact, a number of other places in the
code treat them identically.

This patch simply checks the RecordDecl for the correct attribute in
the case where no other exception specifier was set.

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

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

3 years ago[Sema] Warn on attribute nothrow conflicting with language specifiers
Erich Keane [Thu, 28 Sep 2017 20:36:53 +0000 (20:36 +0000)]
[Sema] Warn on attribute nothrow conflicting with language specifiers

I discovered it was possible to create a 'nothrow' noexcept(false)
function, which is both non-sensical as well as seemingly breaking.

This patch warns if attribute nothrow is used with anything besides "noexcept".

"noexcept(true)" isn't possible, because the noexcept decl isn't parsed until
later.

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

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

3 years agoFix test change missed in r314456
Erich Keane [Thu, 28 Sep 2017 20:23:43 +0000 (20:23 +0000)]
Fix test change missed in r314456

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

3 years agoAdd Documentation to attribute-nothrow. Additionally, limit to functions.
Erich Keane [Thu, 28 Sep 2017 20:08:03 +0000 (20:08 +0000)]
Add Documentation to attribute-nothrow. Additionally, limit to functions.

Attribute nothrow is only allowed on functions, so I added that. Additionally,
it lacks any documentation, so I added some.

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

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

3 years ago[AMDGPU] Allow flexible register names in inline asm constraints
Yaxun Liu [Thu, 28 Sep 2017 19:07:59 +0000 (19:07 +0000)]
[AMDGPU] Allow flexible register names in inline asm constraints

Currently AMDGPU inline asm only allow v and s as register names in constraints.

This patch allows the following register names in constraints: (n, m is unsigned integer, n < m)

v

s

{vn} or {v[n]}

{sn} or {s[n]}

{S} , where S is a special register name

{v[n:m]}

{s[n:m]}

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

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

3 years ago[DWARF] Allow forward declarations of a class template instantiation
Paul Robinson [Thu, 28 Sep 2017 18:37:02 +0000 (18:37 +0000)]
[DWARF] Allow forward declarations of a class template instantiation
to have child entries describing the template parameters.  This will
be on by default for SCE tuning.

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

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

3 years agoConsolidate std::move() detection code. No behavior change.
Nico Weber [Thu, 28 Sep 2017 16:16:39 +0000 (16:16 +0000)]
Consolidate std::move() detection code. No behavior change.

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

3 years agoFix -Wcast-qual warning after r314336.
Nico Weber [Thu, 28 Sep 2017 15:44:46 +0000 (15:44 +0000)]
Fix -Wcast-qual warning after r314336.

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

3 years agoUse std::is_trivial instead of is_trivially_copyable.
Benjamin Kramer [Thu, 28 Sep 2017 08:50:30 +0000 (08:50 +0000)]
Use std::is_trivial instead of is_trivially_copyable.

The oldest versions of GCC we support (before 5) didn't support that
trait. is_trivial is stronger superset that clang::Token fulfills, so
just use that instead.

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

3 years agoAdd the new -Wnull-pointer-arithmetic warnings to the release notes
Sylvestre Ledru [Thu, 28 Sep 2017 08:00:18 +0000 (08:00 +0000)]
Add the new -Wnull-pointer-arithmetic warnings to the release notes

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

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

3 years ago[NFC] Don't use C++17 standard lib variable template helper traits, instead use ...
Faisal Vali [Thu, 28 Sep 2017 02:00:40 +0000 (02:00 +0000)]
[NFC] Don't use C++17 standard lib variable template helper traits, instead use ::value.

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

3 years ago[NFC] Modernize MacroArgs using TrailingObjects
Faisal Vali [Thu, 28 Sep 2017 01:50:23 +0000 (01:50 +0000)]
[NFC] Modernize MacroArgs using TrailingObjects

Refactor MacroArgs to use TrailingObjects when creating a variably sized object on the heap to store the unexpanded tokens immediately after the MacroArgs object.

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

3 years agoLook through parentheses.
Akira Hatanaka [Thu, 28 Sep 2017 01:31:17 +0000 (01:31 +0000)]
Look through parentheses.

This fixes a bug where clang would emit instructions to reclaim a value
that's going to be __bridge-casted to CF.

rdar://problem/34687542

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

3 years ago[Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.
Davide Italiano [Thu, 28 Sep 2017 00:24:20 +0000 (00:24 +0000)]
[Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.

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

3 years ago[Preprocessor] Preserve #pragma clang assume_nonnull in preprocessed output
Eli Friedman [Wed, 27 Sep 2017 23:29:37 +0000 (23:29 +0000)]
[Preprocessor] Preserve #pragma clang assume_nonnull in preprocessed output

Patch by Zbigniew Sarbinowski!

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

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

3 years ago[AVR] Update data layout to match current LLVM trunk
Dylan McKay [Wed, 27 Sep 2017 22:09:01 +0000 (22:09 +0000)]
[AVR] Update data layout to match current LLVM trunk

The data layout was changed in r314179 to fix atomic loads and stores.

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

3 years agoAdd support for remembering origins to ExternalASTMerger
Sean Callanan [Wed, 27 Sep 2017 19:57:58 +0000 (19:57 +0000)]
Add support for remembering origins to ExternalASTMerger

ExternalASTMerger has hitherto relied on being able to look up
any Decl through its named DeclContext chain. This works for
many cases, but causes problems for function-local structs,
which cannot be looked up in their containing FunctionDecl. An
example case is

void f() {
  { struct S { int a; }; }
  { struct S { bool b; }; }
}

It is not possible to lookup either of the two Ses individually
(or even to provide enough information to disambiguate) after
parsing is over; and there is typically no need to, since they
are invisible to the outside world.

However, ExternalASTMerger needs to be able to complete either
S on demand. This led to an XFAIL on test/Import/local-struct,
which this patch removes. The way the patch works is:

It defines a new data structure, ExternalASTMerger::OriginMap,
which clients are expected to maintain (default-constructing
if the origin does not have an ExternalASTMerger servicing it)
As DeclContexts are imported, if they cannot be looked up by
name they are placed in the OriginMap. This allows
ExternalASTMerger to complete them later if necessary.
As DeclContexts are imported from an origin that already has
its own OriginMap, the origins are forwarded – but only for
those DeclContexts that are actually used. This keeps the
amount of stored data minimal.

The patch also applies several improvements from review:

- Thoroughly documents the interface to ExternalASTMerger;
- Adds optional logging to help track what's going on; and
- Cleans up a bunch of braces and dangling elses.

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

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