]> granicus.if.org Git - clang/log
clang
6 years ago[clang-format] fix buildbots after r333085
Krasimir Georgiev [Wed, 23 May 2018 15:21:33 +0000 (15:21 +0000)]
[clang-format] fix buildbots after r333085

Old gcc versions don't like raw string literals in macros.

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

6 years ago[ASTImporter] Fix missing implict CXXRecordDecl in ClassTemplateSpecializationDecl
Gabor Marton [Wed, 23 May 2018 14:24:02 +0000 (14:24 +0000)]
[ASTImporter] Fix missing implict CXXRecordDecl in ClassTemplateSpecializationDecl

Summary:
Currently we do not import the implicit CXXRecordDecl of a
ClassTemplateSpecializationDecl. This patch fixes it.

Reviewers: a.sidorin, xazax.hun, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format] Break template declarations followed by comments
Krasimir Georgiev [Wed, 23 May 2018 14:18:19 +0000 (14:18 +0000)]
[clang-format] Break template declarations followed by comments

Summary:
This patch fixes two bugs in clang-format where the template wrapper doesn't skip over
comments causing a long template declaration to not be split into multiple lines.
These were latent and exposed by r332436.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

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

6 years agoFix duplicate class template definitions problem
Gabor Marton [Wed, 23 May 2018 13:53:36 +0000 (13:53 +0000)]
Fix duplicate class template definitions problem

Summary:
We fail to import a `ClassTemplateDecl` if the "To" context already
contains a definition and then a forward decl.  This is because
`localUncachedLookup` does not find the definition.  This is not a
lookup error, the parser behaves differently than assumed in the
importer code.  A `DeclContext` contains one DenseMap (`LookupPtr`)
which maps names to lists.  The list is a special list `StoredDeclsList`
which is optimized to have one element.  During building the initial
AST, the parser first adds the definition to the `DeclContext`.  Then
during parsing the second declaration (the forward decl) the parser
again calls `DeclContext::addDecl` but that will not add a new element
to the `StoredDeclsList` rarther it simply overwrites the old element
with the most recent one.  This patch fixes the error by finding the
definition in the redecl chain.  Added tests for the same issue with
`CXXRecordDecl` and with `ClassTemplateSpecializationDecl`.  These tests
pass and they pass because in `VisitRecordDecl` and in
`VisitClassTemplateSpecializationDecl` we already use
`D->getDefinition()` after the lookup.

Reviewers: a.sidorin, xazax.hun, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years agoTest commit
Kristof Umann [Wed, 23 May 2018 12:48:55 +0000 (12:48 +0000)]
Test commit

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

6 years agoFix unaligned memory access when reading INPUT_FILE_OFFSETS data
Raphael Isemann [Wed, 23 May 2018 09:02:40 +0000 (09:02 +0000)]
Fix unaligned memory access when reading INPUT_FILE_OFFSETS data

Summary: The blob data is unaligned, so we also should read it as such. Should fix the random failures with the sanitizer builds.

Reviewers: rsmith, v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

6 years agoRevert r333044 "Use zeroinitializer for (trailing zero portion of) large array initia...
Hans Wennborg [Wed, 23 May 2018 08:24:01 +0000 (08:24 +0000)]
Revert r333044 "Use zeroinitializer for (trailing zero portion of) large array initializers"

It caused asserts, see PR37560.

> Use zeroinitializer for (trailing zero portion of) large array initializers
> more reliably.
>
> Clang has two different ways it emits array constants (from InitListExprs and
> from APValues), and both had some ability to emit zeroinitializer, but neither
> was able to catch all cases where we could use zeroinitializer reliably. In
> particular, emitting from an APValue would fail to notice if all the explicit
> array elements happened to be zero. In addition, for large arrays where only an
> initial portion has an explicit initializer, we would emit the complete
> initializer (which could be huge) rather than emitting only the non-zero
> portion. With this change, when the element would have a suffix of more than 8
> zero elements, we emit the array constant as a packed struct of its initial
> portion followed by a zeroinitializer constant for the trailing zero portion.
>
> In passing, I found a bug where SemaInit would sometimes walk the entire array
> when checking an initializer that only covers the first few elements; that's
> fixed here to unblock testing of the rest.
>
> Differential Revision: https://reviews.llvm.org/D47166

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

6 years ago[DOXYGEN] Formatting changes for better intrinsics documentation rendering
Ekaterina Romanova [Wed, 23 May 2018 06:33:22 +0000 (06:33 +0000)]
[DOXYGEN] Formatting changes for better intrinsics documentation rendering

(1) I added some \see cross-references to a few select intrinsics that are related (and have the same or similar semantics).

(2) pmmintrin.h, smmintrin.h, xmmintrin.h have very few minor formatting changes. They make rendering of our intrinsics documentation better.

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

6 years ago[X86] Undef the vector reduction helper macros when we're done with them.
Craig Topper [Wed, 23 May 2018 06:31:36 +0000 (06:31 +0000)]
[X86] Undef the vector reduction helper macros when we're done with them.

These are implementation helper macros we shouldn't expose them to user code if we don't need to.

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

6 years ago[X86] In the floating point max reduction intrinsics, negate infinity before feeding...
Craig Topper [Wed, 23 May 2018 05:51:52 +0000 (05:51 +0000)]
[X86] In the floating point max reduction intrinsics, negate infinity before feeding it to set1.

Previously we negated the whole vector after splatting infinity. But its better to negate the infinity before splatting. This generates IR with the negate already folded with the infinity constant.

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

6 years ago[X86] Remove mask argument from more builtins that are handled completely in CGBuilti...
Craig Topper [Wed, 23 May 2018 04:51:54 +0000 (04:51 +0000)]
[X86] Remove mask argument from more builtins that are handled completely in CGBuiltin.cpp. Just wrap a select builtin around them in the header file instead.

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

6 years ago[analyzer] CStringChecker fix for strlcpy when no bytes are copied to the dest buffer
David Carlier [Wed, 23 May 2018 04:38:25 +0000 (04:38 +0000)]
[analyzer] CStringChecker fix for strlcpy when no bytes are copied to the dest buffer

Again, strlc* does not return a pointer so the zero size case doest not fit.

Reviewers: NoQ, george.karpenkov

Reviewed by: NoQ

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

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

6 years agoThis is a test commit.
David Carlier [Wed, 23 May 2018 04:27:39 +0000 (04:27 +0000)]
This is a test commit.

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

6 years ago[AST][ObjC] Print implicit property expression that only has a setter without crashing
Alex Lorenz [Wed, 23 May 2018 00:52:20 +0000 (00:52 +0000)]
[AST][ObjC] Print implicit property expression that only has a setter without crashing

rdar://40447209

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

6 years agoUse zeroinitializer for (trailing zero portion of) large array initializers
Richard Smith [Wed, 23 May 2018 00:09:29 +0000 (00:09 +0000)]
Use zeroinitializer for (trailing zero portion of) large array initializers
more reliably.

Clang has two different ways it emits array constants (from InitListExprs and
from APValues), and both had some ability to emit zeroinitializer, but neither
was able to catch all cases where we could use zeroinitializer reliably. In
particular, emitting from an APValue would fail to notice if all the explicit
array elements happened to be zero. In addition, for large arrays where only an
initial portion has an explicit initializer, we would emit the complete
initializer (which could be huge) rather than emitting only the non-zero
portion. With this change, when the element would have a suffix of more than 8
zero elements, we emit the array constant as a packed struct of its initial
portion followed by a zeroinitializer constant for the trailing zero portion.

In passing, I found a bug where SemaInit would sometimes walk the entire array
when checking an initializer that only covers the first few elements; that's
fixed here to unblock testing of the rest.

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

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

6 years ago[CodeGen] use nsw negation for builtin abs
Sanjay Patel [Tue, 22 May 2018 23:02:13 +0000 (23:02 +0000)]
[CodeGen] use nsw negation for builtin abs

The clang builtins have the same semantics as the stdlib functions.
The stdlib functions are defined in section 7.20.6.1 of the C standard with:
"If the result cannot be represented, the behavior is undefined."

That lets us mark the negation with 'nsw' because "sub i32 0, INT_MIN" would
be UB/poison.

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

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

6 years ago[X86] As mentioned in post-commit feedback in D47174, move the 128 bit f16c intrinsic...
Craig Topper [Tue, 22 May 2018 22:19:19 +0000 (22:19 +0000)]
[X86] As mentioned in post-commit feedback in D47174, move the 128 bit f16c intrinsics into f16cintrin.h and remove __emmintrin_f16c.h

These were included in emmintrin.h to match Intel Intrinsics Guide documentation. But this is because icc is capable of emulating them on targets that don't support F16C using library calls. Clang/LLVM doesn't have this emulation support. So it makes more sense to include them in immintrin.h instead.

I've left a comment behind to hopefully deter someone from trying to move them again in the future.

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

6 years ago[X86] Remove mask argument from some builtins that are handled completely in CGBuilti...
Craig Topper [Tue, 22 May 2018 20:48:24 +0000 (20:48 +0000)]
[X86] Remove mask argument from some builtins that are handled completely in CGBuiltin.cpp. Just wrap a select builtin around them in the header file instead.

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

6 years ago[X86] Another attempt at fixing the intrinsic module map for rr333014.
Craig Topper [Tue, 22 May 2018 20:48:20 +0000 (20:48 +0000)]
[X86] Another attempt at fixing the intrinsic module map for rr333014.

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

6 years ago[X86] Add two missing #endif directives to immintrin.h that should have been in r333014.
Craig Topper [Tue, 22 May 2018 20:33:04 +0000 (20:33 +0000)]
[X86] Add two missing #endif directives to immintrin.h that should have been in r333014.

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

6 years ago[X86] Add __emmintrin_f16c.h to module map and CMakeLists.
Craig Topper [Tue, 22 May 2018 20:19:05 +0000 (20:19 +0000)]
[X86] Add __emmintrin_f16c.h to module map and CMakeLists.

I missed this in r333014

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

6 years ago[X86] Move 128-bit f16c intrinsics to __emmintrin_f16c.h include from emmintrin.h...
Craig Topper [Tue, 22 May 2018 18:54:19 +0000 (18:54 +0000)]
[X86] Move 128-bit f16c intrinsics to __emmintrin_f16c.h include from emmintrin.h. Move 256-bit f16c intrinsics back to f16cintrin.h

Intel documents the 128-bit versions as being in emmintrin.h and the 256-bit version as being in immintrin.h.

This patch makes a new __emmtrin_f16c.h to hold the 128-bit versions to be included from emmintrin.h. And makes the existing f16cintrin.h contain the 256-bit versions and include it from immintrin.h with an error if its included directly.

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

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

6 years agoReland r332885, "CodeGen, Driver: Start using direct split dwarf emission in clang."
Peter Collingbourne [Tue, 22 May 2018 18:52:37 +0000 (18:52 +0000)]
Reland r332885, "CodeGen, Driver: Start using direct split dwarf emission in clang."

As well as two follow-on commits r332906, r332911 with a fix for
test clang/test/CodeGen/split-debug-filename.c.

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

6 years agoRevert "[clang-format] Fix putting ObjC message arguments in one line for multiline...
Jacek Olesiak [Tue, 22 May 2018 16:44:42 +0000 (16:44 +0000)]
Revert "[clang-format] Fix putting ObjC message arguments in one line for multiline receiver"

Summary: Reverts D46879

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: krasimir, klimek, cfe-commits

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

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

6 years agoRevert r332982 Call CreateTempMemWithoutCast for ActiveFlag
Yaxun Liu [Tue, 22 May 2018 16:13:07 +0000 (16:13 +0000)]
Revert r332982 Call CreateTempMemWithoutCast for ActiveFlag

Due to regression on arm.

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

6 years ago[CodeGen] produce the LLVM canonical form of abs
Sanjay Patel [Tue, 22 May 2018 15:36:50 +0000 (15:36 +0000)]
[CodeGen] produce the LLVM canonical form of abs

We chose the 'slt' form as canonical in IR with:
rL332819
...so we should generate that form directly for efficiency.

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

6 years ago[CodeGen] add tests for abs builtins; NFC
Sanjay Patel [Tue, 22 May 2018 15:11:59 +0000 (15:11 +0000)]
[CodeGen] add tests for abs builtins; NFC

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

6 years agoCall CreateTempMemWithoutCast for ActiveFlag
Yaxun Liu [Tue, 22 May 2018 14:36:26 +0000 (14:36 +0000)]
Call CreateTempMemWithoutCast for ActiveFlag

Introduced CreateMemTempWithoutCast and CreateTemporaryAllocaWithoutCast to emit alloca
without casting to default addr space.

ActiveFlag is a temporary variable emitted for clean up. It is defined as AllocaInst* type and there is
a cast to AlllocaInst in SetActiveFlag. An alloca casted to generic pointer causes assertion in
SetActiveFlag.

Since there is only load/store of ActiveFlag, it is safe to use the original alloca, therefore use
CreateMemTempWithoutCast is called.

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

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

6 years ago[CodeView] Enable debugging of captured variables within C++ lambdas
Brock Wyma [Tue, 22 May 2018 12:41:19 +0000 (12:41 +0000)]
[CodeView] Enable debugging of captured variables within C++ lambdas

This change will help Visual Studio resolve forward references to C++ lambda
routines used by captured variables.

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

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

6 years ago[clang-format] Add a test case for crash
Krasimir Georgiev [Tue, 22 May 2018 11:44:03 +0000 (11:44 +0000)]
[clang-format] Add a test case for crash

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

6 years agoRevert "CodeGen, Driver: Start using direct split dwarf emission in clang."
Amara Emerson [Tue, 22 May 2018 11:18:58 +0000 (11:18 +0000)]
Revert "CodeGen, Driver: Start using direct split dwarf emission in clang."

This reverts commit r332885 as it broke several greendragon buildbots.

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

6 years agoRevert "Fix another make_unique ambiguity."
Amara Emerson [Tue, 22 May 2018 11:18:49 +0000 (11:18 +0000)]
Revert "Fix another make_unique ambiguity."

This reverts commit r332906 as a dependency to revert r332885.

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

6 years agoRevert "Add missing x86-registered-target."
Amara Emerson [Tue, 22 May 2018 11:18:43 +0000 (11:18 +0000)]
Revert "Add missing x86-registered-target."

This reverts commit r332911, as a dependency to revert r332885.

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

6 years agoclang-format: [JS] do not wrap before any `is`.
Martin Probst [Tue, 22 May 2018 10:39:07 +0000 (10:39 +0000)]
clang-format: [JS] do not wrap before any `is`.

Summary:
`is` type annotations can occur at any nesting level. For example:

    function x() {
      return function y(): a is B { ... };
    }

Breaking before the `is` above breaks TypeScript parsing the code. This
change prevents the wrap.

Reviewers: krasimir

Subscribers: klimek, cfe-commits

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

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

6 years ago[objc-gnustep2] Use unsigned char to avoid potential UB in isalnum.
David Chisnall [Tue, 22 May 2018 10:13:17 +0000 (10:13 +0000)]
[objc-gnustep2] Use unsigned char to avoid potential UB in isalnum.

Suggested by Gabor Buella.

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

6 years ago[objc-gnu] Fix test.
David Chisnall [Tue, 22 May 2018 10:13:14 +0000 (10:13 +0000)]
[objc-gnu] Fix test.

The test was implicitly capturing the local filesystem layout.

Patch by Hans Wennborg!

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

6 years ago[objc-gnustep2] Use isalnum instead of a less efficient and nonportable equivalent.
David Chisnall [Tue, 22 May 2018 10:13:11 +0000 (10:13 +0000)]
[objc-gnustep2] Use isalnum instead of a less efficient and nonportable equivalent.

Patch by Hans Wennborg!

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

6 years agoRevert "Revert r332955 "GNUstep Objective-C ABI version 2""
David Chisnall [Tue, 22 May 2018 10:13:06 +0000 (10:13 +0000)]
Revert "Revert r332955 "GNUstep Objective-C ABI version 2""

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

6 years ago[clang-format] Fix crash in getLengthToMatchingParen
Krasimir Georgiev [Tue, 22 May 2018 09:46:55 +0000 (09:46 +0000)]
[clang-format] Fix crash in getLengthToMatchingParen

Summary:
Found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8212

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

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

6 years agoRevert r332955 "GNUstep Objective-C ABI version 2"
Bjorn Pettersson [Tue, 22 May 2018 08:16:45 +0000 (08:16 +0000)]
Revert r332955 "GNUstep Objective-C ABI version 2"

Reverted due to buildbot failures.
Seems like isnumber() is some Apple addition to cctype.

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

6 years agoAdd cctype include.
David Chisnall [Tue, 22 May 2018 07:22:50 +0000 (07:22 +0000)]
Add cctype include.

This appears to leak in already on libc++ platforms, but is breaking on
some other targets.

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

6 years agoGNUstep Objective-C ABI version 2
David Chisnall [Tue, 22 May 2018 06:09:23 +0000 (06:09 +0000)]
GNUstep Objective-C ABI version 2

Summary:
This includes initial support for the (hopefully final) updated Objective-C ABI, developed here:

https://github.com/davidchisnall/clang-gnustep-abi-2

It also includes some cleanups and refactoring from older GNU ABIs.

The current version is ELF only, other formats to follow.

Reviewers: rjmccall, DHowett-MSFT

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

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

6 years ago[X86] Prevent inclusion of __wmmintrin_aes.h and __wmmintrin_pclmul.h without includi...
Craig Topper [Tue, 22 May 2018 02:02:13 +0000 (02:02 +0000)]
[X86] Prevent inclusion of __wmmintrin_aes.h and __wmmintrin_pclmul.h without including wmmintrin.h

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

6 years agoAdd missing include for cstdint to Visibility.h
Raphael Isemann [Mon, 21 May 2018 22:27:22 +0000 (22:27 +0000)]
Add missing include for cstdint to Visibility.h

Summary: We use uint8_t in this header, so we need to include cstdint.

Subscribers: cfe-commits

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

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

6 years agoAdd missing x86-registered-target.
Peter Collingbourne [Mon, 21 May 2018 22:14:02 +0000 (22:14 +0000)]
Add missing x86-registered-target.

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

6 years ago[X86] Remove a builtin that should have been removed in r332882.
Craig Topper [Mon, 21 May 2018 22:10:02 +0000 (22:10 +0000)]
[X86] Remove a builtin that should have been removed in r332882.

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

6 years agoFix another make_unique ambiguity.
Peter Collingbourne [Mon, 21 May 2018 21:48:17 +0000 (21:48 +0000)]
Fix another make_unique ambiguity.

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

6 years ago[X86] Remove masking from pternlog llvm intrinsics and use a select instruction instead.
Craig Topper [Mon, 21 May 2018 20:58:23 +0000 (20:58 +0000)]
[X86] Remove masking from pternlog llvm intrinsics and use a select instruction instead.

Because the intrinsics in the headers are implemented as macros, we can't just use a select builtin and pternlog builtin. This would require one of the macro arguments to be used twice. Depending on what was passed to the macro we could expand an expression twice leading to weird behavior. We could maybe declare our local variable in the macro, but that would need to worry about name collisions.

To avoid that just generate IR directly in CGBuiltin.cpp.

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

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

6 years agoRevert r332847; it caused us to miscompile certain forms of reference initialization.
Richard Smith [Mon, 21 May 2018 20:36:58 +0000 (20:36 +0000)]
Revert r332847; it caused us to miscompile certain forms of reference initialization.

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

6 years agoCodeGen, Driver: Start using direct split dwarf emission in clang.
Peter Collingbourne [Mon, 21 May 2018 20:31:59 +0000 (20:31 +0000)]
CodeGen, Driver: Start using direct split dwarf emission in clang.

Fixes PR37466.

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

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

6 years ago[X86] Use __builtin_convertvector to implement some of the packed integer to packed...
Craig Topper [Mon, 21 May 2018 20:19:17 +0000 (20:19 +0000)]
[X86] Use __builtin_convertvector to implement some of the packed integer to packed float conversion intrinsics.

I believe this is safe assuming default default FP environment. The conversion might be inexact, but it can never overflow the FP type so this shouldn't be undefined behavior for the uitofp/sitofp instructions.

We already do something similar for scalar conversions.

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

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

6 years agoCodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to...
Peter Collingbourne [Mon, 21 May 2018 20:16:41 +0000 (20:16 +0000)]
CodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to dwo output.

Part of PR37466.

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

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

6 years agoRevert r332028; see PR37545 for details.
Richard Smith [Mon, 21 May 2018 20:10:54 +0000 (20:10 +0000)]
Revert r332028; see PR37545 for details.

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

6 years ago[Clang Tablegen] Add llvm_unreachable() to getModifierName()
Mark Searles [Mon, 21 May 2018 17:29:08 +0000 (17:29 +0000)]
[Clang Tablegen] Add llvm_unreachable() to getModifierName()

Fix internal build failure:

../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o
../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef
{anonymous}::getModifierName({anonymous}::ModifierType)':
../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type]
}
^

Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8

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

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

6 years ago[OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.
Alexey Bataev [Mon, 21 May 2018 16:40:32 +0000 (16:40 +0000)]
[OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.

if `-fopenmp-simd` is specified alone, `_OPENMP` macro should not be
  defined. If `-fopenmp-simd` is specified along with the `-fopenmp`,
  `_OPENMP` macro should be defined with the value `201511`.

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

6 years ago[AMDGPU] fixes for lds f32 builtins
Daniil Fukalov [Mon, 21 May 2018 16:18:07 +0000 (16:18 +0000)]
[AMDGPU] fixes for lds f32 builtins

1. added restrictions to memory scope, order and volatile parameters
2. added custom processing for these builtins - currently is not used code,
   needed to switch off GCCBuiltin link to the builtins (ongoing change to llvm
   tree)
3. builtins renamed as requested

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

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

6 years ago[CodeGen] Recognize more cases of zero initialization
Serge Pavlov [Mon, 21 May 2018 16:09:54 +0000 (16:09 +0000)]
[CodeGen] Recognize more cases of zero initialization

If a variable has an initializer, codegen tries to build its value. If
the variable is large in size, building its value requires substantial
resources. It causes strange behavior from user viewpoint: compilation
of huge zero initialized arrays like:

    char data_1[2147483648u] = { 0 };

consumes enormous amount of time and memory.

With this change codegen tries to determine if variable initializer is
equivalent to zero initializer. In this case variable value is not
constructed.

This change fixes PR18978.

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

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

6 years ago[Sema] Fix incorrect packed aligned structure layout
Momchil Velikov [Mon, 21 May 2018 14:28:43 +0000 (14:28 +0000)]
[Sema] Fix incorrect packed aligned structure layout

Handle attributes before checking the record layout (e.g. underalignment check
during `alignas` processing), as layout may be cached without taking into
account attributes that may affect it.

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

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

6 years ago[CodeGen] Disable aggressive structor optimizations at -O0, take 2
Pavel Labath [Mon, 21 May 2018 11:47:45 +0000 (11:47 +0000)]
[CodeGen] Disable aggressive structor optimizations at -O0, take 2

The first version of the patch (r332228) was flawed because it was
putting structors into C5/D5 comdats very eagerly. This is correct only
if we can ensure the comdat contains all required versions of the
structor (which wasn't the case). This version uses a more nuanced
approach:
- for local structor symbols we use an alias because we don't have to
  worry about comdats or other compilation units.
- linkonce symbols are emitted separately, as we cannot guarantee we
  will have all symbols we need to form a comdat (they are emitted
  lazily, only when referenced).
- available_externally symbols are also emitted separately, as the code
  seemed to be worried about emitting an alias in this case.
- other linkage types are not affected by the optimization level. They
  either get put into a comdat (weak) or get aliased (external).

Reviewers: rjmccall, aprantl

Subscribers: cfe-commits

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

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

6 years ago[X86] Remove some preprocessor feature checks from intrinsic headers
Craig Topper [Mon, 21 May 2018 06:07:49 +0000 (06:07 +0000)]
[X86] Remove some preprocessor feature checks from intrinsic headers

Summary:
These look to be a couple things that weren't removed when we switched to target attribute.

The popcnt makes including just smmintrin.h also include popcntintrin.h. The popcnt file itself already contains target attrributes.

The prefetch ones are just wrappers around __builtin_prefetch which we have graceful fallbacks for in the backend if the exact instruction isn't available. So there's no reason to hide them. And it makes them available in functions that have the write target attribute but not a -march command line flag.

Reviewers: echristo, RKSimon, spatel, DavidKreitzer

Reviewed By: echristo

Subscribers: cfe-commits

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

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

6 years ago[X86] Remove some unused builtins.
Craig Topper [Mon, 21 May 2018 03:36:57 +0000 (03:36 +0000)]
[X86] Remove some unused builtins.

These were upgraded to native shufflevectors months ago.

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

6 years ago[X86] Remove mask arguments from permvar builtins/intrinsics. Use a select in IR...
Craig Topper [Sun, 20 May 2018 23:34:10 +0000 (23:34 +0000)]
[X86] Remove mask arguments from permvar builtins/intrinsics. Use a select in IR instead.

Someday maybe we'll use selects for all the builtins.

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

6 years agoRevert 332750, clang part (see comment on D46910).
Nico Weber [Sun, 20 May 2018 23:02:20 +0000 (23:02 +0000)]
Revert 332750, clang part (see comment on D46910).

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

6 years agoSema: diagnose invalid catch parameter in ObjC
Saleem Abdulrasool [Sun, 20 May 2018 19:26:44 +0000 (19:26 +0000)]
Sema: diagnose invalid catch parameter in ObjC

Ensure that the type being used has an associated interface when
declaring the parameter for `@catch`.

Resolves PR37384!

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

6 years agoPrint the qualified name when dumping deserialized decls.
Vassil Vassilev [Sun, 20 May 2018 09:38:52 +0000 (09:38 +0000)]
Print the qualified name when dumping deserialized decls.

This is useful to understand and debug the lazy template specializations
used in the pch and modules.

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

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

6 years ago[Driver] Temporarily remove test for LLVM findNearest
Brian Gesiak [Sat, 19 May 2018 12:44:02 +0000 (12:44 +0000)]
[Driver] Temporarily remove test for LLVM findNearest

Summary:
This fixes a failure caused by the revert of https://reviews.llvm.org/rL332805.

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

6 years ago[Driver] Loosen test for LLVM findNearest
Brian Gesiak [Sat, 19 May 2018 11:46:58 +0000 (11:46 +0000)]
[Driver] Loosen test for LLVM findNearest

Summary:
When https://reviews.llvm.org/D46776 landed to improve the behavior of
`llvm::OptTable::findNearest`, a PS4 buildbot began failing due to an
assertion that a suggestion "-debug-info-macro" should be provided for
the unrecognized option `clang -cc1as -debug-info-macros`. All other
buildbots succeeded in this check, and the PS4 buildbot succeeded in the
other `findNearest` tests.

Temporarily loosen this check in order to reland the `findNearest`
change.

Test Plan: check-clang

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

6 years agoCodeGen: block capture shouldn't ICE
JF Bastien [Sat, 19 May 2018 04:21:26 +0000 (04:21 +0000)]
CodeGen: block capture shouldn't ICE

When a lambda capture captures a __block in the same statement, the compiler asserts out because isCapturedBy assumes that an Expr can only be a BlockExpr, StmtExpr, or if it's a Stmt then all the statement's children are expressions. That's wrong, we need to visit all sub-statements even if they're not expressions to see if they also capture.

Fix this issue by pulling out the isCapturedBy logic to use RecursiveASTVisitor.

<rdar://problem/39926584>

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

6 years agoAdjust and fix failing CXX tests after r332799
Eric Fiselier [Sat, 19 May 2018 03:33:56 +0000 (03:33 +0000)]
Adjust and fix failing CXX tests after r332799

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

6 years ago[Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages.
Eric Fiselier [Sat, 19 May 2018 03:12:04 +0000 (03:12 +0000)]
[Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages.

Summary:
There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now!

This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted.

The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example:

```
def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">;
```
when used as
```
"candidate `%sub{select_ovl_candidate}3,2,1 not viable"
```
will act as if we wrote:
```
"candidate %select{function|constructor}3%select{| template| %1}2 not viable"
```

Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

6 years agoDo not enable RTTI with -fexceptions, for PS4
Sunil Srivastava [Fri, 18 May 2018 23:32:01 +0000 (23:32 +0000)]
Do not enable RTTI with -fexceptions, for PS4

NFC for targets other than PS4.

This patch is a change in behavior for PS4, in that PS4 will no longer enable
RTTI when -fexceptions is specified (RTTI and Exceptions are disabled by default
on PS4). RTTI will remain disabled except for types being thrown or caught.
Also, '-fexceptions -fno-rtti' (previously prohibited on PS4) is now accepted,
as it is for other targets.

This patch removes some PS4 specific code, making the code cleaner.

Also, in the test file rtti-options.cpp, PS4 tests where the behavior is the
same as the generic x86_64-linux are removed, making the test cleaner.

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

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

6 years ago[test] Fix run line to use correct triple
Shoaib Meenai [Fri, 18 May 2018 21:59:29 +0000 (21:59 +0000)]
[test] Fix run line to use correct triple

objc_begin_catch/objc_end_catch are specific to the Itanium ABI, so we
should be using an Itanium triple for this test.

Additionally, while I'm here, convert the run line to invoke the
compiler directly rather than going through the driver.

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

6 years agoMaintain PS4 ABI compatibility by making the fix made in r331136 not apply when the...
Douglas Yung [Fri, 18 May 2018 21:51:46 +0000 (21:51 +0000)]
Maintain PS4 ABI compatibility by making the fix made in r331136 not apply when the target is the PS4.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

6 years agoRevert r332470 (and corresponding tests in r332492).
Richard Smith [Fri, 18 May 2018 20:18:17 +0000 (20:18 +0000)]
Revert r332470 (and corresponding tests in r332492).

This regressed our support for __attribute__((section)). See added test file
for example of code broken by this.

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

6 years agoSupport: Simplify endian stream interface. NFCI.
Peter Collingbourne [Fri, 18 May 2018 19:46:24 +0000 (19:46 +0000)]
Support: Simplify endian stream interface. NFCI.

Provide some free functions to reduce verbosity of endian-writing
a single value, and replace the endianness template parameter with
a field.

Part of PR37466.

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

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

6 years agoRevert "Move #include manipulation code to new lib/Tooling/Inclusions."
Eric Liu [Fri, 18 May 2018 18:33:08 +0000 (18:33 +0000)]
Revert "Move #include manipulation code to new lib/Tooling/Inclusions."

This reverts commit r332720. This break build bot with modules. Need to
investigate. Revert the change to unbreak bots.

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

6 years ago[Support] Avoid normalization in sys::getDefaultTargetTriple
Petr Hosek [Fri, 18 May 2018 18:33:07 +0000 (18:33 +0000)]
[Support] Avoid normalization in sys::getDefaultTargetTriple

The return value of sys::getDefaultTargetTriple, which is derived from
-DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target,
and in the future also to control the search path directly; as such it
should be used textually, without interpretation by LLVM.

Normalization of this value may lead to unexpected results, for example
if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu,
normalization will transform that value to x86_64--linux-gnu. Driver will
use that value to search for tools prefixed with x86_64--linux-gnu- which
may be confusing. This is also inconsistent with the behavior of the
--target flag which is taken as-is without any normalization and overrides
the value of LLVM_DEFAULT_TARGET_TRIPLE.

Users of sys::getDefaultTargetTriple already perform their own
normalization as needed, so this change shouldn't impact existing logic.

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

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

6 years agoMC: Change the streamer ctors to take an object writer instead of a stream. NFCI.
Peter Collingbourne [Fri, 18 May 2018 18:26:45 +0000 (18:26 +0000)]
MC: Change the streamer ctors to take an object writer instead of a stream. NFCI.

The idea is that a client that wants split dwarf would create a
specific kind of object writer that creates two files, and use it to
create the streamer.

Part of PR37466.

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

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

6 years ago[X86] Fix a bad cast from mask16 to mask8 in _mm256_mask_cvtepi16_epi8 introduced...
Craig Topper [Fri, 18 May 2018 17:18:46 +0000 (17:18 +0000)]
[X86] Fix a bad cast from mask16 to mask8 in _mm256_mask_cvtepi16_epi8 introduced in r332266.

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

6 years agoFix unused variable warning in r332724
Eric Liu [Fri, 18 May 2018 16:29:42 +0000 (16:29 +0000)]
Fix unused variable warning in r332724

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

6 years ago[Tooling] Add an overload of runToolOnCodeWithArgs that takes VFS
Eric Liu [Fri, 18 May 2018 16:06:19 +0000 (16:06 +0000)]
[Tooling] Add an overload of runToolOnCodeWithArgs that takes VFS

Summary: ... to support purely VFS-based tools.

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

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

6 years ago[ASTImporter] Enable disabled but passing test
Gabor Marton [Fri, 18 May 2018 15:46:18 +0000 (15:46 +0000)]
[ASTImporter] Enable disabled but passing test

Summary:
There is a test which passes since D32947, but it was forgotten to be enabled.
This patch enables that disabled test.

Reviewers: a.sidorin, r.stahl, xazax.hun

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format/ObjC] Correctly annotate single-component ObjC method invocations
Ben Hamilton [Fri, 18 May 2018 15:27:02 +0000 (15:27 +0000)]
[clang-format/ObjC] Correctly annotate single-component ObjC method invocations

Summary:
Previously, clang-format's parser would fail to annotate the
selector in a single-component Objective-C method invocation with
`TT_SelectorName`. For example, the following:

  [foo bar];

would parse `bar` as `TT_Unknown`:

  M=0 C=1 T=Unknown S=0 B=0 BK=0 P=140 Name=identifier L=34 PPK=2
  FakeLParens= FakeRParens=0 II=0x559d5db51770 Text='bar'

This caused us to fail to insert a space after a closing cast rparen,
so the following:

  [((Foo *)foo) bar];

would format as:

  [((Foo *)foo)bar];

This diff fixes the issue by ensuring we annotate the selector
in a single-component Objective-C method invocation as
`TT_SelectorName`.

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

Reviewers: djasper, jolesiak

Reviewed By: jolesiak

Subscribers: Wizard, klimek, hokein, cfe-commits

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

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

6 years ago[HIP] Support offloading by linker script
Yaxun Liu [Fri, 18 May 2018 15:07:56 +0000 (15:07 +0000)]
[HIP] Support offloading by linker script

To support linking device code in different source files, it is necessary to
embed fat binary at host linking stage.

This patch emits an external symbol for fat binary in host codegen, then
embed the fat binary by lld through a linker script.

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

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

6 years agoMove #include manipulation code to new lib/Tooling/Inclusions.
Eric Liu [Fri, 18 May 2018 14:16:37 +0000 (14:16 +0000)]
Move #include manipulation code to new lib/Tooling/Inclusions.

Summary:
clangToolingCore is linked into almost everything (incl. clang), but
not few tools need #include manipulation at this point. So pull this into a
separate library in Tooling.

Reviewers: ilya-biryukov

Subscribers: klimek, mgorny, cfe-commits, thakis

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

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

6 years ago[VFS] Implement getRealPath for OverlayFileSystem.
Eric Liu [Fri, 18 May 2018 13:22:49 +0000 (13:22 +0000)]
[VFS] Implement getRealPath for OverlayFileSystem.

Reviewers: bkramer

Subscribers: cfe-commits

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

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

6 years agoThis patch aims to match the changes introduced
Alexander Ivchenko [Fri, 18 May 2018 11:56:21 +0000 (11:56 +0000)]
This patch aims to match the changes introduced
in gcc by https://gcc.gnu.org/ml/gcc-cvs/2018-04/msg00534.html.
The -mibt feature flag is being removed, and the -fcf-protection
option now also defines a CET macro and causes errors when used
on non-X86 targets, while X86 targets no longer check for -mibt
and -mshstk to determine if -fcf-protection is supported. -mshstk
is now used only to determine availability of shadow stack intrinsics.

Comes with an LLVM patch (D46882).

Patch by mike.dvoretsky

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

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

6 years agoDo not try to remove invisible Decls from DeclContext
Gabor Marton [Fri, 18 May 2018 09:08:47 +0000 (09:08 +0000)]
Do not try to remove invisible Decls from DeclContext

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

6 years agoSupport: Add a raw_ostream::write_zeros() function. NFCI.
Peter Collingbourne [Thu, 17 May 2018 22:11:43 +0000 (22:11 +0000)]
Support: Add a raw_ostream::write_zeros() function. NFCI.

This will eventually replace MCObjectWriter::WriteZeros.

Part of PR37466.

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

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

6 years agoAdd missing test case for r332639
Reid Kleckner [Thu, 17 May 2018 18:34:05 +0000 (18:34 +0000)]
Add missing test case for r332639

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

6 years agoFix a mangling failure on clang-cl C++17
Reid Kleckner [Thu, 17 May 2018 18:12:18 +0000 (18:12 +0000)]
Fix a mangling failure on clang-cl C++17

MethodVFTableLocations in MigrosoftVTableContext contains canonicalized
decl. But, it's sometimes asked to lookup for non-canonicalized decl,
and that causes assertion failure, and compilation failure.

Fixes PR37481.

Patch by Taiju Tsuiki!

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

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

6 years ago[sanitizer] Don't add --export-dynamic for Myriad
Walter Lee [Thu, 17 May 2018 18:04:39 +0000 (18:04 +0000)]
[sanitizer] Don't add --export-dynamic for Myriad

This is to work around a bug in some versions of gnu ld, where
--export-dynamic implies -shared even if -static is explicitly given.
Myriad supports static linking only, so --export-dynamic is never
needed.

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

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

6 years ago[CUDA] Allow "extern __shared__ Foo foo[]" within anon. namespaces.
Justin Lebar [Thu, 17 May 2018 16:15:07 +0000 (16:15 +0000)]
[CUDA] Allow "extern __shared__ Foo foo[]" within anon. namespaces.

Summary:
Previously this triggered a -Wundefined-internal warning.  But it's not
an undefined variable -- any variable of this form is a pointer to the
base of GPU core's shared memory.

Reviewers: tra

Subscribers: sanjoy, rsmith

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

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

6 years ago[CUDA] Make std::min/max work when compiling in C++14 mode with a C++11 stdlib.
Justin Lebar [Thu, 17 May 2018 16:12:42 +0000 (16:12 +0000)]
[CUDA] Make std::min/max work when compiling in C++14 mode with a C++11 stdlib.

Reviewers: rsmith

Subscribers: sanjoy, cfe-commits, tra

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

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

6 years agoFix __uuidof handling on non-type template parameter in C++17
Nico Weber [Thu, 17 May 2018 15:26:37 +0000 (15:26 +0000)]
Fix __uuidof handling on non-type template parameter in C++17

Clang used to pass the base lvalue of a non-type template parameter
to the template instantiation phase when the base part is __uuidof
and it's running in C++17 mode.
However, that drops its LValuePath, and unintentionally transforms
&__uuidof(...) to __uuidof(...).

This CL fixes that by passing whole expr. Fixes PR24986.

https://reviews.llvm.org/D46820?id=146557
Patch from Taiju Tsuiki <tzik@chromium.org>!

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

6 years ago[AArch64] Correct inline assembly test case for S modifier [NFC]
Peter Smith [Thu, 17 May 2018 13:17:33 +0000 (13:17 +0000)]
[AArch64] Correct inline assembly test case for S modifier [NFC]

The existing test for the AArch64 inline assembly constraint S uses the
A and L modifiers. These modifiers were implemented in the original
AArch64 backend but were not carried forward to the merged backend. The
A is associated with ADRP and does nothing, the L is associated with
:lo12: . Given that A and L are not supported by GCC and not supported
by the new implementation of constraint S in LLVM (see D46745) I've
altered the test to put :lo12: directly in the string so that A and L
are not needed.

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

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

6 years agoUse dotted format of version tuple for availability diagnostics
Jan Korous [Thu, 17 May 2018 11:51:49 +0000 (11:51 +0000)]
Use dotted format of version tuple for availability diagnostics

E. g. use "10.11" instead of "10_11".

We are maintaining backward compatibility by parsing underscore-delimited version tuples but no longer keep track of the separator and using dot format for output.

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

rdar://problem/39845032

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

6 years agoCodeGen: Fix invalid bitcast for lifetime.start/end
Yaxun Liu [Thu, 17 May 2018 11:16:35 +0000 (11:16 +0000)]
CodeGen: Fix invalid bitcast for lifetime.start/end

lifetime.start/end expects pointer argument in alloca address space.
However in C++ a temporary variable is in default address space.

This patch changes API CreateMemTemp and CreateTempAlloca to
get the original alloca instruction and pass it lifetime.start/end.

It only affects targets with non-zero alloca address space.

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

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

6 years agoAdd vfs::FileSystem::getRealPath
Eric Liu [Thu, 17 May 2018 10:26:23 +0000 (10:26 +0000)]
Add vfs::FileSystem::getRealPath

Summary: And change `FileManager::getCanonicalName` to use getRealPath.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

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

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

6 years ago[ASTImporter] Fix missing implict CXXRecordDecl
Gabor Marton [Thu, 17 May 2018 09:46:07 +0000 (09:46 +0000)]
[ASTImporter] Fix missing implict CXXRecordDecl

Summary:
Implicit CXXRecordDecl is not added to its DeclContext during import, but in
the original AST it is. This patch fixes this.

Reviewers: xazax.hun, a.sidorin, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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