]> granicus.if.org Git - clang/log
clang
7 years agoclang-format: Support ObjC selectors with unnamed parameters.
Daniel Jasper [Sat, 12 Nov 2016 07:38:22 +0000 (07:38 +0000)]
clang-format: Support ObjC selectors with unnamed parameters.

This fixes llvm.org/PR28063.

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

7 years ago[AVX-512] Convert the rest of the masked shift by immediate and by single element...
Craig Topper [Sat, 12 Nov 2016 07:16:59 +0000 (07:16 +0000)]
[AVX-512] Convert the rest of the masked shift by immediate and by single element builtins over to the newly added unmasked builtins and a select.

This should also fix PR30691 since the new builtins are handled like the legacy builtins in the backend.

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

7 years ago[analyzer] Update 'Automated' to 'Automatic' from r286694.
Devin Coughlin [Sat, 12 Nov 2016 01:50:04 +0000 (01:50 +0000)]
[analyzer] Update 'Automated' to 'Automatic' from r286694.

ARC is 'Automatic Reference Counting' and not 'Automated Reference Counting'.

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

7 years ago[c++1z] Support constant folding for __builtin_strchr and __builtin_memchr.
Richard Smith [Sat, 12 Nov 2016 01:39:56 +0000 (01:39 +0000)]
[c++1z] Support constant folding for __builtin_strchr and __builtin_memchr.

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

7 years ago[analyzer] Fix copy-pasta in NullableReturnedFromNonnullChecker checker name.
Devin Coughlin [Sat, 12 Nov 2016 01:23:01 +0000 (01:23 +0000)]
[analyzer] Fix copy-pasta in NullableReturnedFromNonnullChecker checker name.

The name of the NullableReturnedFromNonnullChecker in Checkers.td
was accidentally "NullablePassedToNonnull", which made it impossible
to explicitly turn the checker on.

rdar://problem/28354459

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

7 years agoAdd instructions in clang get_started page about working with a monorepo
Mehdi Amini [Sat, 12 Nov 2016 01:18:17 +0000 (01:18 +0000)]
Add instructions in clang get_started page about working with a monorepo

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

7 years ago[analyzer] Improve misleading RetainCountChcker diagnostic under ARC
Devin Coughlin [Sat, 12 Nov 2016 01:03:06 +0000 (01:03 +0000)]
[analyzer] Improve misleading RetainCountChcker diagnostic under ARC

Under automated reference counting the analyzer treats a methods -- even those
starting with  'copy' and friends -- as returning an unowned value. This is
because ownership of CoreFoundation objects must be transferred to ARC
with __bridge_transfer or CFBridgingRelease() before being returned as
ARC-managed bridged objects.

Unfortunately this could lead to a poor diagnostic inside copy methods under
ARC where the analyzer would complain about a leak of a returned CF value inside
a method "whose name does not start with 'copy'" -- even though the name did
start with 'copy'.

This commit improves the diagnostic under ARC to say inside a method "returned
from a method managed by Automated Reference Counting".

rdar://problem/28849667

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

7 years ago[c++1z] std::byte didn't make it
Richard Smith [Sat, 12 Nov 2016 00:15:24 +0000 (00:15 +0000)]
[c++1z] std::byte didn't make it

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

7 years ago[c++1z] Two more features have been accepted.
Richard Smith [Fri, 11 Nov 2016 23:51:47 +0000 (23:51 +0000)]
[c++1z] Two more features have been accepted.

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

7 years ago[index] Rename SymbolSubKind -> SymbolProperty, NFC.
Argyrios Kyrtzidis [Fri, 11 Nov 2016 23:49:55 +0000 (23:49 +0000)]
[index] Rename SymbolSubKind -> SymbolProperty, NFC.

This better reflects what it represents.

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

7 years ago[c++1z] p0522 is approved.
Richard Smith [Fri, 11 Nov 2016 23:46:25 +0000 (23:46 +0000)]
[c++1z] p0522 is approved.

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

7 years ago[c++1z] Add constant-folding support for strcmp, strncmp, and memcmp, to
Richard Smith [Fri, 11 Nov 2016 23:43:35 +0000 (23:43 +0000)]
[c++1z] Add constant-folding support for strcmp, strncmp, and memcmp, to
support constexpr char_traits.

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

7 years ago[tsan][clang] Introduce a function attribute to disable TSan checking at run time
Anna Zaks [Fri, 11 Nov 2016 23:22:44 +0000 (23:22 +0000)]
[tsan][clang] Introduce a function attribute to disable TSan checking at run time

This introduces a function annotation that disables TSan checking for the
function at run time. The benefit over attribute((no_sanitize("thread")))
is that the accesses within the callees will also be suppressed.

The motivation for this attribute is a guarantee given by the objective C
language that the calls to the reference count decrement and object
deallocation will be synchronized. To model this properly, we would need to
intercept all ref count decrement calls (which are very common in ObjC due
to use of ARC) and also every single message send. Instead, we propose to
just ignore all accesses made from within dealloc at run time. The main
downside is that this still does not introduce any synchronization, which
means we might still report false positives if the code that relies on this
synchronization is not executed from within dealloc. However, we have not
seen this in practice so far and think these cases will be very rare.

(This problem is similar in nature to https://reviews.llvm.org/D21609;
unfortunately, the same solution does not apply here.)

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

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

7 years agoTread TSan LLVM flags to driver: add TSan controlling flags to clang.
Evgeniy Stepanov [Fri, 11 Nov 2016 23:17:36 +0000 (23:17 +0000)]
Tread TSan LLVM flags to driver: add TSan controlling flags to clang.

Summary:
New clang flags, all default to true:
-f[no-]sanitize-thread-data-races
-f[no-]sanitize-thread-stack-traces
-f[no-]sanitize-thread-atomics

Reviewers: dvyukov, pcc, eugenis

Subscribers: pcc, cfe-commits

Patch by Alex Shlyapnikov.

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

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

7 years ago[cxx_status] Prepare features list for WG21 motions.
Richard Smith [Fri, 11 Nov 2016 22:48:43 +0000 (22:48 +0000)]
[cxx_status] Prepare features list for WG21 motions.

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

7 years ago[ASTMatchers] Fix a typo in cStyleCastExpr() HTML docs as well. NFC.
Artem Dergachev [Fri, 11 Nov 2016 22:34:53 +0000 (22:34 +0000)]
[ASTMatchers] Fix a typo in cStyleCastExpr() HTML docs as well. NFC.

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

7 years ago[PowerPC] Implement remaining permute builtins in altivec.h - Clang portion
Nemanja Ivanovic [Fri, 11 Nov 2016 22:34:44 +0000 (22:34 +0000)]
[PowerPC] Implement remaining permute builtins in altivec.h - Clang portion

This patch corresponds to review:
https://reviews.llvm.org/D26479

It adds the remaining vector permute/rotate builtins to altivec.h.

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

7 years agoRemove double setting of invalid flag.
Richard Trieu [Fri, 11 Nov 2016 21:50:39 +0000 (21:50 +0000)]
Remove double setting of invalid flag.

In r286630, Decl::setInvalidDecl will automatically set the invalid flag for
BindingDecl for children in invalid DecompositionDecl.  It no longer is
necessary to do a separate setInvalidDecl when finalizing a BindingDecl.

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

7 years ago[analyzer] Teach RetainCountChecker about VTCompressionSessionEncodeFrame()
Devin Coughlin [Fri, 11 Nov 2016 21:31:38 +0000 (21:31 +0000)]
[analyzer] Teach RetainCountChecker about VTCompressionSessionEncodeFrame()

The context argument passed to VideoToolbox's
VTCompressionSessionEncodeFrame() function is ultimately passed to a callback
supplied when creating the compression session and so may be freed by that
callback.  To suppress false positives in this case, teach the retain count
checker to stop tracking that argument.

This isn't suppressed by the usual callback context mechanism because the call
to VTCompressionSessionEncodeFrame() doesn't include the callback itself.

rdar://problem/27685213

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

7 years agoWhen a DecompositionDecl is marked invalid, also set the child BindingDecl's to
Richard Trieu [Fri, 11 Nov 2016 20:51:04 +0000 (20:51 +0000)]
When a DecompositionDecl is marked invalid, also set the child BindingDecl's to
invalid.

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

7 years ago[ASTMatchers] Fix a typo in cStyleCastExpr() docs. NFC.
Artem Dergachev [Fri, 11 Nov 2016 20:29:59 +0000 (20:29 +0000)]
[ASTMatchers] Fix a typo in cStyleCastExpr() docs. NFC.

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

7 years ago[PowerPC] Add vector conversion builtins to altivec.h - clang portion
Nemanja Ivanovic [Fri, 11 Nov 2016 19:56:17 +0000 (19:56 +0000)]
[PowerPC] Add vector conversion builtins to altivec.h - clang portion

This patch corresponds to review:
https://reviews.llvm.org/D26308

It adds a number of vector type conversion builtins to altivec.h.

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

7 years agoBitcode: Change getModuleSummaryIndex() to return an llvm::Expected.
Peter Collingbourne [Fri, 11 Nov 2016 19:50:39 +0000 (19:50 +0000)]
Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected.

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

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

7 years ago[cfi] Enable cfi-icall on ARM and AArch64.
Evgeniy Stepanov [Fri, 11 Nov 2016 18:49:49 +0000 (18:49 +0000)]
[cfi] Enable cfi-icall on ARM and AArch64.

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

7 years agoAdd a new optimization option -Og
Sylvestre Ledru [Fri, 11 Nov 2016 17:29:56 +0000 (17:29 +0000)]
Add a new optimization option -Og

Summary:
Just like gcc, we should have the -Og option as more and more software are using it:
https://llvm.org/bugs/show_bug.cgi?id=20765

Reviewers: echristo, dberlin, dblaikie, keith.walker.arm, rengolin

Subscribers: aprantl, friss, mehdi_amini, RKSimon, probinson, majnemer, cfe-commits

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

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

7 years agoFix mismatched enum value name and diagnostic text.
Douglas Katzman [Fri, 11 Nov 2016 16:51:40 +0000 (16:51 +0000)]
Fix mismatched enum value name and diagnostic text.

ExpectedFunctionGlobalVarMethodOrProperty
would previously say "functions and global variables"
instead of "functions, methods, properties, and global variables"

The newly added ExpectedFunctionOrGlobalVariable
says "functions and global variables"

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

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

7 years ago[X86] Merge (near) duplicate scalar non-temporal store code. NFCI.
Simon Pilgrim [Fri, 11 Nov 2016 14:38:34 +0000 (14:38 +0000)]
[X86] Merge (near) duplicate scalar non-temporal store code. NFCI.

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

7 years agoFix for PR28523: unexpected compilation error.
Alexey Bataev [Fri, 11 Nov 2016 12:36:20 +0000 (12:36 +0000)]
Fix for PR28523: unexpected compilation error.

Clang emits error message for the following code:
```
template <class F> void parallel_loop(F &&f) { f(0); }

int main() {
  int x;
  parallel_loop([&](auto y) {
    {
      x = y;
    };
  });
}
```

$ clang++ --std=gnu++14 clang_test.cc -o clang_test
clang_test.cc:9:7: error: reference to local variable 'x' declared in enclosing function 'main'
      x = y;
            ^
clang_test.cc:2:48: note: in instantiation of function template specialization 'main()::(anonymous class)::operator()<int>' requested here
            template <class F> void parallel_loop(F &&f) { f(0); }
                                                           ^
clang_test.cc:6:3: note: in instantiation of function template specialization 'parallel_loop<(lambda at clang_test.cc:6:17)>' requested here parallel_loop([&](auto y) {
           ^
clang_test.cc:5:7: note: 'x' declared here
      int x;
          ^
1 error generated.

Patch fixes this issue.

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

7 years agoMirror the llvm changes that split Bitcode/ReaderWriter.h
Teresa Johnson [Fri, 11 Nov 2016 05:35:12 +0000 (05:35 +0000)]
Mirror the llvm changes that split Bitcode/ReaderWriter.h

The change in D26502 splits ReaderWriter.h, which contains the APIs
into both the BitReader and BitWriter libraries, into BitcodeReader.h
and BitcodeWriter.h.

Change clang uses to the appropriate split header(s).

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

7 years agoDefine __ANDROID_API__ when specified as part of an Android target.
Stephen Hines [Fri, 11 Nov 2016 01:29:39 +0000 (01:29 +0000)]
Define __ANDROID_API__ when specified as part of an Android target.

Summary:
This macro should be defined only when the user directly specifies an
API level as part of an Android target. For any regular Android target,
we leave this macro undefined.

Bug: https://llvm.org/bugs/show_bug.cgi?id=30940

Reviewers: eugenis, pirama

Subscribers: tberghammer, cfe-commits, pirama, eugenis, danalbert

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

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

7 years agoDon't require nullability on 'va_list', even when it's a pointer.
Jordan Rose [Fri, 11 Nov 2016 01:29:18 +0000 (01:29 +0000)]
Don't require nullability on 'va_list', even when it's a pointer.

Take 3! This should finally fix the Hexagon, PPC, and Windows bots.

rdar://problem/25846421

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

7 years agoRevert "Speculative fix for va_list/nullability test on Hexagon and PPC."
Jordan Rose [Fri, 11 Nov 2016 01:29:15 +0000 (01:29 +0000)]
Revert "Speculative fix for va_list/nullability test on Hexagon and PPC."

This reverts commit r286533. At this point an array really is still an
array, but the problem is with /non-/array va_lists anyway.

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

7 years agoPR30937: don't devirtualize if we find that the callee is a pure virtual
Richard Smith [Fri, 11 Nov 2016 01:01:31 +0000 (01:01 +0000)]
PR30937: don't devirtualize if we find that the callee is a pure virtual
function. In that case, there is no requirement that the callee is actually
defined, and the code may in fact be valid and have defined behavior if the
virtual call is unreachable.

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

7 years agoSpeculative fix for va_list/nullability test on Hexagon and PPC.
Jordan Rose [Fri, 11 Nov 2016 00:55:14 +0000 (00:55 +0000)]
Speculative fix for va_list/nullability test on Hexagon and PPC.

PowerPC's va_list, at least, is a typedef for an array, which means it
decays to a pointer in parameter position. Since the decayed type is
built from the array element type, the typedef sugar is lost.

More rdar://problem/25846421.

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

7 years agoDon't require nullability on 'va_list' harder.
Jordan Rose [Fri, 11 Nov 2016 00:23:59 +0000 (00:23 +0000)]
Don't require nullability on 'va_list' harder.

Platform headers don't always define 'va_list' in terms of Clang's
'__builtin_va_list', so in addition to checking for our own
synthesized decl, also just look for typedefs literally named
'va_list'. Better to err on the side of false negatives here.

Fix-up for rdar://problem/25846421.

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

7 years ago[Sema] Fix-up for MSVC, which is stricter about template types.
Jordan Rose [Thu, 10 Nov 2016 23:41:18 +0000 (23:41 +0000)]
[Sema] Fix-up for MSVC, which is stricter about template types.

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

7 years agoDon't require nullability on 'va_list'.
Jordan Rose [Thu, 10 Nov 2016 23:28:34 +0000 (23:28 +0000)]
Don't require nullability on 'va_list'.

There are many non-portable typedefs, but va_list is one that nobody
ever thinks of as a pointer or an array. (When's the last time you saw
someone check for a NULL va_list?) Make an exception for this one
special type.

Part of rdar://problem/25846421.

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

7 years agoWarn when 'assume_nonnull' infers nullability within an array.
Jordan Rose [Thu, 10 Nov 2016 23:28:30 +0000 (23:28 +0000)]
Warn when 'assume_nonnull' infers nullability within an array.

...or within a reference. Both of these add an extra level of
indirection that make us less certain that the pointer really was
supposed to be non-nullable. However, changing the default behavior
would be a breaking change, so we'll just make it a warning instead.

Part of rdar://problem/25846421

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

7 years agoAdd -Wnullability-completeness-on-arrays.
Jordan Rose [Thu, 10 Nov 2016 23:28:26 +0000 (23:28 +0000)]
Add -Wnullability-completeness-on-arrays.

This is an addition to (and sub-warning of) -Wnullability-completeness
that warns when an array parameter is missing nullability. When the
specific warning is switched off, the compiler falls back to only
warning on pointer types written as pointer types.

Note that use of nullability /within/ an array triggers the
completeness checks regardless of whether or not the array-specific
warning is enabled; the intent there is simply to determine whether a
particular header is trying to be nullability-aware at all.

Part of rdar://problem/25846421.

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

7 years agoAccept nullability qualifiers on array parameters.
Jordan Rose [Thu, 10 Nov 2016 23:28:17 +0000 (23:28 +0000)]
Accept nullability qualifiers on array parameters.

Since array parameters decay to pointers, '_Nullable' and friends
should be available for use there as well. This is especially
important for parameters that are typedefs of arrays. The unsugared
syntax for this follows the syntax for 'static'-sized arrays in C:

  void test(int values[_Nullable]);

This syntax was previously accepted but the '_Nullable' (and any other
attributes) were silently discarded. However, applying '_Nullable' to
a typedef was previously rejected and is now accepted; therefore, it
may be necessary to test for the presence of this feature:

  #if __has_feature(nullability_on_arrays)

One important change here is that DecayedTypes don't always
immediately contain PointerTypes anymore; they may contain an
AttributedType instead. This only affected one place in-tree, so I
would guess it's not likely to cause problems elsewhere.

This commit does not change -Wnullability-completeness just yet. I
want to think about whether it's worth doing something special to
avoid breaking existing clients that compile with -Werror. It also
doesn't change '#pragma clang assume_nonnull' behavior, which
currently treats the following two declarations as equivalent:

  #pragma clang assume_nonnull begin
  void test(void *pointers[]);
  #pragma clang assume_nonnull end

  void test(void * _Nonnull pointers[]);

This is not the desired behavior, but changing it would break
backwards-compatibility. Most likely the best answer is going to be
adding a new warning.

Part of rdar://problem/25846421

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

7 years ago[index] Add SymbolSubKind for the GKInspectable annotation.
Argyrios Kyrtzidis [Thu, 10 Nov 2016 23:27:11 +0000 (23:27 +0000)]
[index] Add SymbolSubKind for the GKInspectable annotation.

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

7 years ago[test] Remove implicit deps on libLTO.dylib on Darwin (NFC)
Vedant Kumar [Thu, 10 Nov 2016 22:31:06 +0000 (22:31 +0000)]
[test] Remove implicit deps on libLTO.dylib on Darwin (NFC)

This un-breaks the `check-clang` target.

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

7 years ago[clang-format] Fix PR30527: Regression when clang-format insert spaces in [] when...
Nico Weber [Thu, 10 Nov 2016 21:49:25 +0000 (21:49 +0000)]
[clang-format] Fix PR30527: Regression when clang-format insert spaces in [] when in template

Actual regression was introduced in r272668. This revision fixes JS script, but
also regress Cpp case. It manifests with spaces added when template is followed
with array. Bug 30527 mentions case of array as a nested template type
(foo<bar<baz>[]>). Fix is to detect such case and to prevent treating it as
array initialization, but as a subscript case. However, before r272668, this
case was treated simple because we were detecting it as a StartsObjCMethodExpr.
Same was true for other similar case - array of templates (foo<int>[]). This
patch tries to address two problems: 1) fixing regression 2) making sure both
cases (array as a nested type, array of templates) which were entering
StartsObjCMethodExpr branch are handled now appropriately.

https://reviews.llvm.org/D26163
Patch from Branko Kokanovic <branko@kokanovic.org>!

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

7 years ago[Sema] Range-ify for loop, add period to comment. NFC.
George Burgess IV [Thu, 10 Nov 2016 21:47:12 +0000 (21:47 +0000)]
[Sema] Range-ify for loop, add period to comment. NFC.

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

7 years agoClean up uses of unique_ptr for RAII objects. NFC.
George Burgess IV [Thu, 10 Nov 2016 20:43:52 +0000 (20:43 +0000)]
Clean up uses of unique_ptr for RAII objects. NFC.

- EnterExpressionEvaluationContext allows you to specify whether you
  *actually* want to enter an evaluation context.
- For types that don't allow that, llvm::Optional<Foo> should do the
  same thing as std::unique_ptr<Foo>, but with 100% less heap
  allocations.

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

7 years agoCorrecting a documentation formatting bug; NFC.
Aaron Ballman [Thu, 10 Nov 2016 19:45:49 +0000 (19:45 +0000)]
Correcting a documentation formatting bug; NFC.

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

7 years agoAdd -Wduplicate-protocol for existing diagnostic
Alex Lorenz [Thu, 10 Nov 2016 18:30:26 +0000 (18:30 +0000)]
Add -Wduplicate-protocol for existing diagnostic

Expose a warning flag for warn_duplicate_protocol_def. This allows control
over the severity of duplicate protocol definitions.

For example -Werror=duplicate-protocol or
#pragma clang diagnostic ignored "-Wduplicate-protocol".

Patch provided by Dave Lee!

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

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

7 years agodrop kw_module from ASI protection block
Martin Probst [Thu, 10 Nov 2016 16:21:04 +0000 (16:21 +0000)]
drop kw_module from ASI protection block

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

7 years agoclang-format: [JS] do not break after declare namespace.
Martin Probst [Thu, 10 Nov 2016 16:21:02 +0000 (16:21 +0000)]
clang-format: [JS] do not break after declare namespace.

Summary:
See TypeScript grammar for tokens following 'declare':
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#A.10

Additional minor change:
clang-format: [JS] Prevent ASI before const.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoclang-format: [JS] do not break after declare namespace.
Martin Probst [Thu, 10 Nov 2016 16:20:58 +0000 (16:20 +0000)]
clang-format: [JS] do not break after declare namespace.

See TypeScript grammar for tokens following 'declare':
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#A.10

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

7 years ago[Sema] Avoid -Wshadow warnings for shadowed variables that
Alex Lorenz [Thu, 10 Nov 2016 16:19:11 +0000 (16:19 +0000)]
[Sema] Avoid -Wshadow warnings for shadowed variables that
aren't captured by lambdas with a default capture specifier

This commit is a follow-up to r286354. It avoids the -Wshadow warning for
variables which shadow variables that aren't captured by lambdas with a default
capture specifier. It provides an additional note that points to location of
the capture.

The old behaviour is preserved with -Wshadow-all or -Wshadow-uncaptured-local.

rdar://14984176

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

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

7 years agoAdd the loop end location to the loop metadata. This additional information
Amara Emerson [Thu, 10 Nov 2016 14:44:30 +0000 (14:44 +0000)]
Add the loop end location to the loop metadata. This additional information
can be used to improve the locations when generating remarks for loops.

Depends on the companion LLVM change r286227.

Patch by Florian Hahn.

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

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

7 years ago[PowerPC] Implement plain VSX load/store builtins.
Tony Jiang [Thu, 10 Nov 2016 14:39:56 +0000 (14:39 +0000)]
[PowerPC] Implement plain VSX load/store builtins.

Implement all the different 24 overloads for vec_xl and vec_xst.

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

7 years agoMake output of -ast-print a valid C++ code.
Serge Pavlov [Thu, 10 Nov 2016 08:49:37 +0000 (08:49 +0000)]
Make output of -ast-print a valid C++ code.

Output generated by option -ast-print looks like C/C++ code, and it
really is for plain C. For C++ the produced output was not valid C++
code, but the differences were small. With this change the output
is fixed and can be compiled. Tests are changed so that output produced
by -ast-print is compiled again with the same flags and both outputs are
compared.

Option -ast-print is extensively used in clang tests but it itself
was tested poorly, existing tests only checked that compiler did not
crash. There are unit tests in file DeclPrinterTest.cpp, but they test
only terse output mode.

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

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

7 years ago[libclang] Fix issue with clang_tokenize and make sure it interprets CXSourceRange...
Argyrios Kyrtzidis [Wed, 9 Nov 2016 23:58:39 +0000 (23:58 +0000)]
[libclang] Fix issue with clang_tokenize and make sure it interprets CXSourceRange as half-open character range.

Patch provided by Emilio Cobos Álvarez! (https://reviews.llvm.org/D26446)

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

7 years ago[Sema] Use MS ABI behavior for dllexport in Itanium
Shoaib Meenai [Wed, 9 Nov 2016 23:52:20 +0000 (23:52 +0000)]
[Sema] Use MS ABI behavior for dllexport in Itanium

Similar to r284288, make the Itanium ABI follow MS ABI dllexport
semantics in the case of an explicit instantiation declaration followed
by a dllexport explicit instantiation definition.

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

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

7 years agoRemove extra whitespace
Adrian Prantl [Wed, 9 Nov 2016 23:10:44 +0000 (23:10 +0000)]
Remove extra whitespace

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

7 years agoRelax testcase so it also works on Windows.
Adrian Prantl [Wed, 9 Nov 2016 23:05:16 +0000 (23:05 +0000)]
Relax testcase so it also works on Windows.

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

7 years ago[Sema][NFC] Reset HasFallthroughStmt when clearing FunctionScopeInfo
Erik Pilkington [Wed, 9 Nov 2016 22:52:23 +0000 (22:52 +0000)]
[Sema][NFC] Reset HasFallthroughStmt when clearing FunctionScopeInfo

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

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

7 years agoUse an artificial debug location for non-virtual thunks.
Adrian Prantl [Wed, 9 Nov 2016 21:43:51 +0000 (21:43 +0000)]
Use an artificial debug location for non-virtual thunks.
Thunks are artificial and have no corresponding source location except for the
line number on the DISubprogram, which is marked as artificial.

<rdar://problem/11941095>

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

7 years ago[Sparc] Unbreak test
Douglas Katzman [Wed, 9 Nov 2016 17:02:07 +0000 (17:02 +0000)]
[Sparc] Unbreak test

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

7 years ago[Sparc] LLONG is not lock-free atomic on v8
Douglas Katzman [Wed, 9 Nov 2016 15:43:51 +0000 (15:43 +0000)]
[Sparc] LLONG is not lock-free atomic on v8

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

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

7 years agoclang-format: [TypeScript] Fix bug in handling of non-null operator.
Daniel Jasper [Wed, 9 Nov 2016 14:12:55 +0000 (14:12 +0000)]
clang-format: [TypeScript] Fix bug in handling of non-null operator.

Before:
  var i = x!-1;

After:
  var i = x! - 1;

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

7 years ago[AST] Dump dependent scope member expression with its member name
Alex Lorenz [Wed, 9 Nov 2016 14:02:18 +0000 (14:02 +0000)]
[AST] Dump dependent scope member expression with its member name

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

7 years ago[CodeCompletion] Show block invocation results for block property setters
Alex Lorenz [Wed, 9 Nov 2016 13:43:18 +0000 (13:43 +0000)]
[CodeCompletion] Show block invocation results for block property setters

This commit changes the code completion results for block property setters:
The default block property result is now a block invocation rather than a simple
property reference.

rdar://28846196

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

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

7 years agoReplace TimeValue with TimePoint in BuildSystem.cpp. NFC.
Pavel Labath [Wed, 9 Nov 2016 11:19:39 +0000 (11:19 +0000)]
Replace TimeValue with TimePoint in BuildSystem.cpp. NFC.

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

7 years ago[VFS] Replace TimeValue usage with std::chrono
Pavel Labath [Wed, 9 Nov 2016 10:52:22 +0000 (10:52 +0000)]
[VFS] Replace TimeValue usage with std::chrono

Summary: NFCI

Reviewers: benlangmuir, zturner

Subscribers: cfe-commits

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

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

7 years ago[Sema] Avoid -Wshadow warnings for shadowed variables that aren't captured
Alex Lorenz [Wed, 9 Nov 2016 10:38:57 +0000 (10:38 +0000)]
[Sema] Avoid -Wshadow warnings for shadowed variables that aren't captured
by lambdas with an explicit capture list

This commit avoids the -Wshadow warning for variables which shadow variables
that aren't captured by lambdas with an explicit capture list. It provides an
additional note that points to location of the explicit capture.

The old behaviour is preserved with -Wshadow-all or -Wshadow-uncaptured-local.

rdar://17135966

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

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

7 years ago[AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is...
Craig Topper [Wed, 9 Nov 2016 04:51:03 +0000 (04:51 +0000)]
[AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is also enabled.

Summary: This is needed to make the v64i8 and v32i16 types legal for the 512-bit VBMI instructions. Fixes PR30912.

Reviewers: delena, zvi

Subscribers: RKSimon, cfe-commits

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

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

7 years agoDoxygen comments for avxintrin.h.
Ekaterina Romanova [Wed, 9 Nov 2016 03:58:30 +0000 (03:58 +0000)]
Doxygen comments for avxintrin.h.

Added doxygen comments to avxintrin.h's intrinsics. As of now, around 75% of the
intrinsics in this file are documented here. The patches for the other 25% will be se
nt out later.

Removed extra spaces in emmitrin.h.

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

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

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

7 years ago[index] Fix issue with protocol name locations in conformance list of an ObjC class...
Argyrios Kyrtzidis [Wed, 9 Nov 2016 02:47:07 +0000 (02:47 +0000)]
[index] Fix issue with protocol name locations in conformance list of an ObjC class when they come from a typedef.

The ObjC class protocol list assumes there is an associated location for each protocol but no location is provided
when the protocol list comes from a typedef, and we end up with a buffer overflow when trying to get locations for the protocol names.

Fixes crash of rdar://28980278.

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

7 years agoclang-cl: Pass /Zc:threadSafeInit through to MSVC with /fallback (PR30948)
Hans Wennborg [Wed, 9 Nov 2016 00:56:42 +0000 (00:56 +0000)]
clang-cl: Pass /Zc:threadSafeInit through to MSVC with /fallback (PR30948)

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

7 years agoEmit debug info for global constants whose address is taken exactly once.
Adrian Prantl [Wed, 9 Nov 2016 00:42:03 +0000 (00:42 +0000)]
Emit debug info for global constants whose address is taken exactly once.

Add a check to the DeclCache before emitting debug info for a
GlobalVariable a second time and just attach the previsously created one to it.

<rdar://problem/26721101>

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

7 years ago[CUDA] Use only the GVALinkage on function definitions.
Justin Lebar [Tue, 8 Nov 2016 23:45:51 +0000 (23:45 +0000)]
[CUDA] Use only the GVALinkage on function definitions.

Summary:
Previously we'd look at the GVALinkage of whatever FunctionDecl you
happened to be calling.

This is not right.  In the absence of the gnu_inline attribute, to be
handled separately, the function definition determines the function's
linkage.  So we need to wait until we get a def before we can know
whether something is known-emitted.

Reviewers: tra

Subscribers: cfe-commits, rsmith

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

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

7 years ago[analyzer] Provide Contains() on ImmutableMap program state partial trait.
Dominic Chen [Tue, 8 Nov 2016 22:39:14 +0000 (22:39 +0000)]
[analyzer] Provide Contains() on ImmutableMap program state partial trait.

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

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

7 years agoRevert "Define __ANDROID_API__ for all Android builds."
Stephen Hines [Tue, 8 Nov 2016 21:54:49 +0000 (21:54 +0000)]
Revert "Define __ANDROID_API__ for all Android builds."

Summary: This reverts commit a8804ddd9fe71304b28e5b834d134fe93e568ee0.

Subscribers: cfe-commits, pirama, eugenis, tberghammer, danalbert

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

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

7 years agoDefine __ANDROID_API__ for all Android builds.
Stephen Hines [Tue, 8 Nov 2016 21:23:26 +0000 (21:23 +0000)]
Define __ANDROID_API__ for all Android builds.

Summary:
Bug: https://llvm.org/bugs/show_bug.cgi?id=30940

This macro (along with __ANDROID__) should always be defined for Android
targets. We set it to the major (only) version of the Android API being
compiled for. The Android version is able to be set as an integer suffix
for any valid Android target.

Reviewers: danalbert, eugenis

Subscribers: cfe-commits, pirama, eugenis, tberghammer, danalbert

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

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

7 years agoRemove FormatContext from libClang as it is now unused.
Daniel Jasper [Tue, 8 Nov 2016 19:47:19 +0000 (19:47 +0000)]
Remove FormatContext from libClang as it is now unused.

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

7 years agoRevert "Remove now unnecessary FormatRewriterContext."
Daniel Jasper [Tue, 8 Nov 2016 18:30:52 +0000 (18:30 +0000)]
Revert "Remove now unnecessary FormatRewriterContext."

This reverts commit r286262. I accidentally committed it without all of
the changes.

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

7 years agoRemove now unnecessary FormatRewriterContext.
Daniel Jasper [Tue, 8 Nov 2016 18:29:19 +0000 (18:29 +0000)]
Remove now unnecessary FormatRewriterContext.

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

7 years ago[clang-format] Remove (SourceManager, FileID) variants
Daniel Jasper [Tue, 8 Nov 2016 16:11:33 +0000 (16:11 +0000)]
[clang-format] Remove (SourceManager, FileID) variants

In Format, remove the reformat() and clean() functions taking a SourceManager
and a FileID. Keep the versions taking StringRef Code.

- there was duplicated functionality
- the FileID versions were harder to use
- the clean() version is dead code anyways

Patch by Krasimir Georgiev. Thank you.

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

7 years ago[X86][AVX512][Clang] Add support for mask_{move|store|load}_s{s/d} and int2mask/mask2...
Ayman Musa [Tue, 8 Nov 2016 12:00:30 +0000 (12:00 +0000)]
[X86][AVX512][Clang] Add support for mask_{move|store|load}_s{s/d} and int2mask/mask2int intrinsics.

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

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

7 years agoTest commit of vbyakovl.
Vladimir Yakovlev [Tue, 8 Nov 2016 10:32:10 +0000 (10:32 +0000)]
Test commit of vbyakovl.

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

7 years agoAdd a method to get the list of registered static analyzer checkers.
Alexander Kornienko [Tue, 8 Nov 2016 07:23:32 +0000 (07:23 +0000)]
Add a method to get the list of registered static analyzer checkers.

Summary:
This provides a better interface for clang-tidy and encapsulates the knowledge
about experimental checkers instead of leaving this to the clients.

Reviewers: zaks.anna

Subscribers: a.sidorin, NoQ, dcoughlin, cfe-commits

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

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

7 years agoIR, Bitcode: Change bitcode reader to no longer own its memory buffer.
Peter Collingbourne [Tue, 8 Nov 2016 06:03:43 +0000 (06:03 +0000)]
IR, Bitcode: Change bitcode reader to no longer own its memory buffer.

Unique ownership is just one possible ownership pattern for the memory buffer
underlying the bitcode reader. In practice, as this patch shows, ownership can
often reside at a higher level. With the upcoming change to allow multiple
modules in a single bitcode file, it will no longer be appropriate for
modules to generally have unique ownership of their memory buffer.

The C API exposes the ownership relation via the LLVMGetBitcodeModuleInContext
and LLVMGetBitcodeModuleInContext2 functions, so we still need some way for
the module to own the memory buffer. This patch does so by adding an owned
memory buffer field to Module, and using it in a few other places where it
is convenient.

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

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

7 years agoclang-format: Use git-ls-tree to get file mode in diff mode
Stephen Hines [Tue, 8 Nov 2016 05:50:14 +0000 (05:50 +0000)]
clang-format: Use git-ls-tree to get file mode in diff mode

Summary:
If a file has been renamed/deleted from the filesystem and --diff mode
with two commits is active, attempting to get the file's mode will fail.
This change uses git-ls-tree instead to get the correct permissions for
the given revision.

Patch by Luis Hector Chavez!

Reviewers: djasper, lodato

Subscribers: srhines, cfe-commits

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

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

7 years agocmake: Don't try to install exports if there aren't any
Justin Bogner [Tue, 8 Nov 2016 05:02:33 +0000 (05:02 +0000)]
cmake: Don't try to install exports if there aren't any

When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for clang's
export list to be empty. If this happens the install(EXPORTS) command
will fail, but since there isn't anything to install anyway we really
just want to skip it.

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

7 years agoBitcode: Decouple block info block state from reader.
Peter Collingbourne [Tue, 8 Nov 2016 04:17:11 +0000 (04:17 +0000)]
Bitcode: Decouple block info block state from reader.

As proposed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-October/106630.html

Move block info block state to a new class, BitstreamBlockInfo.
Clients may set the block info for a particular cursor with the
BitstreamCursor::setBlockInfo() method.

At this point BitstreamReader is not much more than a container for an
ArrayRef<uint8_t>, so remove it and replace all uses with direct uses
of memory buffers.

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

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

7 years ago[PowerPC] Implement remaining vector comparison builtins.
Tony Jiang [Tue, 8 Nov 2016 04:15:45 +0000 (04:15 +0000)]
[PowerPC] Implement remaining vector comparison builtins.

vector bool char vec_cmpeq (vector bool char, vector bool char);
vector bool int vec_cmpeq (vector bool int, vector bool int);
vector bool long long vec_cmpeq (vector bool long long, vector bool long lon
vector bool short vec_cmpeq (vector bool short, vector bool short);

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

7 years agoMake a const variable static. NFC.
George Burgess IV [Tue, 8 Nov 2016 03:30:49 +0000 (03:30 +0000)]
Make a const variable static. NFC.

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

7 years agoCorrectly ignore unnamed bit-fields when checking whether a union has fields.
Richard Smith [Tue, 8 Nov 2016 01:07:26 +0000 (01:07 +0000)]
Correctly ignore unnamed bit-fields when checking whether a union has fields.

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

7 years agocmake: Support exports correctly with LLVM_DISTRIBUTION_COMPONENTS
Justin Bogner [Mon, 7 Nov 2016 23:46:05 +0000 (23:46 +0000)]
cmake: Support exports correctly with LLVM_DISTRIBUTION_COMPONENTS

We need to apply the same export logic in clang as in llvm for
LLVM_DISTRIBUTION_COMPONENTS, or the clang exports will be invalid
when we use this config.

This makes using distribution components without setting
LLVM_TOOLCHAIN_ONLY=On work correctly.

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

7 years ago[index] Handle properly C++14's template variables.
Argyrios Kyrtzidis [Mon, 7 Nov 2016 21:20:15 +0000 (21:20 +0000)]
[index] Handle properly C++14's template variables.

- Infer the right symbol kind.
- Provide a templated USR, similar to how we handle class templates.

rdar://28980398

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

7 years ago[index] Make sure to mark class template symbols as having 'generic' sub-kind.
Argyrios Kyrtzidis [Mon, 7 Nov 2016 21:20:08 +0000 (21:20 +0000)]
[index] Make sure to mark class template symbols as having 'generic' sub-kind.

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

7 years agoName some anonymous structs to avoid using a (very common) extension.
John McCall [Mon, 7 Nov 2016 21:13:27 +0000 (21:13 +0000)]
Name some anonymous structs to avoid using a (very common) extension.

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

7 years agoUpdated ASTMerge/macro.m to use _Nullable.
Sean Callanan [Mon, 7 Nov 2016 21:10:31 +0000 (21:10 +0000)]
Updated ASTMerge/macro.m to use _Nullable.

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

7 years agoUse -fsanitize-recover instead of -mllvm -msan-keep-going: clang.
Evgeniy Stepanov [Mon, 7 Nov 2016 21:02:11 +0000 (21:02 +0000)]
Use -fsanitize-recover instead of -mllvm -msan-keep-going: clang.

Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going: pass -fsanitize-recover value to msan.

Reviewers: eugenis

Subscribers: cfe-commits

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

Patch by Aleksey Shlyapnikov.

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

7 years agoWhen the ASTImporter imports a source location, it avoids importing macro
Sean Callanan [Mon, 7 Nov 2016 20:42:25 +0000 (20:42 +0000)]
When the ASTImporter imports a source location, it avoids importing macro
expansions by calling getSpellingLoc(). That's great in most cases, but for
macros defined in the '<built-in>' source file, the source file is invalid
and does not import correctly, causing an assertion failure (the assertion
is Invalid SLocOffset or bad function choice).

A more reliable way to avoid this is to use getFileLoc(), which does not
return built-in locations. This avoids the crash but still preserves valid
source locations.

I've added a testcase that covers the previously crashing scenario.

https://reviews.llvm.org/D26054

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

7 years agoFix memory leak caused by r286096.
Eric Liu [Mon, 7 Nov 2016 18:40:41 +0000 (18:40 +0000)]
Fix memory leak caused by r286096.

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

7 years ago[OPENMP] Fixed codegen for __real/__imag expressions in atomic
Alexey Bataev [Mon, 7 Nov 2016 18:15:02 +0000 (18:15 +0000)]
[OPENMP] Fixed codegen for __real/__imag expressions in atomic
constructs.

For __real/__imag unary expressions clang emits lvalue with the
associated type from the original complex expression, but not the
underlying builtin integer or float type. This causes crash in codegen
for atomic constructs, if __real/__imag expression are used in atomic
  constructs.

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