Commit Graph

73305 Commits

Author SHA1 Message Date
Volodymyr Sapsai 210f0e880b Track skipped files in dependency scanning.
It's possible for a header to be a symlink to another header. In this
case both will be represented by clang::FileEntry with the same UID and
they'll use the same clang::HeaderFileInfo.

If you include both headers and use some single-inclusion mechanism
like a header guard or #import, one header will get a FileChanged
callback, and another FileSkipped.

So that we get an accurate dependency file, we therefore need to also
implement the FileSkipped callback in dependency scanning.

Patch by Pete Cooper.

Reviewers: bruno, pete

Reviewed By: bruno

Subscribers: cfe-commits, jkorous, vsapsai

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

llvm-svn: 331319
2018-05-01 23:59:33 +00:00
Douglas Yung ddbd2b530c This test fails if there is no integrated assembler, so change the -c option to -S as it is not important to the test and allows it to pass when there is no integrated assembler.
llvm-svn: 331318
2018-05-01 23:32:09 +00:00
Shoaib Meenai 82415e2614 [libclang] Fix the type of 'int (Foo);'
libclang exposes the type of 'int (Foo);' (a global variable of type int
called Foo) as CXType_Unexposed. This is because Clang represents Foo's
type as ParenType{BuiltinType{Int}}, and libclang does not handle
ParenType.

Make libclang return CXType_Int as the type of 'int (Foo);' by
unwrapping ParenType transparently.

Patch by Matt Glazar.

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

llvm-svn: 331306
2018-05-01 20:45:25 +00:00
Shoaib Meenai c4cf3daad8 [ARM] Remove redundant #if in test. NFC
Both sides of this #if #include the same file. Drop the #if, leaving only the #include.

Patch by Matt Glazar.

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

llvm-svn: 331305
2018-05-01 20:38:05 +00:00
Richard Smith 32ac816fff Fix bogus MSVC char8_t mangling.
This appears to have been caused by a bad automatic svn merge with r330225
attaching the 'case' label to the wrong block of code. :(

llvm-svn: 331299
2018-05-01 18:50:15 +00:00
Saleem Abdulrasool e5f3cf824f Driver: fix an assertion with `-print-prog-name=`
Fix an assertion when -print-prog-name= is invoked without parameter.
Returns an empty string.

Patch by Christian Bruel!

llvm-svn: 331296
2018-05-01 18:40:42 +00:00
Danil Malyshev cd3fd82da3 Update existed CodeGen TBAA tests
Reviewers: hfinkel, kosarev, rjmccall

Reviewed By: rjmccall

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

llvm-svn: 331292
2018-05-01 18:14:36 +00:00
Erich Keane 14c1085317 Add Microsoft Mangling for OpenCL Half Type
Half-type mangling is accomplished following the method introduced by Erich 
Keane for mangling _Float16. Updated the half.cl LIT test to cover this 
particular case.

Patch By: vbridgers

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

llvm-svn: 331263
2018-05-01 14:16:15 +00:00
Alexey Bataev fb38828cb2 [OPENMP] Emit template instatiation|specialization functions for
devices.

If the function is an instantiation|specialization of the template and
is used in the device code, the definitions of such functions should be
emitted for the device.

llvm-svn: 331261
2018-05-01 14:09:46 +00:00
Gabor Buella a51e0c2243 [X86] directstore and movdir64b intrinsics
Reviewers: spatel, craig.topper, RKSimon

Reviewed By: craig.topper

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

llvm-svn: 331249
2018-05-01 10:05:42 +00:00
Chandler Carruth abb22405e6 Fix up r331244 - the emitted definition is weak_odr linkage. Should get
the build bots to healthy again without a full revert. As the
functionality added has nothing to do with linkage this seems unlikely
to represent a deep or interesting bug in the patch.

llvm-svn: 331245
2018-05-01 06:48:30 +00:00
Richard Smith 3a8244df6f Implement P0482R2, support for char8_t type.
This is not yet part of any C++ working draft, and so is controlled by the flag
-fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a
flag with the same name.)

This implementation is experimental, and will be removed or revised
substantially to match the proposal as it makes its way through the C++
committee.

llvm-svn: 331244
2018-05-01 05:02:45 +00:00
Kostya Serebryany d5dc819a5c [ShadowCallStack] fix the docs
llvm-svn: 331238
2018-05-01 00:15:56 +00:00
Bruno Cardoso Lopes 763cd2a98a [Modules] Fix testcases from r331232
llvm-svn: 331233
2018-04-30 22:57:02 +00:00
Bruno Cardoso Lopes 85f87dd91a [Modules] Handle ObjC/C ODR-like semantics for EnumConstantDecl
Support for ObjC/C ODR-like semantics with structural equivalence
checking was added back in r306918. There enums are handled and also
checked for structural equivalence. However, at use time of
EnumConstantDecl, support was missing for preventing ambiguous
name lookup.

Add the missing bits for properly merging EnumConstantDecl.

rdar://problem/38374569

llvm-svn: 331232
2018-04-30 22:14:29 +00:00
Craig Topper 13d759f87e [CodeGen] Fix typo in comment form->from. NFC
llvm-svn: 331231
2018-04-30 22:02:48 +00:00
Fangrui Song 5dfb61a1b6 [docs] Fix docs/InternalsManual.rst heading.
llvm-svn: 331225
2018-04-30 20:51:50 +00:00
Nirav Dave 6c0665e221 [MC] Change AsmParser to leverage Assembler during evaluation
Teach AsmParser to check with Assembler for when evaluating constant
expressions.  This improves the handing of preprocessor expressions
that must be resolved at parse time. This idiom can be found as
assembling-time assertion checks in source-level assemblers. Note that
this relies on the MCStreamer to keep sufficient tabs on Section /
Fragment information which the MCAsmStreamer does not. As a result the
textual output may fail where the equivalent object generation would
pass. This can most easily be resolved by folding the MCAsmStreamer
and MCObjectStreamer together which is planned for in a separate
patch.

Currently, this feature is only enabled for assembly input, keeping IR
compilation consistent between assembly and object generation.

Reviewers: echristo, rnk, probinson, espindola, peter.smith

Reviewed By: peter.smith

Subscribers: eraman, peter.smith, arichardson, jyknight, hiraditya, llvm-commits

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

llvm-svn: 331218
2018-04-30 19:22:40 +00:00
Matt Arsenault d2da3c20d7 AMDGPU: Add Vega12 and Vega20
Changes by
  Matt Arsenault
  Konstantin Zhuravlyov

llvm-svn: 331216
2018-04-30 19:08:27 +00:00
Hans Wennborg 45c7205b61 clang-cl: Expose -fmerge-all-constants
Now that constant merging is off by default, we'd like a way to enable
it on Windows.

llvm-svn: 331214
2018-04-30 19:04:04 +00:00
Alexey Bataev d0df36a79a [OPENMP] Do not emit warning about non-declared target function params.
We should not emit warning that the parameters are not marked as declare
target, these declaration are local and cannot be marked as declare
target.

llvm-svn: 331211
2018-04-30 18:28:08 +00:00
Sanjay Patel c81450e29b [Driver, CodeGen] rename options to disable an FP cast optimization
As suggested in the post-commit thread for rL331056, we should match these 
clang options with the established vocabulary of the corresponding sanitizer
option. Also, the use of 'strict' is well-known for these kinds of knobs, 
and we can improve the descriptive text in the docs.

So this intends to match the logic of D46135 but only change the words.
Matching LLVM commit to match this spelling of the attribute to follow shortly.

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

llvm-svn: 331209
2018-04-30 18:19:03 +00:00
Alexander Kornienko 395ab2e212 Regenerated AST Matchers doc.
Backported a minor fix to the comment in the header.

llvm-svn: 331207
2018-04-30 18:12:15 +00:00
Alexey Bataev dadf2d1238 [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.

llvm-svn: 331206
2018-04-30 18:09:40 +00:00
Alexey Bataev 64e62dcfff [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.

llvm-svn: 331195
2018-04-30 16:26:57 +00:00
Nico Weber d637c05986 IWYU for llvm-config.h in clang. See r331124 for details.
llvm-svn: 331177
2018-04-30 13:52:15 +00:00
Nico Weber cf512ab5f6 Remove unnecessary indirection. No behavior change.
llvm-svn: 331176
2018-04-30 13:47:04 +00:00
Mikhail Maltsev 89f7b46b7a [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

llvm-svn: 331164
2018-04-30 09:11:08 +00:00
Richard Smith b5f8171a1b 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).

llvm-svn: 331155
2018-04-30 05:25:48 +00:00
Fangrui Song 0f587e5387 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397.
llvm-svn: 331152
2018-04-30 00:34:09 +00:00
Richard Smith d186829093 Fix printing of reference-to-reference types.
Previously we would sometimes print these as 'T &&&' or even 'T &&&&'.

llvm-svn: 331137
2018-04-29 05:33:38 +00:00
Richard Smith 4ae767ba3d 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

llvm-svn: 331136
2018-04-29 04:55:46 +00:00
Nico Weber 0c3984ef31 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.

llvm-svn: 331124
2018-04-28 23:48:36 +00:00
Erik Pilkington e7e8772446 [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

llvm-svn: 331098
2018-04-28 02:40:28 +00:00
Artem Dergachev 03283ae9b7 [analyzer] CStringChecker: Add support for BSD strlcpy() and strlcat().
Patch by David Carlier!

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

llvm-svn: 331096
2018-04-27 23:50:55 +00:00
Reid Kleckner 1c0a0da62e Fix diag-format test to not care about what cl.exe is on path
llvm-svn: 331093
2018-04-27 22:32:21 +00:00
Artem Dergachev befce13328 [analyzer] ObjCAutoreleaseWrite: Support a few more APIs and fix warning text.
API list and improved warning text composed by Devin Coughlin.

llvm-svn: 331089
2018-04-27 22:00:51 +00:00
Nico Weber 6bc635ef56 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.

llvm-svn: 331077
2018-04-27 20:29:57 +00:00
Nico Weber 1865df4996 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.

llvm-svn: 331069
2018-04-27 19:11:14 +00:00
Ben Hamilton 345f8739d8 [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

llvm-svn: 331067
2018-04-27 18:51:12 +00:00
Bruno Cardoso Lopes fbff2fafb3 [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

llvm-svn: 331063
2018-04-27 18:01:23 +00:00
Sanjay Patel c1ecbf261f [docs] more dashes
llvm-svn: 331057
2018-04-27 16:24:39 +00:00
Sanjay Patel cee47befe4 [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.

llvm-svn: 331056
2018-04-27 16:21:22 +00:00
Nirav Dave 6b01b88012 [MC] Undo spurious commit added into r331052.
llvm-svn: 331055
2018-04-27 16:16:06 +00:00
Stuart Brady a38f573ad0 Test commit removing trailing whitespace
llvm-svn: 331053
2018-04-27 16:11:56 +00:00
Nirav Dave 38b4b54a2c [MC] Provide default value for IsResolved.
llvm-svn: 331052
2018-04-27 16:11:24 +00:00
Nirav Dave 1b5533c9e8 [MC] Modify MCAsmStreamer to always build MCAssembler. NFCI.
llvm-svn: 331048
2018-04-27 15:45:54 +00:00
Sanjay Patel d175476566 [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

llvm-svn: 331041
2018-04-27 14:22:48 +00:00
Oliver Stannard 2fcee8bd52 [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

llvm-svn: 331039
2018-04-27 14:03:32 +00:00
Oliver Stannard 39ee9de64c [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

llvm-svn: 331038
2018-04-27 13:56:02 +00:00
Sven van Haastregt 4700faa28e [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

llvm-svn: 331026
2018-04-27 10:37:04 +00:00
Raphael Isemann 0d24edab02 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

llvm-svn: 331021
2018-04-27 07:05:40 +00:00
Akira Hatanaka ccda3d2970 [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

llvm-svn: 331020
2018-04-27 06:57:00 +00:00
Akira Hatanaka b4f3637cec 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

llvm-svn: 331019
2018-04-27 05:56:55 +00:00
Richard Smith 3b8ccd5dbc Fix typo.
llvm-svn: 331017
2018-04-27 04:27:26 +00:00
Akira Hatanaka e712374496 [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

llvm-svn: 331016
2018-04-27 04:21:51 +00:00
Artem Dergachev 4fbd97e183 [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

llvm-svn: 331014
2018-04-27 02:16:03 +00:00
Richard Smith c08b693e30 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).

llvm-svn: 331013
2018-04-27 02:00:13 +00:00
Akira Hatanaka 18db58e7c7 [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.

llvm-svn: 331010
2018-04-27 01:42:33 +00:00
Chandler Carruth 16429acacb [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.

llvm-svn: 330997
2018-04-26 21:46:01 +00:00
Craig Topper 51738f834e [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

llvm-svn: 330987
2018-04-26 20:14:46 +00:00
Yuka Takahashi 4f38ffa63c 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

llvm-svn: 330946
2018-04-26 15:09:13 +00:00
Serge Pavlov db31e7a582 Make test more platform neutral
llvm-svn: 330927
2018-04-26 08:08:25 +00:00
Serge Pavlov f015a56761 [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).

llvm-svn: 330926
2018-04-26 06:28:47 +00:00
Craig Topper e95bde33df [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.

llvm-svn: 330923
2018-04-26 05:38:39 +00:00
Richard Smith 04100943da 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.

llvm-svn: 330894
2018-04-26 02:10:22 +00:00
Richard Smith 53cb831172 Revert addition of 'concept' to diagnostics in r330890.
Matches revert in r330888 of r330794.

llvm-svn: 330891
2018-04-26 01:16:08 +00:00
Richard Smith ecad88d2bb Factor out common code for diagnosing missing template arguments.
In passing, add 'concept' to the list of template kinds in diagnostics.

llvm-svn: 330890
2018-04-26 01:08:00 +00:00
Faisal Vali 2ee366d30e Fix a merge conflict that was inadvertently introduced in r330888
- during the reversion of r330794

llvm-svn: 330889
2018-04-26 01:05:05 +00:00
Faisal Vali a534f07f8c 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!

llvm-svn: 330888
2018-04-26 00:42:40 +00:00
Richard Trieu 563296abd8 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.

llvm-svn: 330887
2018-04-25 23:50:55 +00:00
Reid Kleckner f0562390e2 Include <cctype> to get std::isdigit, fixes MSVC STL build
llvm-svn: 330886
2018-04-25 23:38:54 +00:00
Artem Dergachev 310bca0178 [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

llvm-svn: 330882
2018-04-25 23:02:06 +00:00
Richard Smith 0bf96f933a Fix crash on qualified template name instantiation if the template name has no
template argument list.

llvm-svn: 330881
2018-04-25 22:58:55 +00:00
Ana Pazos c85505450a [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

llvm-svn: 330880
2018-04-25 22:42:38 +00:00
Alex Lorenz 76661e0f36 [driver][darwin] Do not infer -simulator environment for OS version env vars
with non-simulator SDKs

rdar://37955008

llvm-svn: 330878
2018-04-25 22:23:26 +00:00
Artem Dergachev 516837f2a1 [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

llvm-svn: 330876
2018-04-25 21:51:26 +00:00
Dan Albert ed8b8fdcc2 [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.

llvm-svn: 330873
2018-04-25 21:26:06 +00:00
Martin Storsjo aadc1c8ba0 [test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.
Differential Revision: https://reviews.llvm.org/D45985

llvm-svn: 330872
2018-04-25 21:24:04 +00:00
Martin Storsjo 1fab23da1c [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

llvm-svn: 330871
2018-04-25 21:23:59 +00:00
Eli Friedman e54d0ff400 [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

llvm-svn: 330861
2018-04-25 19:14:05 +00:00
Petr Hosek 17fdef6606 [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

llvm-svn: 330855
2018-04-25 18:30:55 +00:00
Peter Szecsi b180eebed4 [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.  

llvm-svn: 330847
2018-04-25 17:28:03 +00:00
Craig Topper b6dcc57ad1 [Builtins] Fix typos in a comment. NFC
llvm-svn: 330842
2018-04-25 16:57:46 +00:00
Nico Weber f3e043f67b Make add_clang_unittest formatting a bit more consistent.
llvm-svn: 330839
2018-04-25 16:20:43 +00:00
Ilya Biryukov ef4ece75fd [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

llvm-svn: 330833
2018-04-25 15:13:34 +00:00
Krasimir Georgiev 5559cc3b75 [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

llvm-svn: 330832
2018-04-25 14:56:19 +00:00
Yaxun Liu 9061e4f486 [HIP] Add predefined macros __HIPCC__ and __HIP_DEVICE_COMPILE__
Differential Revision: https://reviews.llvm.org/D45441

llvm-svn: 330824
2018-04-25 13:33:19 +00:00
Yaxun Liu 48390a992f Fix failure in lit test kernel-call.cu due to name mangling
llvm-svn: 330821
2018-04-25 13:07:58 +00:00
Paul Semel 80daae2736 add check for long double for __builtin_dump_struct
llvm-svn: 330808
2018-04-25 10:09:20 +00:00
Bjorn Pettersson 3dd22c9898 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.

llvm-svn: 330802
2018-04-25 09:04:12 +00:00
Faisal Vali 764216e1f9 [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.

llvm-svn: 330798
2018-04-25 03:54:20 +00:00
Faisal Vali 699f45887f 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.

llvm-svn: 330796
2018-04-25 03:28:23 +00:00
Yaxun Liu 997e64f8a6 Fix lit test kernel-call.cu failure on ps4 due to dso_local
llvm-svn: 330795
2018-04-25 03:16:07 +00:00
Faisal Vali 936de9d666 [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!

llvm-svn: 330794
2018-04-25 02:42:26 +00:00
Yaxun Liu e21278d938 Fix failure in lit test kernel-call.cu
There is signext on ppc64. Just remove check for function argument.

llvm-svn: 330793
2018-04-25 02:34:04 +00:00
Yaxun Liu 887c569bcb [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

llvm-svn: 330790
2018-04-25 01:10:37 +00:00
Richard Trieu 7282d320b7 [ODRHash] Hash template arguments of methods.
llvm-svn: 330789
2018-04-25 00:31:15 +00:00
Dan Albert 07b0059083 Revert "[Driver] Android triples are not aliases for other triples."
Revering while I diagnose the failures.

This reverts commit 82dc3bf2157da280420f80e654292cb05e0dc5f7.

llvm-svn: 330780
2018-04-24 22:06:40 +00:00
Dan Albert 2368aed43c [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

llvm-svn: 330770
2018-04-24 21:18:37 +00:00