]> granicus.if.org Git - clang/log
clang
7 years ago[ubsan] Pass a set of checks to skip to EmitTypeCheck() (NFC)
Vedant Kumar [Fri, 17 Feb 2017 23:22:55 +0000 (23:22 +0000)]
[ubsan] Pass a set of checks to skip to EmitTypeCheck() (NFC)

CodeGenFunction::EmitTypeCheck accepts a bool flag which controls
whether or not null checks are emitted. Make this a bit more flexible by
changing the bool to a SanitizerSet.

Needed for an upcoming change which deals with a scenario in which we
only want to emit null checks.

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

7 years ago[OpenMP] Prepare Sema for initial implementation for pragma 'distribute parallel...
Carlo Bertolli [Fri, 17 Feb 2017 21:29:13 +0000 (21:29 +0000)]
[OpenMP] Prepare Sema for initial implementation for pragma 'distribute parallel for'

https://reviews.llvm.org/D29922

This patch adds two fields for use in the implementation of 'distribute parallel for':

The increment expression for the distribute loop. As the chunk assigned to a team is executed by multiple threads within the 'parallel for' region, the increment expression has to correspond to the value returned by the related runtime call (for_static_init).
The upper bound of the innermost loop ('for' in 'distribute parallel for') is not the globalUB expression normally used for pragma 'for' when found in isolation. It is instead the upper bound of the chunk assigned to the team ('distribute' loop). In this way, we prevent teams from executing chunks assigned to other teams.
The use of these two fields can be see in a related explanatory patch:
https://reviews.llvm.org/D29508

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

7 years agoRevert "Retry: [ubsan] Reduce null checking of C++ object pointers (PR27581)"
Vedant Kumar [Fri, 17 Feb 2017 20:59:40 +0000 (20:59 +0000)]
Revert "Retry: [ubsan] Reduce null checking of C++ object pointers (PR27581)"

This reverts commit r295401. It breaks the ubsan self-host. It inserts
object size checks once per C++ method which fire when the structure is
empty.

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

7 years agoAdd an explicit derived class of FunctionDecl to model deduction guides rather
Richard Smith [Fri, 17 Feb 2017 20:05:37 +0000 (20:05 +0000)]
Add an explicit derived class of FunctionDecl to model deduction guides rather
than just treating them as FunctionDecls with a funny name.

No functionality change intended.

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

7 years ago[Test] Make Lit tests C++11 compatible - misc
Charles Li [Fri, 17 Feb 2017 19:36:19 +0000 (19:36 +0000)]
[Test] Make Lit tests C++11 compatible - misc

Updated 5 tests.

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

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

7 years ago[CMake] Add Fuchsia toolchain CMake cache files
Petr Hosek [Fri, 17 Feb 2017 19:28:54 +0000 (19:28 +0000)]
[CMake] Add Fuchsia toolchain CMake cache files

These cache files can be used to build Fuchsia toolchain. They also
demonstrate the use of multi-target builtins build.

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

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

7 years ago[OpenMP] Fix cancellation point in task with no cancel
Jonas Hahnfeld [Fri, 17 Feb 2017 18:32:58 +0000 (18:32 +0000)]
[OpenMP] Fix cancellation point in task with no cancel

With tasks, the cancel may happen in another task. This has a different
region info which means that we can't find it here.

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

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

7 years ago[OpenMP] Remove barriers at cancel and cancellation point
Jonas Hahnfeld [Fri, 17 Feb 2017 18:32:51 +0000 (18:32 +0000)]
[OpenMP] Remove barriers at cancel and cancellation point

This resolves a deadlock with the cancel directive when there is no explicit
cancellation point. In that case, the implicit barrier acts as cancellation
point. After removing the barrier after cancel, the now unmatched barrier for
the explicit cancellation point has to go as well.

This has probably worked before rL255992: With the calls for the explicit
barrier, it was sure that all threads passed a barrier before exiting.

Reported by Simon Convent and Joachim Protze!

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

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

7 years agoRename DiagnosticInfoWithDebugLoc to WithLocation to match LLVM
Justin Bogner [Fri, 17 Feb 2017 17:34:49 +0000 (17:34 +0000)]
Rename DiagnosticInfoWithDebugLoc to WithLocation to match LLVM

Updates for llvm r295465.

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

7 years agoclang-format: Don't remove existing spaces between identifier and ::.
Daniel Jasper [Fri, 17 Feb 2017 10:44:07 +0000 (10:44 +0000)]
clang-format: Don't remove existing spaces between identifier and ::.

This can lead to bad behavior with macros that are used to annotate
functions (e.g. ALWAYS_INLINE).

Before, this:
  ALWAYS_INLINE ::std::string getName() ...

was turned into:
  ALWAYS_INLINE::std::string getName() ...

If it turns out that clang-format is failing to clean up a lot of the
existing spaces now, we can add more analyses of the identifier. It
should not currently. Cases where clang-format breaks nested name
specifiers should be fine as clang-format wraps after the "::". Thus, a
line getting longer and then shorter again should lead to the same
original code.

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

7 years agoUpdate Bugzilla URLs in docs
Ismail Donmez [Fri, 17 Feb 2017 08:26:54 +0000 (08:26 +0000)]
Update Bugzilla URLs in docs

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

7 years agoRevert r295421, new ODR checker for modules, to fix build bot.
Richard Trieu [Fri, 17 Feb 2017 07:19:24 +0000 (07:19 +0000)]
Revert r295421, new ODR checker for modules, to fix build bot.

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

7 years agoAdd better ODR checking for modules.
Richard Trieu [Fri, 17 Feb 2017 05:54:30 +0000 (05:54 +0000)]
Add better ODR checking for modules.

A slightly weaker form of ODR checking than previous attempts, but hopefully
won't break the modules build bot.  Future work will be needed to catch all
cases.

When objects are imported for modules, there is a chance that a name collision
will cause an ODR violation.  Previously, only a small number of such
violations were detected.  This patch provides a stronger check based on
AST nodes.

The information needed to uniquely identify an object is taken from the AST and
put into a one-dimensional byte stream.  This stream is then hashed to give
a value to represent the object, which is stored with the other object data
in the module.

When modules are loaded, and Decl's are merged, the hash values of the two
Decl's are compared.  Only Decl's with matched hash values will be merged.
Mismatch hashes will generate a module error, and if possible, point to the
first difference between the two objects.

The transform from AST to byte stream is a modified depth first algorithm.
Due to references between some AST nodes, a pure depth first algorithm could
generate loops.  For Stmt nodes, a straight depth first processing occurs.
For Type and Decl nodes, they are replaced with an index number and only on
first visit will these nodes be processed.  As an optimization, boolean
values are saved and stored together in reverse order at the end of the
byte stream to lower the ammount of data that needs to be hashed.

Compile time impact was measured at 1.5-2.0% during module building, and
negligible during builds without module building.

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

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

7 years ago[index] Improvde how we handle synthesized ObjC properties and the associated ivars.
Argyrios Kyrtzidis [Fri, 17 Feb 2017 04:49:41 +0000 (04:49 +0000)]
[index] Improvde how we handle synthesized ObjC properties and the associated ivars.

Related synthesized properties with the ivar they use with the 'accessor' relation, and make sure
we mark them 'implicit' when appropriate.

Patch by Nathan Hawes!
https://reviews.llvm.org/D30012

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

7 years agoAdded doxygen comments to smmintrin.h's intrinsics.
Ekaterina Romanova [Fri, 17 Feb 2017 02:49:50 +0000 (02:49 +0000)]
Added doxygen comments to smmintrin.h's intrinsics.

Note: The doxygen comments are automatically generated based on Sony's intrinsic
s document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

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

7 years agoRetry: [ubsan] Reduce null checking of C++ object pointers (PR27581)
Vedant Kumar [Fri, 17 Feb 2017 02:03:51 +0000 (02:03 +0000)]
Retry: [ubsan] Reduce null checking of C++ object pointers (PR27581)

This patch teaches ubsan to insert exactly one null check for the 'this'
pointer per method/lambda.

Previously, given a load of a member variable from an instance method
('this->x'), ubsan would insert a null check for 'this', and another
null check for '&this->x', before allowing the load to occur.

Similarly, given a call to a method from another method bound to the
same instance ('this->foo()'), ubsan would a redundant null check for
'this'. There is also a redundant null check in the case where the
object pointer is a reference ('Ref.foo()').

This patch teaches ubsan to remove the redundant null checks identified
above.

Testing: check-clang and check-ubsan. I also compiled X86FastISel.cpp
with -fsanitize=null using patched/unpatched clangs based on r293572.
Here are the number of null checks emitted:

  -------------------------------------
  | Setup          | # of null checks |
  -------------------------------------
  | unpatched, -O0 |            21767 |
  | patched, -O0   |            10758 |
  -------------------------------------

Changes since the initial commit: don't rely on IRGen of C labels in the
test.

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

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

7 years agoRevert "[ubsan] Reduce null checking of C++ object pointers (PR27581)"
Vedant Kumar [Fri, 17 Feb 2017 01:42:36 +0000 (01:42 +0000)]
Revert "[ubsan] Reduce null checking of C++ object pointers (PR27581)"

This reverts commit r295391. It breaks this bot:

http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/1898

I need to not rely on labels in the IR test.

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

7 years ago[ubsan] Reduce null checking of C++ object pointers (PR27581)
Vedant Kumar [Fri, 17 Feb 2017 01:05:42 +0000 (01:05 +0000)]
[ubsan] Reduce null checking of C++ object pointers (PR27581)

This patch teaches ubsan to insert exactly one null check for the 'this'
pointer per method/lambda.

Previously, given a load of a member variable from an instance method
('this->x'), ubsan would insert a null check for 'this', and another
null check for '&this->x', before allowing the load to occur.

Similarly, given a call to a method from another method bound to the
same instance ('this->foo()'), ubsan would a redundant null check for
'this'. There is also a redundant null check in the case where the
object pointer is a reference ('Ref.foo()').

This patch teaches ubsan to remove the redundant null checks identified
above.

Testing: check-clang and check-ubsan. I also compiled X86FastISel.cpp
with -fsanitize=null using patched/unpatched clangs based on r293572.
Here are the number of null checks emitted:

  -------------------------------------
  | Setup          | # of null checks |
  -------------------------------------
  | unpatched, -O0 |            21767 |
  | patched, -O0   |            10758 |
  -------------------------------------

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

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

7 years agoUse correct fix-it location for -Wblock-capture-autoreleasing
Alex Lorenz [Thu, 16 Feb 2017 23:15:36 +0000 (23:15 +0000)]
Use correct fix-it location for -Wblock-capture-autoreleasing

The '__autoreleasing' keyword should be inserted after the Objective-C pointer
type.

rdar://30123548

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

7 years agoProperly set up the DeclContext for parameters of implicit deduction guides;
Richard Smith [Thu, 16 Feb 2017 21:29:21 +0000 (21:29 +0000)]
Properly set up the DeclContext for parameters of implicit deduction guides;
this is needed for deferred instantiation of default arguments.

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

7 years ago[OpenMP] Teams reduction on the NVPTX device.
Arpith Chacko Jacob [Thu, 16 Feb 2017 16:48:49 +0000 (16:48 +0000)]
[OpenMP] Teams reduction on the NVPTX device.

This patch implements codegen for the reduction clause on
any teams construct for elementary data types.  It builds
on parallel reductions on the GPU.  Subsequently,
the team master writes to a unique location in a global
memory scratchpad.  The last team to do so loads and
reduces this array to calculate the final result.

This patch emits two helper functions that are used by
the OpenMP runtime on the GPU to perform reductions across
teams.

Patch by Tian Jin in collaboration with Arpith Jacob

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29879

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

7 years ago[OpenMP] Parallel reduction on the NVPTX device.
Arpith Chacko Jacob [Thu, 16 Feb 2017 16:20:16 +0000 (16:20 +0000)]
[OpenMP] Parallel reduction on the NVPTX device.

This patch implements codegen for the reduction clause on
any parallel construct for elementary data types.  An efficient
implementation requires hierarchical reduction within a
warp and a threadblock.  It is complicated by the fact that
variables declared in the stack of a CUDA thread cannot be
shared with other threads.

The patch creates a struct to hold reduction variables and
a number of helper functions.  The OpenMP runtime on the GPU
implements reduction algorithms that uses these helper
functions to perform reductions within a team.  Variables are
shared between CUDA threads using shuffle intrinsics.

An implementation of reductions on the NVPTX device is
substantially different to that of CPUs.  However, this patch
is written so that there are minimal changes to the rest of
OpenMP codegen.

The implemented design allows the compiler and runtime to be
decoupled, i.e., the runtime does not need to know of the
reduction operation(s), the type of the reduction variable(s),
or the number of reductions.  The design also allows reuse of
host codegen, with appropriate specialization for the NVPTX
device.

While the patch does introduce a number of abstractions, the
expected use case calls for inlining of the GPU OpenMP runtime.
After inlining and optimizations in LLVM, these abstractions
are unwound and performance of OpenMP reductions is comparable
to CUDA-canonical code.

Patch by Tian Jin in collaboration with Arpith Jacob

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29758

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

7 years agoRevert r295319 while investigating buildbot failure.
Arpith Chacko Jacob [Thu, 16 Feb 2017 14:25:35 +0000 (14:25 +0000)]
Revert r295319 while investigating buildbot failure.

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

7 years agoSilence sign compare warning. NFC.
Benjamin Kramer [Thu, 16 Feb 2017 14:08:41 +0000 (14:08 +0000)]
Silence sign compare warning. NFC.

ExprConstant.cpp:6344:20: warning: comparison of integers of different
signs: 'const size_t' (aka 'const unsigned long') and 'typename
iterator_traits<Expr *const *>::difference_type' (aka 'long')
[-Wsign-compare]

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

7 years ago[OpenMP] Parallel reduction on the NVPTX device.
Arpith Chacko Jacob [Thu, 16 Feb 2017 14:03:36 +0000 (14:03 +0000)]
[OpenMP] Parallel reduction on the NVPTX device.

This patch implements codegen for the reduction clause on
any parallel construct for elementary data types.  An efficient
implementation requires hierarchical reduction within a
warp and a threadblock.  It is complicated by the fact that
variables declared in the stack of a CUDA thread cannot be
shared with other threads.

The patch creates a struct to hold reduction variables and
a number of helper functions.  The OpenMP runtime on the GPU
implements reduction algorithms that uses these helper
functions to perform reductions within a team.  Variables are
shared between CUDA threads using shuffle intrinsics.

An implementation of reductions on the NVPTX device is
substantially different to that of CPUs.  However, this patch
is written so that there are minimal changes to the rest of
OpenMP codegen.

The implemented design allows the compiler and runtime to be
decoupled, i.e., the runtime does not need to know of the
reduction operation(s), the type of the reduction variable(s),
or the number of reductions.  The design also allows reuse of
host codegen, with appropriate specialization for the NVPTX
device.

While the patch does introduce a number of abstractions, the
expected use case calls for inlining of the GPU OpenMP runtime.
After inlining and optimizations in LLVM, these abstractions
are unwound and performance of OpenMP reductions is comparable
to CUDA-canonical code.

Patch by Tian Jin in collaboration with Arpith Jacob

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29758

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

7 years ago[OpenCL][Doc] Added OpenCL vendor extension description to user manual doc
Anastasia Stulova [Thu, 16 Feb 2017 12:49:29 +0000 (12:49 +0000)]
[OpenCL][Doc] Added OpenCL vendor extension description to user manual doc

Added description of a new feature that allows to specify
vendor extension in flexible way using compiler pragma instead
of modifying source code directly (committed in clang@r289979).

Review: D29829

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

7 years ago[clang-format] Align block comment decorations
Krasimir Georgiev [Thu, 16 Feb 2017 12:39:31 +0000 (12:39 +0000)]
[clang-format] Align block comment decorations

Summary:
This patch implements block comment decoration alignment.

source:
```
/* line 1
* line 2
*/
```

result before:
```
/* line 1
* line 2
*/
```

result after:
```
/* line 1
 * line 2
 */
```

Reviewers: djasper, bkramer, klimek

Reviewed By: klimek

Subscribers: mprobst, cfe-commits, klimek

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

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

7 years ago[OpenCL] Correct ndrange_t implementation
Anastasia Stulova [Thu, 16 Feb 2017 12:27:47 +0000 (12:27 +0000)]
[OpenCL] Correct ndrange_t implementation

Removed ndrange_t as Clang builtin type and added
as a struct type in the OpenCL header.

Use type name to do the Sema checking in enqueue_kernel
and modify IR generation accordingly.

Review: D28058

Patch by Dmitry Borisenkov!

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

7 years ago[OpenCL] Disallow blocks capture other blocks (v2.0, s6.12.5)
Anastasia Stulova [Thu, 16 Feb 2017 11:13:30 +0000 (11:13 +0000)]
[OpenCL] Disallow blocks capture other blocks (v2.0, s6.12.5)

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

7 years agoCache FileID when translating diagnostics in PCH files
Erik Verbruggen [Thu, 16 Feb 2017 09:49:30 +0000 (09:49 +0000)]
Cache FileID when translating diagnostics in PCH files

Modules/preambles/PCH files can contain diagnostics, which, when used,
are added to the current ASTUnit. For that to work, they are translated
to use the current FileManager's FileIDs. When the entry is not the
main file, all local source locations will be checked by a linear
search. Now this is a problem, when there are lots of diagnostics (say,
25000) and lots of local source locations (say, 440000), and end up
taking seconds when using such a preamble.

The fix is to cache the last FileID, because many subsequent diagnostics
refer to the same file. This reduces the time spent in
ASTUnit::TranslateStoredDiagnostics from seconds to a few milliseconds
for files with many slocs/diagnostics.

This fixes PR31353.
Differential Revision: https://reviews.llvm.org/D29755

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

7 years agoRevert r295284: Add better ODR checking for modules.
Richard Trieu [Thu, 16 Feb 2017 07:09:18 +0000 (07:09 +0000)]
Revert r295284: Add better ODR checking for modules.

Fix modules build bot.

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

7 years ago[AVX-512] Replace 512-bit masked packss/packus builtins and replace with new unmasked...
Craig Topper [Thu, 16 Feb 2017 06:32:07 +0000 (06:32 +0000)]
[AVX-512] Replace 512-bit masked packss/packus builtins and replace with new unmasked builtins.

These new unmasked builtins will enable us to easily support optimizing these builtins in InstCombine in the backend.

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

7 years agoLoosen a Type check ODR checking to try to fix the build bot.
Richard Trieu [Thu, 16 Feb 2017 05:48:25 +0000 (05:48 +0000)]
Loosen a Type check ODR checking to try to fix the build bot.

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

7 years agoAdd better ODR checking for modules.
Richard Trieu [Thu, 16 Feb 2017 04:53:40 +0000 (04:53 +0000)]
Add better ODR checking for modules.

Recommit r293585 that was reverted in r293611 with new fixes.  The previous
issue was determined to be an overly aggressive AST visitor from forward
declared objects.  The visitor will now only deeply visit certain Decl's and
only do a shallow information extraction from all other Decl's.

When objects are imported for modules, there is a chance that a name collision
will cause an ODR violation.  Previously, only a small number of such
violations were detected.  This patch provides a stronger check based on
AST nodes.

The information needed to uniquely identify an object is taken from the AST and
put into a one-dimensional byte stream.  This stream is then hashed to give
a value to represent the object, which is stored with the other object data
in the module.

When modules are loaded, and Decl's are merged, the hash values of the two
Decl's are compared.  Only Decl's with matched hash values will be merged.
Mismatch hashes will generate a module error, and if possible, point to the
first difference between the two objects.

The transform from AST to byte stream is a modified depth first algorithm.
Due to references between some AST nodes, a pure depth first algorithm could
generate loops.  For Stmt nodes, a straight depth first processing occurs.
For Type and Decl nodes, they are replaced with an index number and only on
first visit will these nodes be processed.  As an optimization, boolean
values are saved and stored together in reverse order at the end of the
byte stream to lower the ammount of data that needs to be hashed.

Compile time impact was measured at 1.5-2.0% during module building, and
negligible during builds without module building.

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

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

7 years agoRevert r295277 to fix buildbot.
Richard Smith [Thu, 16 Feb 2017 04:22:56 +0000 (04:22 +0000)]
Revert r295277 to fix buildbot.

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

7 years ago[cxx1z-constexpr-lambda] Implement captures - thus completing implementation of const...
Faisal Vali [Thu, 16 Feb 2017 04:12:21 +0000 (04:12 +0000)]
[cxx1z-constexpr-lambda] Implement captures - thus completing implementation of constexpr lambdas.

Enable evaluation of captures within constexpr lambdas by using a strategy similar to that used in CodeGen:
  - when starting evaluation of a lambda's call operator, create a map from VarDecl's to a closure's FieldDecls
  - every time a VarDecl (or '*this) that represents a capture is encountered while evaluating the expression via the expression evaluator (specifically the LValueEvaluator) in ExprConstant.cpp - it is replaced by the corresponding FieldDecl LValue (an Lvalue-to-Rvalue conversion on this LValue representation then determines the right rvalue when needed).

Thanks to Richard Smith and Hubert Tong for their review and feedback!

https://reviews.llvm.org/D29748

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

7 years agoAdd missing "deduced A == A" check for function template partial ordering.
Richard Smith [Thu, 16 Feb 2017 03:49:44 +0000 (03:49 +0000)]
Add missing "deduced A == A" check for function template partial ordering.

This appears to be the only template argument deduction context where we were
missing this check. Surprisingly, other implementations also appear to miss
the check in this case; it may turn out that important code is relying on
the widespread non-conformance here, in which case we'll need to reconsider.

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

7 years agoAdd missing regexp quantifiers in a test.
Evgeniy Stepanov [Thu, 16 Feb 2017 01:35:23 +0000 (01:35 +0000)]
Add missing regexp quantifiers in a test.

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

7 years ago[Sema] Add lvalue-to-rvalue cast in direct-list-initialization of enum
Vedant Kumar [Thu, 16 Feb 2017 01:20:00 +0000 (01:20 +0000)]
[Sema] Add lvalue-to-rvalue cast in direct-list-initialization of enum

After r264564, we allowed direct-list-initialization of an enum from an
integral value in C++1z mode, so long as that value can convert to the
enum's underlying type.

In this kind of initialization, we need a lvalue-to-rvalue conversion
for the initializer value if it is not a rvalue. This lets us accept the
following code:

  enum class A : unsigned {};
  A foo(unsigned x) { return A{x}; }

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

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

7 years ago[c++1z] Diagnose non-deducible template parameters in deduction guide templates,...
Richard Smith [Thu, 16 Feb 2017 00:36:47 +0000 (00:36 +0000)]
[c++1z] Diagnose non-deducible template parameters in deduction guide templates, per [temp.param]p11.

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

7 years ago[dllimport] Check for dtor references in functions
Hans Wennborg [Wed, 15 Feb 2017 23:28:10 +0000 (23:28 +0000)]
[dllimport] Check for dtor references in functions

Destructor references are not modelled explicitly in the AST. This adds
checks for destructor calls due to variable definitions and temporaries.

If a dllimport function references a non-dllimport destructor, it must
not be emitted available_externally, as the referenced destructor might
live across the DLL boundary and isn't exported.

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

7 years ago[dllimport] Look through typedefs and arrays in HasNonDllImportDtor
Hans Wennborg [Wed, 15 Feb 2017 23:28:07 +0000 (23:28 +0000)]
[dllimport] Look through typedefs and arrays in HasNonDllImportDtor

The function is used to check whether a type is a class with
non-dllimport destructor. It needs to look through typedefs and array
types.

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

7 years ago[Docs] Add missing space to an option doc
Alex Lorenz [Wed, 15 Feb 2017 23:24:15 +0000 (23:24 +0000)]
[Docs] Add missing space to an option doc

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

7 years ago[Modules] Consider enable_if attrs in isSameEntity.
George Burgess IV [Wed, 15 Feb 2017 22:43:27 +0000 (22:43 +0000)]
[Modules] Consider enable_if attrs in isSameEntity.

Two functions that differ only in their enable_if attributes are
considered overloads, so we should check for those when we're trying to
figure out if two functions are mergeable.

We need to do the same thing for pass_object_size, as well. Looks like
that'll be a bit less trivial, since we sometimes do these merging
checks before we have pass_object_size attributes available (see the
merge checks in ASTDeclReader::VisitFunctionDecl that happen before we
read parameters, and merge checks in calls to ReadDeclAs<>()).

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

7 years agoFix the static build.
Rafael Espindola [Wed, 15 Feb 2017 22:19:04 +0000 (22:19 +0000)]
Fix the static build.

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

7 years agoPR24440: Do not silently discard a fold-expression appearing as the operand of a...
Richard Smith [Wed, 15 Feb 2017 19:57:10 +0000 (19:57 +0000)]
PR24440: Do not silently discard a fold-expression appearing as the operand of a cast-expression.

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

7 years ago[index] USR generation: use getTemplateArgs() instead of getTemplateInstantiationArgs()
Argyrios Kyrtzidis [Wed, 15 Feb 2017 16:16:27 +0000 (16:16 +0000)]
[index] USR generation: use getTemplateArgs() instead of getTemplateInstantiationArgs()

Otherwise we may end up creating a different USR for the definition of a function, vs its declaration.

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

7 years ago[analyzer] Proper caching in CallDescription objects.
Gabor Horvath [Wed, 15 Feb 2017 15:35:56 +0000 (15:35 +0000)]
[analyzer] Proper caching in CallDescription objects.

During the review of D29567 it turned out the caching in CallDescription is not implemented properly. In case an identifier does not exist in a translation unit, repeated identifier lookups will be done which might have bad impact on the performance. This patch guarantees that the lookup is only executed once. Moreover this patch fixes a corner case when the identifier of CallDescription does not exist in the translation unit and the called function does not have an identifier (e.g.: overloaded operator in C++).

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

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

7 years agoFix spelling mistake - paramater -> parameter. NFCI.
Simon Pilgrim [Wed, 15 Feb 2017 15:12:06 +0000 (15:12 +0000)]
Fix spelling mistake - paramater -> parameter. NFCI.

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

7 years agoUse dedicated method instead of copying conditions. NFC.
Serge Pavlov [Wed, 15 Feb 2017 12:30:35 +0000 (12:30 +0000)]
Use dedicated method instead of copying conditions. NFC.

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

7 years agoRemoved stale comment. NFC.
Serge Pavlov [Wed, 15 Feb 2017 11:34:11 +0000 (11:34 +0000)]
Removed stale comment. NFC.

The case of extern inline functions in GNU89 mode is now handled
in `canRedefineFunction`, which has appropriate comment.

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

7 years ago[XRAY][MIPS] Add -fxray-instrument for mips/mipsel/mips64/mips64el
Sagar Thakur [Wed, 15 Feb 2017 10:41:38 +0000 (10:41 +0000)]
[XRAY][MIPS] Add -fxray-instrument for mips/mipsel/mips64/mips64el

Summary: Adds xray instrument option for mips/mipsel/mips64/mips64el.

Reviewed by sdardis, dberris
Differential: D27698

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

7 years agoAdd a definition for __STRUCT_PARM_ALIGN__ for elfv2 and 64-bit darwin platforms...
Eric Christopher [Wed, 15 Feb 2017 07:50:11 +0000 (07:50 +0000)]
Add a definition for __STRUCT_PARM_ALIGN__ for elfv2 and 64-bit darwin platforms to match what other compilers produce.

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

7 years ago[Sema] Disallow returning a __block variable via a move.
Akira Hatanaka [Wed, 15 Feb 2017 05:15:28 +0000 (05:15 +0000)]
[Sema] Disallow returning a __block variable via a move.

r274291 made changes to prefer calling a move constructor to calling a
copy constructor when returning from a function. This caused programs to
crash when a __block variable in the heap was moved out and used later.

This commit fixes the bug by disallowing moving out of __block variables
implicitly.

rdar://problem/28181080

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

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

7 years agoFix assertion failure due to implicit special member lookup lacking a source location.
Richard Smith [Wed, 15 Feb 2017 04:18:23 +0000 (04:18 +0000)]
Fix assertion failure due to implicit special member lookup lacking a source location.

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

7 years agoSpeculatively revert r295118 to see if it's what's causing the modules selfhost build...
Richard Smith [Wed, 15 Feb 2017 03:29:24 +0000 (03:29 +0000)]
Speculatively revert r295118 to see if it's what's causing the modules selfhost buildbots to fail.

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

7 years agoDon't look for GCC versions in /usr/lib/<triple> except when <triple> is a
Richard Smith [Wed, 15 Feb 2017 01:16:48 +0000 (01:16 +0000)]
Don't look for GCC versions in /usr/lib/<triple> except when <triple> is a
freescale triple.

On multiarch systems, this previously caused us to stat every file in
/usr/lib/<triple> (typically several thousand files). This change halves
the runtime of a clang invocation on an empty file on my system.

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

7 years agoRefactor GCC lib directory detection to make it easier to add lib directories
Richard Smith [Wed, 15 Feb 2017 01:13:54 +0000 (01:13 +0000)]
Refactor GCC lib directory detection to make it easier to add lib directories
that are only checked for some targets.

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

7 years ago[VLA] Fix the test failure on msvc by specifying the triple.
Tim Shen [Wed, 15 Feb 2017 00:01:12 +0000 (00:01 +0000)]
[VLA] Fix the test failure on msvc by specifying the triple.

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

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

7 years agoRemove unused variable. No functional change.
Richard Trieu [Tue, 14 Feb 2017 23:56:55 +0000 (23:56 +0000)]
Remove unused variable.  No functional change.

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

7 years ago[VLA] Handle VLA size expression in a full-expression context.
Tim Shen [Tue, 14 Feb 2017 23:46:37 +0000 (23:46 +0000)]
[VLA] Handle VLA size expression in a full-expression context.

Summary: Previously the cleanups (e.g. dtor calls) are inserted into the
outer scope (e.g. function body scope), instead of it's own scope. After
the fix, the cleanups are inserted right after getting the size value.

This fixes pr30306.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoStop asserting when a meaningless -std= flag is passed for a non-compilation
Richard Smith [Tue, 14 Feb 2017 23:41:38 +0000 (23:41 +0000)]
Stop asserting when a meaningless -std= flag is passed for a non-compilation
input kind; go back to silently ignoring the flag.

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

7 years agoDo not implicitly instantiate the definition of a class template specialization
Richard Smith [Tue, 14 Feb 2017 23:27:44 +0000 (23:27 +0000)]
Do not implicitly instantiate the definition of a class template specialization
that has been explicitly specialized!

We assume in various places that we can tell the template specialization kind
of a class type by looking at the declaration produced by TagType::getDecl.
That was previously not quite true: for an explicit specialization, we could
have first seen a template-id denoting the specialization (with a use that does
not trigger an implicit instantiation of the defintiion) and then seen the
first explicit specialization declaration. TagType::getDecl would previously
return an arbitrary declaration when called on a not-yet-defined class; it
now consistently returns the most recent declaration in that case.

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

7 years agoImprove diagnostic reporting when using __declspec without enabling __declspec as...
Aaron Ballman [Tue, 14 Feb 2017 22:47:20 +0000 (22:47 +0000)]
Improve diagnostic reporting when using __declspec without enabling __declspec as a keyword.

Fixes PR31936.

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

7 years ago[Driver] Report available language standards on user error
Richard Smith [Tue, 14 Feb 2017 22:44:20 +0000 (22:44 +0000)]
[Driver] Report available language standards on user error

In case user did not provide valid standard name for -std option, available
values (with short description) will be reported.

Patch by PaweÅ‚ Å»ukowski!

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

7 years agoMS inline asm: Filter MXCSR out of the inferred clobber list
Reid Kleckner [Tue, 14 Feb 2017 21:38:17 +0000 (21:38 +0000)]
MS inline asm: Filter MXCSR out of the inferred clobber list

Since r295004, LLVM has started modelling this new register, but we
don't have GCC constraint inline asm spellings for it yet.

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

7 years ago[profiling] Update test cases to deal with name variable change (NFC)
Vedant Kumar [Tue, 14 Feb 2017 20:03:56 +0000 (20:03 +0000)]
[profiling] Update test cases to deal with name variable change (NFC)

This is a re-try of r295085: fix up some test cases that assume that
profile name variables are preserved by the instrprof pass.

This catches one additional case in test/CoverageMapping/unused_names.c.

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

7 years agoRevert "[profiling] Update test case to deal with name variable change (NFC)"
Vedant Kumar [Tue, 14 Feb 2017 20:03:53 +0000 (20:03 +0000)]
Revert "[profiling] Update test case to deal with name variable change (NFC)"

This reverts commit r295085, because the corresponding llvm change was
reverted.

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

7 years agoFinish a comment + remove trailing whitespace. NFC
George Burgess IV [Tue, 14 Feb 2017 19:34:33 +0000 (19:34 +0000)]
Finish a comment + remove trailing whitespace. NFC

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

7 years ago[profiling] Update test case to deal with name variable change (NFC)
Vedant Kumar [Tue, 14 Feb 2017 18:49:03 +0000 (18:49 +0000)]
[profiling] Update test case to deal with name variable change (NFC)

The 'profn' name variables shouldn't show up after we run the instrprof
pass, see https://reviews.llvm.org/D29921 for more details.

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

7 years agoRemove unnecessary std::string construction
Reid Kleckner [Tue, 14 Feb 2017 18:38:40 +0000 (18:38 +0000)]
Remove unnecessary std::string construction

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

7 years agoFix some warnings in intrin.h
Reid Kleckner [Tue, 14 Feb 2017 18:38:19 +0000 (18:38 +0000)]
Fix some warnings in intrin.h

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

7 years ago[scan-build-py] move function report_directory from report module to analyze module
Laszlo Nagy [Tue, 14 Feb 2017 10:43:38 +0000 (10:43 +0000)]
[scan-build-py] move function report_directory from report module to analyze module

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

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

7 years ago[clang-format] Remove dead code in FormatTestComments, NFC
Krasimir Georgiev [Tue, 14 Feb 2017 10:35:42 +0000 (10:35 +0000)]
[clang-format] Remove dead code in FormatTestComments, NFC

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

7 years ago[scan-build-py] use subprocess wrapper to execute build
Laszlo Nagy [Tue, 14 Feb 2017 10:30:50 +0000 (10:30 +0000)]
[scan-build-py] use subprocess wrapper to execute build

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

7 years ago[CodeGen][ObjC] Use the type of the captured field of the enclosing
Akira Hatanaka [Tue, 14 Feb 2017 06:46:55 +0000 (06:46 +0000)]
[CodeGen][ObjC] Use the type of the captured field of the enclosing
block or lambda.

This is a follow-up to r281682, which fixed a bug in computeBlockInfo
where the captured VarDecl's type, rather than the captured field type
of the enclosing lambda or block, was used to compute the layout of a
block.

This commit makes similar changes to enterBlockScope. This is necessary
to correctly determine whether a block capture requires cleanup.

rdar://problem/30388124

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

7 years agoDelete useless / in comment. NFC.
George Burgess IV [Tue, 14 Feb 2017 05:52:57 +0000 (05:52 +0000)]
Delete useless / in comment. NFC.

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

7 years agoAdd a destruct-on-exit function to ASTContext.
George Burgess IV [Tue, 14 Feb 2017 05:37:36 +0000 (05:37 +0000)]
Add a destruct-on-exit function to ASTContext.

It looks like the only use of AddDeallocation is to indirectly call the
destructors of objects. In one case I found
(TypeAliasTemplateDecl::Common), the destructor is a nop, so registering
it to run later seems pointless.

All of the other *::Common types have non-trivial dtors, so deleting the
useless AddDeallocation felt somewhat fragile. Happy to kill it + turn
the is_trivial_dtor check into a static_assert if people think that'd be
better.

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

7 years agoclang/test/Parser/cxx1z-class-template-argument-deduction.cpp: Tweak to ignore thiscall.
NAKAMURA Takumi [Tue, 14 Feb 2017 03:18:24 +0000 (03:18 +0000)]
clang/test/Parser/cxx1z-class-template-argument-deduction.cpp: Tweak to ignore thiscall.

  Line 38: multiple overloads of 'f' instantiate to the same signature 'void (int) __attribute__((thiscall))'

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

7 years agoCanonicalize implicit deduction guide parameter types when forming a deduction
Richard Smith [Tue, 14 Feb 2017 01:49:59 +0000 (01:49 +0000)]
Canonicalize implicit deduction guide parameter types when forming a deduction
guide from a constructor.

The purpose of this change is to avoid triggering instantiation of the class
when substituting back into the deduction guide if it uses a typedef member.
We will still instantiate the class if the constructor (explicitly or
implicitly, directly or indirectly) uses the current instantiation in a way
that we can't canonicalize out, but that seems unavoidable.

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

7 years ago[c++1z] Add some more tests for class template argument deduction, add
Richard Smith [Tue, 14 Feb 2017 00:55:25 +0000 (00:55 +0000)]
[c++1z] Add some more tests for class template argument deduction, add
feature-test macro, and mark feature as done on status page.

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

7 years ago[MS ABI] Correctly mangling vbase destructors
David Majnemer [Tue, 14 Feb 2017 00:54:11 +0000 (00:54 +0000)]
[MS ABI] Correctly mangling vbase destructors

They are a little bit of a special case in the mangling. They are always
mangled without taking into account their virtual-ness of the
destructor. They are also mangled to return void, unlike the actual
destructor.

This fixes PR31931.

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

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

7 years ago[c++1z] Synthesize implicit deduction guides from constructors on demand. Rank
Richard Smith [Tue, 14 Feb 2017 00:25:28 +0000 (00:25 +0000)]
[c++1z] Synthesize implicit deduction guides from constructors on demand. Rank
such guides below explicit ones, and ensure that references to the class's
template parameters are not treated as forwarding references.

We make a few tweaks to the wording in the current standard:
1) The constructor parameter list is copied faithfully to the deduction guide,
   without losing default arguments or a varargs ellipsis (which the standard
   wording loses by omission).
2) If the class template declares no constructors, we add a T() -> T<...> guide
   (which will only ever work if T has default arguments for all non-pack
   template parameters).
3) If the class template declares nothing that looks like a copy or move
   constructor, we add a T(T<...>) -> T<...> guide.
#2 and #3 follow from the "pretend we had a class type with these constructors"
philosophy for deduction guides.

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

7 years agoWhen the new expr's array size is an ICE, emit it as a constant expression.
Nick Lewycky [Mon, 13 Feb 2017 23:49:55 +0000 (23:49 +0000)]
When the new expr's array size is an ICE, emit it as a constant expression.

This bypasses integer sanitization checks which are redundant on the expression since it's been checked by Sema. Fixes a clang codegen assertion on "void test() { new int[0+1]{0}; }" when building with -fsanitize=signed-integer-overflow.

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

7 years ago[CodeCompletion] Code complete the '__auto_type' keyword
Alex Lorenz [Mon, 13 Feb 2017 23:35:59 +0000 (23:35 +0000)]
[CodeCompletion] Code complete the '__auto_type' keyword

rdar://29219185

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

7 years ago[CodeCompletion] Code complete the missing C++11 keywords
Alex Lorenz [Mon, 13 Feb 2017 23:19:40 +0000 (23:19 +0000)]
[CodeCompletion] Code complete the missing C++11 keywords

This commit adds context sensitive code completion support for the C++11
keywords that currently don't have completion results.

The following keywords are supported by this patch:

alignas
constexpr
static_assert
noexcept (as a function/method qualifier)
thread_local

The following special identifiers are also supported:

final (as a method qualifier or class qualifier)
override

rdar://29219185

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

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

7 years ago[test] Make Lit tests C++11 Compatible - Objective-C++
Charles Li [Mon, 13 Feb 2017 23:09:56 +0000 (23:09 +0000)]
[test] Make Lit tests C++11 Compatible - Objective-C++

Set 5 Objective-C++ tests to run at gnu++98

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

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

7 years ago[Test] Make Lit tests C++11 compatible - printf format string
Charles Li [Mon, 13 Feb 2017 18:57:06 +0000 (18:57 +0000)]
[Test] Make Lit tests C++11 compatible - printf format string

Different diagnostics when format string does not match
actual arg type.

This commit contains the first 2 of 3 tests reviewed in D29685

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

7 years ago[CodeGen] Treat auto-generated __dso_handle symbol as HiddenVisibility
Reid Kleckner [Mon, 13 Feb 2017 18:49:21 +0000 (18:49 +0000)]
[CodeGen] Treat auto-generated __dso_handle symbol as HiddenVisibility

Fixes https://bugs.llvm.org/show_bug.cgi?id=31932

Based on a patch by Roland McGrath

Reviewed By: phosek

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

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

7 years ago[Test] Make Lit tests C++11 compatible - nounwind noexcept
Charles Li [Mon, 13 Feb 2017 17:56:30 +0000 (17:56 +0000)]
[Test] Make Lit tests C++11 compatible - nounwind noexcept

C++11 destructors are nothrow by default.

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

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

7 years ago[ASTUnit] Clear out diagnostic state after creating the preamble.
Benjamin Kramer [Mon, 13 Feb 2017 16:16:43 +0000 (16:16 +0000)]
[ASTUnit] Clear out diagnostic state after creating the preamble.

If the preamble had diagnostic state this would leave behind invalid
state in the DiagnosticsEngine and crash later. The test case runs into
an assertion in DiagnosticsEngine::setSourceManager.

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

7 years ago[PM] Add support for instrumented PGO in the new pass manager (clang-side)
Davide Italiano [Mon, 13 Feb 2017 16:07:05 +0000 (16:07 +0000)]
[PM] Add support for instrumented PGO in the new pass manager (clang-side)

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

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

7 years agoFix r291495 -- Normalize LLVM_CMAKE_PATH in clang standalone build.
NAKAMURA Takumi [Mon, 13 Feb 2017 14:59:53 +0000 (14:59 +0000)]
Fix r291495 -- Normalize LLVM_CMAKE_PATH in clang standalone build.

CMake handles paths with slashes. It caused cmake/install failure on msbuild.exe.

Note, Other llvm-config-oriented variables have been normalized since they are stored in the cache attributed with PATH.

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

7 years ago[coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.
Gor Nishanov [Mon, 13 Feb 2017 05:05:02 +0000 (05:05 +0000)]
[coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

Summary:
Sema::CheckCompletedCoroutineBody was growing unwieldy with building all of the substatements. Also, constructors for CoroutineBodyStmt had way too many parameters.

Instead,  CoroutineBodyStmt now defines CtorArgs structure with all of the required construction parameters.
CheckCompleteCoroutineBody delegates construction of individual substatements to short functions one per each substatement.

Also, added a drive-by fix of initializing CoroutinePromise to nullptr in ScopeInfo.h.
And addressed the FIXME that wanted to tail allocate extra room at the end of the CoroutineBodyStmt to hold parameter move expressions. (The comment was longer that the code that implemented tail allocation).

Reviewers: rsmith, EricWF

Subscribers: mehdi_amini, cfe-commits

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

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

7 years agoRevert r294910 and recommit r294861 and r294862 with a target triple to hopefully...
Aaron Ballman [Sun, 12 Feb 2017 19:24:47 +0000 (19:24 +0000)]
Revert r294910 and recommit r294861 and r294862 with a target triple to hopefully appease the bots.

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

7 years agoRevert "Attributes on K&R C functions should not cause incompatible..."
Renato Golin [Sun, 12 Feb 2017 19:08:02 +0000 (19:08 +0000)]
Revert "Attributes on K&R C functions should not cause incompatible..."

...function type with a redeclaration having the same attribute. Fixing this
introduced a secondary problem where we were assuming that K&R functions
could not be attributed types when reporting old-style function definitions
that are not preceded by a prototype."

Also Revert "Hopefully fixes a compile error introduced by r294861."

This reverts commit r294862, r294861, as they bork the ARM builds and
haven't fix it back.

Also, please, short commit titles, long commit decsriptions...

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

7 years agoASTReader: Refactor common code for writing function definitions, to match the writin...
David Blaikie [Sun, 12 Feb 2017 18:45:31 +0000 (18:45 +0000)]
ASTReader: Refactor common code for writing function definitions, to match the writing code

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

7 years ago[Driver] Use stem() and not filename().
Davide Italiano [Sat, 11 Feb 2017 23:44:37 +0000 (23:44 +0000)]
[Driver] Use stem() and not filename().

On Windows the filename might have an extension, namely
`.exe`, so the search will fail. Sorry, I don't have a
good way to test this as it seems to fail only in some
weird configurations. r284430 has the same modification
for Fuchsia.

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

7 years agoCodeGen: use # as the comment leader for ARC marker
Saleem Abdulrasool [Sat, 11 Feb 2017 23:03:13 +0000 (23:03 +0000)]
CodeGen: use # as the comment leader for ARC marker

Use # as the comment leader for AArch64 auto-release elision marker.
This is to keep it in sync with the value used in swift.  When building
libdispatch for Linux AArch64, the auto-release elision marker was
emitted.  However, ELF uses # as the comment leader while MachO accepts
both ; and #.  Use the common marker for it instead.

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

7 years agoCodeGen: annotate ObjC ARC functions with ABI constraints
Saleem Abdulrasool [Sat, 11 Feb 2017 21:34:18 +0000 (21:34 +0000)]
CodeGen: annotate ObjC ARC functions with ABI constraints

Certain ARC runtime functions have an ABI contract of being forwarding.
Annotate the functions with the appropriate `returned` attribute on the
arguments.  This hoists some of the runtime ABI contract information
into the frontend rather than the backend transformations.

The test adjustments are to mark the returned function parameter as
such.  The minor change to the IR output is due to the fact that the
returned reference of the object causes it to extend the lifetime of the
object by returning an autoreleased return value.  The result is that
the explicit objc_autorelease call is no longer formed, as autorelease
elision is now possible on the return.

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