]> granicus.if.org Git - clang/log
clang
6 years agoRegenerated AST Matchers doc.
Alexander Kornienko [Mon, 30 Apr 2018 18:12:15 +0000 (18:12 +0000)]
Regenerated AST Matchers doc.

Backported a minor fix to the comment in the header.

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

6 years ago[OPENMP] Do not crash on codegen for CXX member functions.
Alexey Bataev [Mon, 30 Apr 2018 18:09:40 +0000 (18:09 +0000)]
[OPENMP] Do not crash on codegen for CXX member functions.

Non-static member functions should not be emitted as a standalone
functions, this leads to compiler crash.

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

6 years ago[OPENMP] Do not crash on incorrect input data.
Alexey Bataev [Mon, 30 Apr 2018 16:26:57 +0000 (16:26 +0000)]
[OPENMP] Do not crash on incorrect input data.

Emit error messages instead of compiler crashing when the target region
does not exist in the device code + fix crash when the location comes
from macros.

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

6 years agoIWYU for llvm-config.h in clang. See r331124 for details.
Nico Weber [Mon, 30 Apr 2018 13:52:15 +0000 (13:52 +0000)]
IWYU for llvm-config.h in clang. See r331124 for details.

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

6 years agoRemove unnecessary indirection. No behavior change.
Nico Weber [Mon, 30 Apr 2018 13:47:04 +0000 (13:47 +0000)]
Remove unnecessary indirection. No behavior change.

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

6 years ago[Targets] Implement getConstraintRegister for ARM and AArch64
Mikhail Maltsev [Mon, 30 Apr 2018 09:11:08 +0000 (09:11 +0000)]
[Targets] Implement getConstraintRegister for ARM and AArch64

Summary:
The getConstraintRegister method is used by semantic checking of
inline assembly statements in order to diagnose conflicts between
clobber list and input/output lists. Currently ARM and AArch64 don't
override getConstraintRegister, so conflicts between registers
assigned to variables in asm labels and clobber lists are not
diagnosed. Such conflicts can cause assertion failures in the back end
and even miscompilations.

This patch implements getConstraintRegister for ARM and AArch64
targets. Since these targets don't have single-register constraints,
the implementation is trivial and just returns the register specified
in an asm label (if any).

Reviewers: eli.friedman, javed.absar, thopre

Reviewed By: thopre

Subscribers: rengolin, eraman, rogfer01, myatsina, kristof.beyls, cfe-commits, chrib

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

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

6 years agoPR37189 Fix incorrect end source location and spelling for a split '>>' token.
Richard Smith [Mon, 30 Apr 2018 05:25:48 +0000 (05:25 +0000)]
PR37189 Fix incorrect end source location and spelling for a split '>>' token.

When a '>>' token is split into two '>' tokens (in C++11 onwards), or (as an
extension) when we do the same for other tokens starting with a '>', we can't
just use a location pointing to the first '>' as the location of the split
token, because that would result in our miscomputing the length and spelling
for the token. As a consequence, for example, a refactoring replacing 'A<X>'
with something else would sometimes replace one character too many, and
similarly diagnostics highlighting a template-id source range would highlight
one character too many.

Fix this by creating an expansion range covering the first character of the
'>>' token, whose spelling is '>'. For this to work, we generalize the
expansion range of a macro FileID to be either a token range (the common case)
or a character range (used in this new case).

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

6 years agoRename DiagnosticClient to DiagnosticConsumer as per issue 5397.
Fangrui Song [Mon, 30 Apr 2018 00:34:09 +0000 (00:34 +0000)]
Rename DiagnosticClient to DiagnosticConsumer as per issue 5397.

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

6 years agoFix printing of reference-to-reference types.
Richard Smith [Sun, 29 Apr 2018 05:33:38 +0000 (05:33 +0000)]
Fix printing of reference-to-reference types.

Previously we would sometimes print these as 'T &&&' or even 'T &&&&'.

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

6 years agoPR37275 packed attribute should not apply to base classes
Richard Smith [Sun, 29 Apr 2018 04:55:46 +0000 (04:55 +0000)]
PR37275 packed attribute should not apply to base classes

Clang incorrectly applied the packed attribute to base classes. Per GCC's
documentation and as can be observed from its behavior, packed only applies to
members, not base classes.

This change is conditioned behind -fclang-abi-compat so that an ABI break can
be avoided by users if desired.

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

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

6 years agoRemove unused includes of clang/Config/config.h
Nico Weber [Sat, 28 Apr 2018 23:48:36 +0000 (23:48 +0000)]
Remove unused includes of clang/Config/config.h

Found by opening config.h.cmake in vim, finding all defined macros with

  /define\(01\)\? \zs[A-Za-z0-9_]*<cr>
  :%s//\=setreg('A', submatch(0), 'V')/gn<cr>
  :put A<cr>

and then joining them all with |, and passing that to

  git grep -E that_pattern 'clang/*.h' 'clang/*.cpp' 'clang/*.c'

and diffing that output with the result of

  git grep Config/config.h 'clang/*.h' 'clang/*.cpp' 'clang/*.c'

No intended behavior change.

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

6 years ago[ItaniumMangle] Undeduced auto type shouldn't be substitutable.
Erik Pilkington [Sat, 28 Apr 2018 02:40:28 +0000 (02:40 +0000)]
[ItaniumMangle] Undeduced auto type shouldn't be substitutable.

We still support the old mangling if we're trying to be ABI-compatible with
Clang 6.0, though.

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

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

6 years ago[analyzer] CStringChecker: Add support for BSD strlcpy() and strlcat().
Artem Dergachev [Fri, 27 Apr 2018 23:50:55 +0000 (23:50 +0000)]
[analyzer] CStringChecker: Add support for BSD strlcpy() and strlcat().

Patch by David Carlier!

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

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

6 years agoFix diag-format test to not care about what cl.exe is on path
Reid Kleckner [Fri, 27 Apr 2018 22:32:21 +0000 (22:32 +0000)]
Fix diag-format test to not care about what cl.exe is on path

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

6 years ago[analyzer] ObjCAutoreleaseWrite: Support a few more APIs and fix warning text.
Artem Dergachev [Fri, 27 Apr 2018 22:00:51 +0000 (22:00 +0000)]
[analyzer] ObjCAutoreleaseWrite: Support a few more APIs and fix warning text.

API list and improved warning text composed by Devin Coughlin.

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

6 years agoRevert r329698 (and r329702).
Nico Weber [Fri, 27 Apr 2018 20:29:57 +0000 (20:29 +0000)]
Revert r329698 (and r329702).

Speculative. ClangMoveTests started failing on
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/9958
after this change. I can't reproduce on my machine, let's see
if it was due to this change.

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

6 years agos/LLVM_ON_WIN32/_WIN32/, clang
Nico Weber [Fri, 27 Apr 2018 19:11:14 +0000 (19:11 +0000)]
s/LLVM_ON_WIN32/_WIN32/, clang

LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too.  Just use the
default macro instead of a reinvented one.

See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.

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

6 years ago[clang-format/ObjC] Use getIdentifierInfo() instead of tok::identifier
Ben Hamilton [Fri, 27 Apr 2018 18:51:12 +0000 (18:51 +0000)]
[clang-format/ObjC] Use getIdentifierInfo() instead of tok::identifier

Summary:
Previously, we checked tokens for `tok::identifier` to see if they
were identifiers inside an Objective-C selector.

However, this missed C++ keywords like `new` and `delete`.

To fix this, this diff uses `getIdentifierInfo()` to find
identifiers or keywords inside Objective-C selectors.

Test Plan: New tests added. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[Modules][ObjC] ASTReader should add protocols for class extensions
Bruno Cardoso Lopes [Fri, 27 Apr 2018 18:01:23 +0000 (18:01 +0000)]
[Modules][ObjC] ASTReader should add protocols for class extensions

During deserialization clang is currently missing the merging of
protocols into the canonical interface for the class extension.

This merging only currently happens during parsing and should also
be considered during deserialization.

rdar://problem/38724303

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

6 years ago[docs] more dashes
Sanjay Patel [Fri, 27 Apr 2018 16:24:39 +0000 (16:24 +0000)]
[docs] more dashes

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

6 years ago[docs] add -ffp-cast-overflow-workaround to the release notes
Sanjay Patel [Fri, 27 Apr 2018 16:21:22 +0000 (16:21 +0000)]
[docs] add -ffp-cast-overflow-workaround to the release notes

This option was added with:
D46135
rL331041
...copying the text from UsersManual.rst for more exposure.

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

6 years ago[MC] Undo spurious commit added into r331052.
Nirav Dave [Fri, 27 Apr 2018 16:16:06 +0000 (16:16 +0000)]
[MC] Undo spurious commit added into r331052.

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

6 years agoTest commit removing trailing whitespace
Stuart Brady [Fri, 27 Apr 2018 16:11:56 +0000 (16:11 +0000)]
Test commit removing trailing whitespace

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

6 years ago[MC] Provide default value for IsResolved.
Nirav Dave [Fri, 27 Apr 2018 16:11:24 +0000 (16:11 +0000)]
[MC] Provide default value for IsResolved.

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

6 years ago[MC] Modify MCAsmStreamer to always build MCAssembler. NFCI.
Nirav Dave [Fri, 27 Apr 2018 15:45:54 +0000 (15:45 +0000)]
[MC] Modify MCAsmStreamer to always build MCAssembler. NFCI.

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

6 years ago[Driver, CodeGen] add options to enable/disable an FP cast optimization
Sanjay Patel [Fri, 27 Apr 2018 14:22:48 +0000 (14:22 +0000)]
[Driver, CodeGen] add options to enable/disable an FP cast optimization

As discussed in the post-commit thread for:
rL330437 ( http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180423/545906.html )

We need a way to opt-out of a float-to-int-to-float cast optimization because too much
existing code relies on the platform-specific undefined result of those casts when the
float-to-int overflows.

The LLVM changes associated with adding this function attribute are here:
rL330947
rL330950
rL330951

Also as suggested, I changed the LLVM doc to mention the specific sanitizer flag that
catches this problem:
rL330958

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

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

6 years ago[ARM,AArch64] Add intrinsics for dot product instructions
Oliver Stannard [Fri, 27 Apr 2018 14:03:32 +0000 (14:03 +0000)]
[ARM,AArch64] Add intrinsics for dot product instructions

The ACLE spec which describes these intrinsics hasn't been published yet, but
this is based on the final draft which will be published soon, and these have
already been implemented by GCC.

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

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

6 years ago[ARM] Add __ARM_FEATURE_DOTPROD pre-defined macro
Oliver Stannard [Fri, 27 Apr 2018 13:56:02 +0000 (13:56 +0000)]
[ARM] Add __ARM_FEATURE_DOTPROD pre-defined macro

This adds a pre-defined macro to test if the compiler has support for the
v8.2-A dot rpoduct intrinsics in AArch32 mode.

The AAcrh64 equivalent has already been added by rL330229.

The ACLE spec which describes this macro hasn't been published yet, but this is
based on the final internal draft, and GCC has already implemented this.

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

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

6 years ago[OpenCL] Add separate read_only and write_only pipe IR types
Sven van Haastregt [Fri, 27 Apr 2018 10:37:04 +0000 (10:37 +0000)]
[OpenCL] Add separate read_only and write_only pipe IR types

SPIR-V encodes the read_only and write_only access qualifiers of pipes,
so separate LLVM IR types are required to target SPIR-V.  Other backends
may also find this useful.

These new types are `opencl.pipe_ro_t` and `opencl.pipe_wo_t`, which
replace `opencl.pipe_t`.

This replaces __get_pipe_num_packets(...) and __get_pipe_max_packets(...)
which took a read_only pipe with separate versions for read_only and
write_only pipes, namely:

 * __get_pipe_num_packets_ro(...)
 * __get_pipe_num_packets_wo(...)
 * __get_pipe_max_packets_ro(...)
 * __get_pipe_max_packets_wo(...)

These separate versions exist to avoid needing a bitcast to one of the
two qualified pipe types.

Patch by Stuart Brady.

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

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

6 years agoMake MultiplexASTDeserializationListener part of the API [NFC]
Raphael Isemann [Fri, 27 Apr 2018 07:05:40 +0000 (07:05 +0000)]
Make MultiplexASTDeserializationListener part of the API [NFC]

Summary:
This patch moves the MultiplexASTDeserializationListener declaration into a public header.

We're currently using this multiplexer in the cling interpreter to attach another
ASTDeserializationListener during the execution (so, after the MultiplexConsumer is already
attached which prevents us from attaching more). So far we're doing this by patching clang
and making this class public, but it makes things easier if we make this instead just public in
upstream.

Reviewers: thakis, v.g.vassilev, rsmith, bruno

Reviewed By: bruno

Subscribers: llvm-commits, cfe-commits, v.g.vassilev

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

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

6 years ago[CodeGen] Avoid destructing a callee-destructued struct type in a
Akira Hatanaka [Fri, 27 Apr 2018 06:57:00 +0000 (06:57 +0000)]
[CodeGen] Avoid destructing a callee-destructued struct type in a
function if a function delegates to another function.

Fix a bug introduced in r328731, which caused a struct with ObjC __weak
fields that was passed to a function to be destructed twice, once in the
callee function and once in another function the callee function
delegates to. To prevent this, keep track of the callee-destructed
structs passed to a function and disable their cleanups at the point of
the call to the delegated function.

This reapplies r331016, which was reverted in r331019 because it caused
an assertion to fail in EmitDelegateCallArg on a windows bot. I made
changes to EmitDelegateCallArg so that it doesn't try to deactivate
cleanups for structs that have trivial destructors (cleanups for those
structs are never pushed to the cleanup stack in EmitParmDecl).

rdar://problem/39194693

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

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

6 years agoRevert "[CodeGen] Avoid destructing a callee-destructued struct type in a"
Akira Hatanaka [Fri, 27 Apr 2018 05:56:55 +0000 (05:56 +0000)]
Revert "[CodeGen] Avoid destructing a callee-destructued struct type in a"

This reverts commit r331016, which broke a windows bot.

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11727

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

6 years agoFix typo.
Richard Smith [Fri, 27 Apr 2018 04:27:26 +0000 (04:27 +0000)]
Fix typo.

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

6 years ago[CodeGen] Avoid destructing a callee-destructued struct type in a
Akira Hatanaka [Fri, 27 Apr 2018 04:21:51 +0000 (04:21 +0000)]
[CodeGen] Avoid destructing a callee-destructued struct type in a
function if a function delegates to another function.

Fix a bug introduced in r328731, which caused a struct with ObjC __weak
fields that was passed to a function to be destructed twice, once in the
callee function and once in another function the callee function
delegates to. To prevent this, keep track of the callee-destructed
structs passed to a function and disable their cleanups at the point of
the call to the delegated function.

rdar://problem/39194693

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

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

6 years ago[analyzer] Fix operator delete[] array-type-sub-expression handling.
Artem Dergachev [Fri, 27 Apr 2018 02:16:03 +0000 (02:16 +0000)]
[analyzer] Fix operator delete[] array-type-sub-expression handling.

Avoid crash when the sub-expression of operator delete[] is of array type.

This is not the same as simply using a delete[] syntax.

We're still not properly calling destructors in this case in the analyzer.

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

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

6 years agoParse A::template B as an identifier rather than as a template-id with no
Richard Smith [Fri, 27 Apr 2018 02:00:13 +0000 (02:00 +0000)]
Parse A::template B as an identifier rather than as a template-id with no
template arguments.

This fixes some cases where we'd incorrectly accept "A::template B" when B is a
kind of template that requires template arguments (in particular, a variable
template or a concept).

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

6 years ago[Driver] Don't enable "-fregister-global-dtors-with-atexit" by default
Akira Hatanaka [Fri, 27 Apr 2018 01:42:33 +0000 (01:42 +0000)]
[Driver] Don't enable "-fregister-global-dtors-with-atexit" by default
when compiling the kernel or kexts.

Destructors should be registered with atexit by default only when we are
compiling userland code.

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

6 years ago[x86] Revert r330322 (& r330323): Lowering x86 adds/addus/subs/subus intrinsics
Chandler Carruth [Thu, 26 Apr 2018 21:46:01 +0000 (21:46 +0000)]
[x86] Revert r330322 (& r330323): Lowering x86 adds/addus/subs/subus intrinsics

The LLVM commit introduces a crash in LLVM's instruction selection.

I filed http://llvm.org/PR37260 with the test case.

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

6 years ago[X86] Make __builtin_ia32_readeflags_u32 and __builtin_ia32_writeeflags_u32 only...
Craig Topper [Thu, 26 Apr 2018 20:14:46 +0000 (20:14 +0000)]
[X86] Make __builtin_ia32_readeflags_u32 and __builtin_ia32_writeeflags_u32 only available on 32-bit targets.

These builtins can't be handled by the backend on 64-bit targets. So error up front instead of throwing an isel error.

Fixes PR37225

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

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

6 years agoAdd getDeserializationListener to ASTReader
Yuka Takahashi [Thu, 26 Apr 2018 15:09:13 +0000 (15:09 +0000)]
Add getDeserializationListener to ASTReader

Summary:
We need to know if ASTReader already has a DeserializationListner or
not, and this also helps to create a multiplexing deserialization
listener if there is one already attached.

Reviewers: v.g.vassilev, rsmith, dblaikie, thakis

Subscribers: cfe-commits

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

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

6 years agoMake test more platform neutral
Serge Pavlov [Thu, 26 Apr 2018 08:08:25 +0000 (08:08 +0000)]
Make test more platform neutral

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

6 years ago[ConfigFiles] Update argument strings when merging argrument lists
Serge Pavlov [Thu, 26 Apr 2018 06:28:47 +0000 (06:28 +0000)]
[ConfigFiles] Update argument strings when merging argrument lists

Implementation of `InputArgList` assumes its field `ArgStrings` contains
strings for each argument exactly in the same order. This condition was
broken when arguments from config file and from invocation were merged.

This change fixes https://bugs.llvm.org/show_bug.cgi?id=37196 (Clang
config files can crash argument handling).

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

6 years ago[X86] Add support for _mm512_mullox_epi64 and _mm512_mask_mullox_epi64 intrinsics...
Craig Topper [Thu, 26 Apr 2018 05:38:39 +0000 (05:38 +0000)]
[X86] Add support for _mm512_mullox_epi64 and _mm512_mask_mullox_epi64 intrinsics to match icc.

On AVX512F targets we'll produce an emulated sequence using 3 pmuludqs with shifts and adds. On AVX512DQ we'll use vpmulld.

Fixes PR37140.

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

6 years agoDiagnose missing template arguments for a variable template even when there is
Richard Smith [Thu, 26 Apr 2018 02:10:22 +0000 (02:10 +0000)]
Diagnose missing template arguments for a variable template even when there is
a preceding 'template' keyword.

We only diagnose in the dependent case (wherein we used to crash). Another bug
prevents the diagnostic from appearing in the non-template case.

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

6 years agoRevert addition of 'concept' to diagnostics in r330890.
Richard Smith [Thu, 26 Apr 2018 01:16:08 +0000 (01:16 +0000)]
Revert addition of 'concept' to diagnostics in r330890.

Matches revert in r330888 of r330794.

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

6 years agoFactor out common code for diagnosing missing template arguments.
Richard Smith [Thu, 26 Apr 2018 01:08:00 +0000 (01:08 +0000)]
Factor out common code for diagnosing missing template arguments.

In passing, add 'concept' to the list of template kinds in diagnostics.

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

6 years agoFix a merge conflict that was inadvertently introduced in r330888
Faisal Vali [Thu, 26 Apr 2018 01:05:05 +0000 (01:05 +0000)]
Fix a merge conflict that was inadvertently introduced in r330888
- during the reversion of r330794

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

6 years agoRevert rC330794 and some dependent tiny bug fixes
Faisal Vali [Thu, 26 Apr 2018 00:42:40 +0000 (00:42 +0000)]
Revert rC330794 and some dependent tiny bug fixes

See Richard's humbling feedback here:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html

Wish I'd had the patience to solicit the feedback prior to committing :)

Sorry for the noise guys.

Thank you Richard for being the steward that clang deserves!

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

6 years agoSwitch to Clang's isDigit function.
Richard Trieu [Wed, 25 Apr 2018 23:50:55 +0000 (23:50 +0000)]
Switch to Clang's isDigit function.

std::isdigit can be overloaded, causing the template deduction to fail.  Use
Clang's isDigit function which to avoid this.  Switch the other calls for
consistency.

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

6 years agoInclude <cctype> to get std::isdigit, fixes MSVC STL build
Reid Kleckner [Wed, 25 Apr 2018 23:38:54 +0000 (23:38 +0000)]
Include <cctype> to get std::isdigit, fixes MSVC STL build

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

6 years ago[analyzer] Fix a crash on lifetime extension through aggregate initialization.
Artem Dergachev [Wed, 25 Apr 2018 23:02:06 +0000 (23:02 +0000)]
[analyzer] Fix a crash on lifetime extension through aggregate initialization.

If 'A' is a C++ aggregate with a reference field of type 'C', in code like
  A a = { C() };
C() is lifetime-extended by 'a'. The analyzer wasn't expecting this pattern and
crashing. Additionally, destructors aren't added in the CFG for this case,
so for now we shouldn't be inlining the constructor for C().

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

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

6 years agoFix crash on qualified template name instantiation if the template name has no
Richard Smith [Wed, 25 Apr 2018 22:58:55 +0000 (22:58 +0000)]
Fix crash on qualified template name instantiation if the template name has no
template argument list.

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

6 years ago[RISCV] More validations on the input value of -march=
Ana Pazos [Wed, 25 Apr 2018 22:42:38 +0000 (22:42 +0000)]
[RISCV] More validations on the input value of -march=

Supporting additional rules for parsing ISA string.

- RISC-V ISA strings must be lowercase.
E.g.: rv32IMC is not supported, rv32imc is correct.

- Multi-letter extensions are to be separated by a single
underscore '_'. The extension prefix counts as a letter.
This means extensions that start with 's', 'sx' and 'sx'
are all multi-letter.
E.g.:
xasb is a single non-standard extension named 'xasb'
xa_sb are two extensions, the non-standard user level extension
'xa', and the supervisor level extension 'sb'.

- Standard user-level extensions are specified following
a canonical order, according to Table 22.1 in
RISC-V User-Level ISA V2.2.

- Non-standard user-level 'x' extensions,
standard supervisor-level 's' extensions and
non-standard supervisor-level 'sx' extensions
are also specified following a canonical order according
to Table 22.1 in RISC-V User-Level ISA V2.2:
'x' extensions, follwed by 's' extensions and then 'sx' extensions.

- Extensions might have a version number.
Underscores may be used to separate ISA subset components to
improve readability and to provide disambiguation.
E.g.: rv32i2_m3_a1_f2_d2

- Version numbers are divided into major and minor numbers,
separated by a 'p'. If the minor version is 0, then 'p0' can
be omitted.

- Additional checks for dependent extensions and invalid
extensions combinations.
E.g.:
'e' requires rv32
'e' can't be combined with 'f' nor 'd'
'q' requires rv64

- TODO items have also been marked with comments in the code.

Reviewers: asb, kito-cheng

Reviewed By: asb

Subscribers: edward-jones, mgrang, zzheng, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, shiva0217, cfe-commits

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

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

6 years ago[driver][darwin] Do not infer -simulator environment for OS version env vars
Alex Lorenz [Wed, 25 Apr 2018 22:23:26 +0000 (22:23 +0000)]
[driver][darwin] Do not infer -simulator environment for OS version env vars
with non-simulator SDKs

rdar://37955008

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

6 years ago[analyzer] Enable analysis of WebKit "unified sources".
Artem Dergachev [Wed, 25 Apr 2018 21:51:26 +0000 (21:51 +0000)]
[analyzer] Enable analysis of WebKit "unified sources".

Normally the analyzer begins path-sensitive analysis from functions within
the main file, even though the path is allowed to go through any functions
within the translation unit.

When a recent version of WebKit is compiled, the "unified sources" technique
is used, that assumes #including multiple code files into a single main file.
Such file would have no functions defined in it, so the analyzer wouldn't be
able to find any entry points for path-sensitive analysis.

This patch pattern-matches unified file names that are similar to those
used by WebKit and allows the analyzer to find entry points in the included
code files. A more aggressive/generic approach is being planned as well.

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

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

6 years ago[Driver] Reland "Android triples are not aliases for other triples."
Dan Albert [Wed, 25 Apr 2018 21:26:06 +0000 (21:26 +0000)]
[Driver] Reland "Android triples are not aliases for other triples."

Fixed directory separators in tests to be compatible with both
Windows and !Windows.

This reverts commit aa423850afa4c16a53c4c492fe254dcad3d5a53e.

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

6 years ago[test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.
Martin Storsjo [Wed, 25 Apr 2018 21:24:04 +0000 (21:24 +0000)]
[test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.

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

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

6 years ago[Driver] Fix implicit config files from prefixed symlinks
Martin Storsjo [Wed, 25 Apr 2018 21:23:59 +0000 (21:23 +0000)]
[Driver] Fix implicit config files from prefixed symlinks

If -no-canonical-prefixes isn't used, the clang executable name used
is the one of the actual executable, not the name of the symlink that
the user invoked.

In these cases, the target prefix was overridden based on the clang
executable name. (On the other hand the implicit -target option
that such a symlink adds, is added as an actual command line parameter
in tools/driver/driver.cop, before resolving the symlink and finding
the actual clang executable.

Use the original ClangNameParts (set from argv[0] in
tools/driver/driver.cpp) if it seems to be initialized propery.

All existing tests of this feature used -no-canonical-prefixes
(possibly because it also makes the driver look in the directory
of the symlink instead of the directory of the executable); add
another one that uses --config-user-dir= to specify the directory
instead. (For actual users of such symlinks, outisde of the test
suite, the directory is probably the same for both.)

This makes this feature work more like what the documentation
describes.

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

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

6 years ago[TargetInfo] Sort target features before passing them to the backend
Eli Friedman [Wed, 25 Apr 2018 19:14:05 +0000 (19:14 +0000)]
[TargetInfo] Sort target features before passing them to the backend

Passing the features in random order will lead to unpredictable results
when some of the features are related (like the architecture-version
features on ARM).

It might be possible to fix this particular case in the ARM target code,
to avoid adding overlapping target features. But we should probably be
sorting in any case: the behavior shouldn't depend on StringMap's
hashing algorithm.

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

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

6 years ago[CMake] Enable libc++ for Fuchsia toolchain on Darwin
Petr Hosek [Wed, 25 Apr 2018 18:30:55 +0000 (18:30 +0000)]
[CMake] Enable libc++ for Fuchsia toolchain on Darwin

This is necessary in order to get a working C++ compiler on Darwin
since Clang expects libc++ headers to be part of the toolchain.

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

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

6 years ago[ASTImporter] FriendDecl importing improvements
Peter Szecsi [Wed, 25 Apr 2018 17:28:03 +0000 (17:28 +0000)]
[ASTImporter] FriendDecl importing improvements

There are only a few cases of importing a frienddecl which is currently supported.
This patch aims to improve the friend import process.
Set FriendObjectKind in case of decls, insert friend into the friend chain
correctly, checks structurally equivalent in a more advanced manner.
Test cases added as well.

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

6 years ago[Builtins] Fix typos in a comment. NFC
Craig Topper [Wed, 25 Apr 2018 16:57:46 +0000 (16:57 +0000)]
[Builtins] Fix typos in a comment. NFC

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

6 years agoMake add_clang_unittest formatting a bit more consistent.
Nico Weber [Wed, 25 Apr 2018 16:20:43 +0000 (16:20 +0000)]
Make add_clang_unittest formatting a bit more consistent.

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

6 years ago[CodeComplete] Fix completion in the middle of ident in ctor lists.
Ilya Biryukov [Wed, 25 Apr 2018 15:13:34 +0000 (15:13 +0000)]
[CodeComplete] Fix completion in the middle of ident in ctor lists.

Summary:
The example that was broken before (^ designates completion points):

    class Foo {
      Foo() : fie^ld^() {} // no completions were provided here.
      int field;
    };

To fix it we don't cut off lexing after an identifier followed by code
completion token is lexed. Instead we skip the rest of identifier and
continue lexing.
This is consistent with behavior of completion when completion token is
right before the identifier.

Reviewers: sammccall, aaron.ballman, bkramer, sepavloff, arphaman, rsmith

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Start formatting cpp code in raw strings in google style
Krasimir Georgiev [Wed, 25 Apr 2018 14:56:19 +0000 (14:56 +0000)]
[clang-format] Start formatting cpp code in raw strings in google style

Summary: This adds some delimiters to detect cpp code in raw strings.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

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

6 years ago[HIP] Add predefined macros __HIPCC__ and __HIP_DEVICE_COMPILE__
Yaxun Liu [Wed, 25 Apr 2018 13:33:19 +0000 (13:33 +0000)]
[HIP] Add predefined macros __HIPCC__ and __HIP_DEVICE_COMPILE__

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

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

6 years agoFix failure in lit test kernel-call.cu due to name mangling
Yaxun Liu [Wed, 25 Apr 2018 13:07:58 +0000 (13:07 +0000)]
Fix failure in lit test kernel-call.cu due to name mangling

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

6 years agoadd check for long double for __builtin_dump_struct
Paul Semel [Wed, 25 Apr 2018 10:09:20 +0000 (10:09 +0000)]
add check for long double for __builtin_dump_struct

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

6 years agoFix buildbot problems after rC330794
Bjorn Pettersson [Wed, 25 Apr 2018 09:04:12 +0000 (09:04 +0000)]
Fix buildbot problems after rC330794

Avoiding
  error: no matching function for call to 'makeArrayRef'
at
  ../tools/clang/lib/Parse/ParseTemplate.cpp:373:17

By using a local C array as input to makeArrayRef.

Not sure if this is the best solution, but it makes the code
compile again.

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

6 years ago[NFC] Make dependent parameter non-deducible, so that we are forced to use the defaul...
Faisal Vali [Wed, 25 Apr 2018 03:54:20 +0000 (03:54 +0000)]
[NFC] Make dependent parameter non-deducible, so that we are forced to use the default template parameter.

This might provide users with more graceful diagnostics if they should ever try and call this function with non-ConceptDecls.

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

6 years agoFix rC330794 - a parameter that should have been dependent was inadvertently not -
Faisal Vali [Wed, 25 Apr 2018 03:28:23 +0000 (03:28 +0000)]
Fix rC330794 - a parameter that should have been dependent was inadvertently not -
 and compiled in MSVC - but not so for the other bots.

The fix was to make it dependent as intended.

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

6 years agoFix lit test kernel-call.cu failure on ps4 due to dso_local
Yaxun Liu [Wed, 25 Apr 2018 03:16:07 +0000 (03:16 +0000)]
Fix lit test kernel-call.cu failure on ps4 due to dso_local

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

6 years ago[c++2a] [concepts] Add rudimentary parsing support for template concept declarations
Faisal Vali [Wed, 25 Apr 2018 02:42:26 +0000 (02:42 +0000)]
[c++2a] [concepts] Add rudimentary parsing support for template concept declarations

This patch is a tweak of changyu's patch: https://reviews.llvm.org/D40381. It differs in that the recognition of the 'concept' token is moved into the machinery that recognizes declaration-specifiers - this allows us to leverage the attribute handling machinery more seamlessly.

See the test file to get a sense of the basic parsing that this patch supports.

There is much more work to be done before concepts are usable...

Thanks Changyu!

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

6 years agoFix failure in lit test kernel-call.cu
Yaxun Liu [Wed, 25 Apr 2018 02:34:04 +0000 (02:34 +0000)]
Fix failure in lit test kernel-call.cu

There is signext on ppc64. Just remove check for function argument.

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

6 years ago[HIP] Add hip input kind and codegen for kernel launching
Yaxun Liu [Wed, 25 Apr 2018 01:10:37 +0000 (01:10 +0000)]
[HIP] Add hip input kind and codegen for kernel launching

HIP is a language similar to CUDA (https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_kernel_language.md ).
The language syntax is very similar, which allows a hip program to be compiled as a CUDA program by Clang. The main difference
is the host API. HIP has a set of vendor neutral host API which can be implemented on different platforms. Currently there is open source
implementation of HIP runtime on amdgpu target (https://github.com/ROCm-Developer-Tools/HIP).

This patch adds support of input kind and language standard hip.

When hip file is compiled, both LangOpts.CUDA and LangOpts.HIP is turned on. This allows compilation of hip program as CUDA
in most cases and only special handling of hip program is needed LangOpts.HIP is checked.

This patch also adds support of kernel launching of HIP program using HIP host API.

When -x hip is not specified, there is no behaviour change for CUDA.

Patch by Greg Rodgers.
Revised and lit test added by Yaxun Liu.

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

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

6 years ago[ODRHash] Hash template arguments of methods.
Richard Trieu [Wed, 25 Apr 2018 00:31:15 +0000 (00:31 +0000)]
[ODRHash] Hash template arguments of methods.

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

6 years agoRevert "[Driver] Android triples are not aliases for other triples."
Dan Albert [Tue, 24 Apr 2018 22:06:40 +0000 (22:06 +0000)]
Revert "[Driver] Android triples are not aliases for other triples."

Revering while I diagnose the failures.

This reverts commit 82dc3bf2157da280420f80e654292cb05e0dc5f7.

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

6 years ago[Driver] Android triples are not aliases for other triples.
Dan Albert [Tue, 24 Apr 2018 21:18:37 +0000 (21:18 +0000)]
[Driver] Android triples are not aliases for other triples.

Summary:
Android targets should never use tools/libraries for non-Android
targets or vice versa.

Reviewers: srhines, george.burgess.iv, eugenis

Reviewed By: eugenis

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Add support for the note diagnostic pieces to plist output format.
Artem Dergachev [Tue, 24 Apr 2018 20:45:48 +0000 (20:45 +0000)]
[analyzer] Add support for the note diagnostic pieces to plist output format.

Note diagnostic pieces are an additional way of highlighting code sections to
the user. They aren't part of the normal path diagnostic sequence. They can
also be attached to path-insensitive reports.

Notes are already supported by the text output and scan-build.

Expanding our machine-readable plist output format to be able to represent notes
opens up the possibility for various analyzer GUIs to pick them up.

Patch by Umann Kristóf!

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

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

6 years agoImprove -Warray-bounds to handle multiple array extents rather than only handling...
Aaron Ballman [Tue, 24 Apr 2018 19:21:04 +0000 (19:21 +0000)]
Improve -Warray-bounds to handle multiple array extents rather than only handling the top-most array extent.

Patch by Bevin Hansson.

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

6 years ago[CUDA] Enable CUDA compilation with CUDA-9.2
Artem Belevich [Tue, 24 Apr 2018 18:23:19 +0000 (18:23 +0000)]
[CUDA] Enable CUDA compilation with CUDA-9.2

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

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

6 years ago[HWASan] Update HWASan assembly snippet in the docs
Alex Shlyapnikov [Tue, 24 Apr 2018 17:41:48 +0000 (17:41 +0000)]
[HWASan] Update HWASan assembly snippet in the docs

Summary: To complement https://reviews.llvm.org/D45840

Reviewers: eugenis

Subscribers: cfe-commits

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

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

6 years ago[X86] Add recently added intrinsic headers to the module map.
Craig Topper [Tue, 24 Apr 2018 17:40:49 +0000 (17:40 +0000)]
[X86] Add recently added intrinsic headers to the module map.

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

6 years ago[X86] Consistently use double underscore at the beginning of the include guards in...
Craig Topper [Tue, 24 Apr 2018 17:40:47 +0000 (17:40 +0000)]
[X86] Consistently use double underscore at the beginning of the include guards in our intrinsic headers.

Most files used double underscore, but a few used single. This converges them all to double.

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

6 years ago[Attr] Print enum attributes at correct position
Joel E. Denny [Tue, 24 Apr 2018 14:50:23 +0000 (14:50 +0000)]
[Attr] Print enum attributes at correct position

For example, given:

  void fn() {
    enum __attribute__((deprecated)) T *p;
  }

-ast-print produced:

  void fn() {
    enum T __attribute__((deprecated(""))) *p;
  }

-ast-print on that produced:

  void fn() {
    enum T *p __attribute__((deprecated("")));
  }

The attribute is on enum T in the first case, but it's on p in the
other cases.

Details:

Within enum declarations, enum attributes were always printed after
the tag and any member list.  When no member list was present but the
enum was a type specifier in a variable declaration, the attribute
then applied to the variable not the enum, changing the semantics.

This patch fixes that by always printing attributes between the enum's
keyword and tag, as clang already does for structs, unions, and
classes.

Reviewed By: rsmith

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

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

6 years ago[OpenCL] Fix diagnostic of thread_local
Sven van Haastregt [Tue, 24 Apr 2018 14:47:29 +0000 (14:47 +0000)]
[OpenCL] Fix diagnostic of thread_local

Commit 08c258670c ("[OpenCL] Generic address space has been added in
OpenCL v2.0.", 2014-11-26) did not mark the thread_local keyword as a
storage class specifier, whereas it did mark _Thread_local as such.
According to the C++14 spec s7.1.1, thread_local is a storage class
specifier, so mark it as such.

I will add a test for this in a follow-up commit that adds keyword
restrictions to the OpenCL C++ language mode.

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

6 years ago[CodeComplete] Fix completion at the end of keywords
Ilya Biryukov [Tue, 24 Apr 2018 13:48:53 +0000 (13:48 +0000)]
[CodeComplete] Fix completion at the end of keywords

Summary:
Make completion behave consistently no matter if it is run at the
start, in the middle or at the end of an identifier that happens to
be a keyword or a macro name. Since completion is often ran on
incomplete identifiers, they may turn into keywords by accident.

For example, we should produce same results for all of these
completion points:

    // ^ is completion point.
    ^class
    cla^ss
    class^

Previously clang produced different results for the last case (as if
the completion point was after a space: `class ^`).

This change also updates some offsets in tests that (unintentionally?)
relied on the old behavior.

Reviewers: sammccall, bkramer, arphaman, aaron.ballman

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

6 years ago[GCC] Don't keep a StringRef to a temporary std::string
Martin Storsjo [Tue, 24 Apr 2018 11:57:02 +0000 (11:57 +0000)]
[GCC] Don't keep a StringRef to a temporary std::string

This fixes failures in asan builds and possibly other buildbots
as well, after SVN r330696.

Prior to that revision, the std::string was stored in another
variable, before assigning to a StringRef.

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

6 years ago[ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous...
Aleksei Sidorin [Tue, 24 Apr 2018 10:11:53 +0000 (10:11 +0000)]
[ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous decls

This patch introduces the ability to test an arbitrary sequence of imports
between a given set of virtual source files. This should finally allow
us to write simple tests and fix annoying issues inside ASTImporter
that cause failures in CSA CTU. This is done by refactoring
ASTImporterTest functions and introducing `testImportSequence` facility.
As a side effect, `testImport` facility was generalized a bit more. It
should now allow import of non-decl AST nodes; however, there is still no
test using this ability.

As a "test for test", there is also a fix for import anonymous TagDecls
referred by typedef. Before this patch, the setting of typedef for anonymous
structure was delayed; however, this approach misses the corner case if
an enum constant is imported directly. In this patch, typedefs for
anonymous declarations are imported right after the anonymous declaration
is imported, without any delay.

Thanks to Adam Balogh for suggestions included into this patch.

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

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

6 years ago[GCC] Match a GCC version with a patch suffix without a third version component
Martin Storsjo [Tue, 24 Apr 2018 08:50:11 +0000 (08:50 +0000)]
[GCC] Match a GCC version with a patch suffix without a third version component

Previously it would only accept a string as a GCC version if it had
either two components and no suffix, or three components with an
optional suffix.

Debian and ubuntu provided mingw compilers have lib/gcc/target entries
like "5.3-posix" and "5.3-win32". This doesn't try to make any specific
preference between them (other than lexical sorting of the suffix).

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

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

6 years ago[test] Fix a typo in a test directory name. NFC.
Martin Storsjo [Tue, 24 Apr 2018 08:49:57 +0000 (08:49 +0000)]
[test] Fix a typo in a test directory name. NFC.

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

6 years agoLink to AggressiveInstCombine in a few places. Unbreaks build for me.
Roman Lebedev [Tue, 24 Apr 2018 08:40:44 +0000 (08:40 +0000)]
Link to AggressiveInstCombine in a few places. Unbreaks build for me.

/usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass()
>>> referenced by cc1_main.cpp
>>>               tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp)

And so on

The bot coverage is clearly missing.

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

6 years ago[libclang] Only mark CXCursors for explicit attributes with a type
Erik Verbruggen [Tue, 24 Apr 2018 08:39:46 +0000 (08:39 +0000)]
[libclang] Only mark CXCursors for explicit attributes with a type

All attributes have a source range associated with it. However, implicit
attributes are added by the compiler, and not added because the user
wrote something in the input. So no token type should be set to
CXCursor_*Attr.

The problem was visible when a class gets marked by e.g.
MSInheritanceAttr, which has the full CXXRecordDecl's range as its
own range. The effect of marking that range as CXCursor_UnexposedAttr
was that all cursors for the record decl, including all child decls,
would become CXCursor_UnexposedAttr.

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

6 years ago[AST] Another attempt at fixing the ARM bots.
Benjamin Kramer [Tue, 24 Apr 2018 08:18:32 +0000 (08:18 +0000)]
[AST] Another attempt at fixing the ARM bots.

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

6 years ago[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.
Benjamin Kramer [Tue, 24 Apr 2018 07:53:10 +0000 (07:53 +0000)]
[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.

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

6 years ago[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.
Craig Topper [Tue, 24 Apr 2018 03:36:08 +0000 (03:36 +0000)]
[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.

The unmasked versions already didn't have this restrction. I don't think gcc or icc limit these to 64-bit mode so we shouldn't either.

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

6 years agoMake add_clang_tool() formatting a bit more consistent.
Nico Weber [Tue, 24 Apr 2018 01:30:44 +0000 (01:30 +0000)]
Make add_clang_tool() formatting a bit more consistent.

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

6 years agoFix build break due to content moving from Scalar.h to InstCombine.h in LLVM
David Blaikie [Tue, 24 Apr 2018 00:59:22 +0000 (00:59 +0000)]
Fix build break due to content moving from Scalar.h to InstCombine.h in LLVM

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

6 years ago[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_...
Craig Topper [Mon, 23 Apr 2018 22:18:36 +0000 (22:18 +0000)]
[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_64.def.

The 32-bit refers to their input/output type, but the instructions are only available in 64-bit mode.

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

6 years ago[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_6...
Craig Topper [Mon, 23 Apr 2018 22:18:34 +0000 (22:18 +0000)]
[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_64.def to make them unavailable in 32-bit mode.

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