]> granicus.if.org Git - clang/log
clang
7 years agoRevert "[OPENMP] Fixed capturing of VLA variables."
Diana Picus [Mon, 7 Nov 2016 10:01:43 +0000 (10:01 +0000)]
Revert "[OPENMP] Fixed capturing of VLA variables."

This reverts commit r286098 because the modified test breaks on many of the
buildbots.

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

7 years ago[OPENMP] Fixed capturing of VLA variables.
Alexey Bataev [Mon, 7 Nov 2016 08:07:25 +0000 (08:07 +0000)]
[OPENMP] Fixed capturing of VLA variables.

After some changes in codegen capturing of VLA variables in OpenMP
regions was broken, causing compiler crash. Patch fixes this issue.

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

7 years ago[AVX-512][Sema] Add more intrinsics to the checks for valid immediates for embedded...
Craig Topper [Mon, 7 Nov 2016 07:01:09 +0000 (07:01 +0000)]
[AVX-512][Sema] Add more intrinsics to the checks for valid immediates for embedded rounding control arguments.

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

7 years agoDeduplicate replacements by FileEntry instead of file names.
Eric Liu [Mon, 7 Nov 2016 06:08:23 +0000 (06:08 +0000)]
Deduplicate replacements by FileEntry instead of file names.

Summary:
The current version does not deduplicate equivalent file paths correctly.
For example, a relative path and an absolute path are considered inequivalent.
Comparing FileEnry addresses these issues.

Reviewers: djasper

Subscribers: alexshap, klimek, cfe-commits

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

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

7 years agoclang-format: Better support for CUDA's triple brackets.
Daniel Jasper [Sat, 5 Nov 2016 17:43:16 +0000 (17:43 +0000)]
clang-format: Better support for CUDA's triple brackets.

Before:
  aaaaaaaaaaaaaaa<
      aaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaa><<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>>>();

After:
  aaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>
      <<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>>>();

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

7 years ago[test] Test that static_assert is properly visited in liblcang
Olivier Goffart [Fri, 4 Nov 2016 12:04:16 +0000 (12:04 +0000)]
[test] Test that static_assert is properly visited in liblcang

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

7 years ago[python bindings] Expose CXCursor_FriendDecl as CursorKind.FRIEND_DECL
Olivier Goffart [Fri, 4 Nov 2016 06:50:59 +0000 (06:50 +0000)]
[python bindings] Expose CXCursor_FriendDecl as CursorKind.FRIEND_DECL

CXCursor_FriendDecl was added in r285984

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

7 years agoAdd some more asserts to clearly indicate that there are special cases
Chandler Carruth [Fri, 4 Nov 2016 06:32:57 +0000 (06:32 +0000)]
Add some more asserts to clearly indicate that there are special cases
which guarantee pointers are not null. These all seem to have useful
properties and correlations to document, in one case we even had it in
a comment but now it will also be an assert.

This should prevent PVS-Studio from incorrectly claiming that there are
a bunch of potential bugs here. But I feel really strongly that the
PVS-Studio warnings that pointed at this code have a far too high
false-positive rate to be entirely useful. These are just places where
there did seem to be a useful invariant to document and verify with an
assert. Several other places in the code were already correct and
already have perfectly clear code documenting and validating their
invariants, but still ran afoul of PVS-Studio.

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

7 years ago[index] Expose FriendDecl
Olivier Goffart [Fri, 4 Nov 2016 06:29:27 +0000 (06:29 +0000)]
[index] Expose FriendDecl

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

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

7 years agoDelete a trivially true check for a variable 'S' being null.
Chandler Carruth [Fri, 4 Nov 2016 06:16:09 +0000 (06:16 +0000)]
Delete a trivially true check for a variable 'S' being null.

The exact same test guards entry into the loop in which this test
occurs, and there is nothing inside the loop that assigns to the
variable, so it has already been checked for null.

This was flagged by PVS-Studio as well, but the report is actually wrong
-- this is not a case where we dereference a variable prior to testing
it for null, this is a case where we have a redundant test for null
after we already performed the exact same test.

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

7 years agoAdd an assert to further check the invariant that a null pointer
Chandler Carruth [Fri, 4 Nov 2016 06:11:54 +0000 (06:11 +0000)]
Add an assert to further check the invariant that a null pointer
corresponds to another argument being valid.

This makes it clear that the code is correct despite the PVS-Studio
report that a pointer might be dereferenced prior to being checked for
whether it is null. It likely is also enough for static analyzers to not
flag the code.

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

7 years agoEnhancement to test for -ast-print
Serge Pavlov [Fri, 4 Nov 2016 06:09:23 +0000 (06:09 +0000)]
Enhancement to test for -ast-print

Present tests for the functionality provided by command lime option
`-ast-print` check only absence of crash. This change tries to make
testing better, - the output produced by the compiler is compiled again
with option `-print-ast` and both outputs are compared. Such test at
least checks that the output is valid code. This change fixes only the
test for pure C.

This is recommit of r285882.

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

7 years agoRemove no-op checks for a null CodeCompleter. We have already
Chandler Carruth [Fri, 4 Nov 2016 06:06:50 +0000 (06:06 +0000)]
Remove no-op checks for a null CodeCompleter. We have already
dereferenced the pointer at this point, and these routines are
exclusively called after the parser encounters a code completion token.
Other code completion routines called at that point do not check for
null either, so this is clearly the current invariant expected in the
code.

This fixes another PVS-Studio found issue.

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

7 years agoDo not print enum underlying type if language is not C++11
Serge Pavlov [Fri, 4 Nov 2016 06:03:34 +0000 (06:03 +0000)]
Do not print enum underlying type if language is not C++11

Output generated by option '-ast-print' must not contains enum
base type specifications if source language does not include C++11.

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

7 years agoRemove the unused POLLY_LINK_LIBS for linking polly into clang
Hongbin Zheng [Thu, 3 Nov 2016 22:02:40 +0000 (22:02 +0000)]
Remove the unused POLLY_LINK_LIBS for linking polly into clang

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

7 years agoAdd debug info support for C++11 inline namespaces.
Adrian Prantl [Thu, 3 Nov 2016 19:42:14 +0000 (19:42 +0000)]
Add debug info support for C++11 inline namespaces.

<rdar://problem/18616046>

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

7 years agoImprove obvious-most-derived-type devirtualization:
Richard Smith [Thu, 3 Nov 2016 18:55:18 +0000 (18:55 +0000)]
Improve obvious-most-derived-type devirtualization:

  * if the base is produced by a series of derived-to-base conversions, check
    the expression inside them when looking for an expression with a known
    dynamic type
  * step past MaterializeTemporaryExprs when checking for a known dynamic type
  * when checking for a known dynamic type, treat all class prvalues as having
    a known dynamic type after skipping all relevant rvalue subobject
    adjustments
  * treat callees formed by pointer-to-member access for a non-reference member
    type like callees formed by member access.

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

7 years agoInstead of resetting the pointer, or releasing it which was the previous
Chandler Carruth [Thu, 3 Nov 2016 18:03:14 +0000 (18:03 +0000)]
Instead of resetting the pointer, or releasing it which was the previous
code, let's just assert that the DiagonsticEngine doesn't own the client
because our constructor took ownership of it and has a std::unique_ptr
that handles deleting it. This seems much more clear -- the release was
harmless but confusing as if there were some memory there it would have
leaked, and the reset was harmless but confusing as if there were some
memory there it would have been double-freed. But in both cases there
was nothing there.

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

7 years agoUsing release to free memory is at best confusing -- one would expect
Chandler Carruth [Thu, 3 Nov 2016 17:42:32 +0000 (17:42 +0000)]
Using release to free memory is at best confusing -- one would expect
that its result is in fact used. Instead, use reset.

This was pointed out by PVS-Studio.

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

7 years agoFix spelling mistake.
Akira Hatanaka [Thu, 3 Nov 2016 17:11:28 +0000 (17:11 +0000)]
Fix spelling mistake.

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

7 years agoFixed column shift when formatting line containing bit shift operators
Malcolm Parsons [Thu, 3 Nov 2016 16:57:30 +0000 (16:57 +0000)]
Fixed column shift when formatting line containing bit shift operators

Summary:
During clang-format source lexing >> and << operators are split and
treated as two less/greater operators but column position of following
tokens was not adjusted accordingly.

Fixes PR26887

Patch by Paweł Żukowski.

Reviewers: djasper

Subscribers: malcolm.parsons, mprobst, klimek, cfe-commits

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

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

7 years agoRename the version of ConstructJob for multiple outputs to ConstructJobMultipleOutputs.
Samuel Antao [Thu, 3 Nov 2016 15:41:50 +0000 (15:41 +0000)]
Rename the version of ConstructJob for multiple outputs to ConstructJobMultipleOutputs.

It was causing trouble with the GCC bots.

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

7 years ago[Sema] Avoid instantiating templates only when UncompilableErrorOccurred
Akira Hatanaka [Thu, 3 Nov 2016 15:04:58 +0000 (15:04 +0000)]
[Sema] Avoid instantiating templates only when UncompilableErrorOccurred
and FatalErrorOccurred are both set.

This fixes a crash that occurs when a warning promoted to a fatal error
leaves the AST in an incomplete state, and then later CFG analysis is
run on the incomplete AST.

rdar://problem/28558923

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

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

7 years agoSupport for Python 3 in libclang python bindings
Jonathan Coe [Thu, 3 Nov 2016 13:55:34 +0000 (13:55 +0000)]
Support for Python 3 in libclang python bindings

Summary:
Python bindings tests now pass in Python 3.

`map` in Python 3 is lazily evaluated so the method by which functions are registered needed updating.

Strings are unicode in Python 3 not UTF-8, I've tried to create an new c_types-like class (c_string_p) to automate the conversion.

String conversions made explicit where required.

Reviewers: eliben, nemanjai, skalinichev, compnerd

Subscribers: mgorny, cfe-commits

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

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

7 years agoRemove redundant calls to std::string::data()
Malcolm Parsons [Thu, 3 Nov 2016 12:25:51 +0000 (12:25 +0000)]
Remove redundant calls to std::string::data()

Reviewers: aaron.ballman, mehdi_amini, dblaikie

Subscribers: klimek, cfe-commits

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

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

7 years agoReverted r285882 (Enhancement to test for -ast-print)
Serge Pavlov [Thu, 3 Nov 2016 08:58:44 +0000 (08:58 +0000)]
Reverted r285882 (Enhancement to test for -ast-print)

It broke buildbot on Windows.

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

7 years agoFix heuristics skipping invalid ctor-initializers with C++11
Olivier Goffart [Thu, 3 Nov 2016 07:36:17 +0000 (07:36 +0000)]
Fix heuristics skipping invalid ctor-initializers with C++11

Use better heuristics to detect if a '{' might be the start of the constructor body
or not. Especially when there is a completion token.

Fix the test 'test/CodeCompletion/ctor-initializer.cpp ' when clang defaults to c++11

The problem was is how we recover invalid code in the ctor-init part as we skip the
function body. In particular, we want to know if a '{' is the begining of the body.
In C++03, we always consider it as the beginng of the body. The problem was that in
C++11, it may be the start of an initializer, so we skip over it, causing further
parse errors later. (It is important that we are able to parse correctly the rest
of the class definition, to know what are the class member, for example)

This commit is improving the heuristics to decide if the '{' is starting a function
body. The rules are the following: If we are not in a template argument, and that the
previous tokens are not an identifier, or a >, then it is much more likely to be the
function body. We verify that further by checking the token after the matching '}'

The commit also fix the behavior when there is a code_completion token in the
ctor-initializers.

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

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

7 years agoEnhancement to test for -ast-print
Serge Pavlov [Thu, 3 Nov 2016 07:32:02 +0000 (07:32 +0000)]
Enhancement to test for -ast-print

Present tests for the functionality provided by command lime option
`-ast-print` check only absence of crash. This change tries to make
testing better, - the output produced by the compiler is compiled again
with option `-print-ast` and both outputs are compared. Such test at
least checks that the output is valid code. This change fixes only the
test for pure C.

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

7 years ago[Sema] Remove a dead assignment, NFC.
Vedant Kumar [Thu, 3 Nov 2016 06:35:16 +0000 (06:35 +0000)]
[Sema] Remove a dead assignment, NFC.

The assignment to NextIsDereference is either followed by (1) another,
unrelated assignment to NextIsDereference or by (2) an early loop exit.

Found by clang's static analyzer: http://llvm.org/reports/scan-build

(While we're at it fix a typo.)

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

7 years ago[CodeGen] Use StringRef. NFC.
George Burgess IV [Thu, 3 Nov 2016 02:21:43 +0000 (02:21 +0000)]
[CodeGen] Use StringRef. NFC.

Looks like CurFn's name outlives FunctionName, so we can just pass
StringRefs around rather than going from a StringRef to a std::string
to a const char* to a StringRef.

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

7 years ago[Sema] Allow static_cast<T&&>(e) to check explicit conversions for non-reference...
Eric Fiselier [Thu, 3 Nov 2016 02:13:17 +0000 (02:13 +0000)]
[Sema] Allow static_cast<T&&>(e) to check explicit conversions for non-reference-related types.

Summary:
[expr.cast.static] states:
> 3. A glvalue of type “cv1 T1” can be cast to type “rvalue reference to cv2 T2” if “cv2 T2” is reference-compatible
> with “cv1 T1”. The result refers to the object or the specified base class subobject thereof. If T2 is
> an inaccessible or ambiguous base class of T1, a program that necessitates such a cast is
> ill-formed.
>
> 4. Otherwise, an expression e can be explicitly converted to a type T using a static_cast of the form static_-
> cast<T>(e) if the declaration T t(e); is well-formed, for some invented temporary variable t. [...]

Currently when checking p3 Clang will diagnose `static_cast<T&&>(e)` as invalid if the argument is not reference compatible with `T`. However I believe the correct behavior is to also check p4 in those cases.  For example:

```
double y = 42;
static_cast<int&&>(y); // this should be OK.  'int&& t(y)' is well formed
```

Note that we still don't check p4 for non-reference-compatible types which are reference-related since  `T&& t(e);` should never be well formed in those cases.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoUpdate manglings for C++17 noexcept function types to match Jason Merrill's
Richard Smith [Thu, 3 Nov 2016 00:27:54 +0000 (00:27 +0000)]
Update manglings for C++17 noexcept function types to match Jason Merrill's
proposal on cxx-abi-dev earlier today.

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

7 years agoTeach clang-query to dump types. I couldn't find any existing tests for clang-query...
Richard Smith [Wed, 2 Nov 2016 23:57:18 +0000 (23:57 +0000)]
Teach clang-query to dump types. I couldn't find any existing tests for clang-query's dumping functionality. =(

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

7 years ago[index] Fix assertion hit when handling a declaration of C++'s 'operator new' function.
Argyrios Kyrtzidis [Wed, 2 Nov 2016 23:42:33 +0000 (23:42 +0000)]
[index] Fix assertion hit when handling a declaration of C++'s 'operator new' function.

Part of this is to allow creating a USR for the canonical decl of that which is implicit and does
not have a source location.

rdar://28978992

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

7 years agoDon't require nullability on template parameters in typedefs.
Jordan Rose [Wed, 2 Nov 2016 20:44:07 +0000 (20:44 +0000)]
Don't require nullability on template parameters in typedefs.

Previously the following code would warn on the use of "T":

  template <typename T>
  struct X {
    typedef T *type;
  };

...because nullability is /allowed/ on template parameters (because
they could be pointers). (Actually putting nullability on this use of
'T' will of course break if the argument is a non-pointer type.)

This fix doesn't handle the case where a template parameter is used
/outside/ of a typedef. That seems trickier, especially in parameter
position.

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

7 years ago[analyzer] StdLibraryFunctions: provide platform-specific function summaries.
Artem Dergachev [Wed, 2 Nov 2016 19:35:20 +0000 (19:35 +0000)]
[analyzer] StdLibraryFunctions: provide platform-specific function summaries.

Because standard functions can be defined differently on different platforms,
this commit introduces a method for constructing summaries with multiple
variants, whichever matches better. It is also useful for supporting overloads.

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

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

7 years agoregcall: Implement regcall Calling Conv in clang
Erich Keane [Wed, 2 Nov 2016 18:29:35 +0000 (18:29 +0000)]
regcall: Implement regcall Calling Conv in clang

This patch implements the register call calling convention, which ensures
as many values as possible are passed in registers. CodeGen changes
were committed in https://reviews.llvm.org/rL284108.

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

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

7 years agoSimplify the test case from r285289.
Alex Lorenz [Wed, 2 Nov 2016 16:11:30 +0000 (16:11 +0000)]
Simplify the test case from r285289.

This commit simplifies and clarifies the test code
that was added in r285289.

Suggested by David Blaikie.

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

7 years agoAdd a note that points to the linkage specifier for the C++ linkage errors
Alex Lorenz [Wed, 2 Nov 2016 15:46:34 +0000 (15:46 +0000)]
Add a note that points to the linkage specifier for the C++ linkage errors

This commit improves the "must have C++ linkage" error diagnostics that are
emitted for C++ declarations like templates and literal operators by adding an
additional note that points to the appropriate extern "C" linkage specifier.

rdar://19021120

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

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

7 years ago[asan] Use the dynamic ASan runtime if -shared-libasan is passed
Reid Kleckner [Wed, 2 Nov 2016 15:38:51 +0000 (15:38 +0000)]
[asan] Use the dynamic ASan runtime if -shared-libasan is passed

-shared-libasan is likely to be used as a link flag if the user is using
the GCC-style clang driver.

This logic is already tested in clang-cl tests, and the new flag to
exercise it will be covered by asan tests.

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

7 years agoTurn on the /bigobj switch for RecursiveASTVisitorTest.cpp; we are now bumping up...
Aaron Ballman [Wed, 2 Nov 2016 14:31:36 +0000 (14:31 +0000)]
Turn on the /bigobj switch for RecursiveASTVisitorTest.cpp; we are now bumping up against that limit with MSVC 2015 in Win64 debug build mode.

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

7 years agoFix Clang-tidy readability-redundant-string-cstr warnings
Malcolm Parsons [Wed, 2 Nov 2016 10:39:27 +0000 (10:39 +0000)]
Fix Clang-tidy readability-redundant-string-cstr warnings

Reviewers: aaron.ballman, mehdi_amini, dblaikie

Subscribers: cfe-commits

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

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

7 years agoMore forcibly resolve exception specifications when checking a function
Richard Smith [Wed, 2 Nov 2016 00:47:52 +0000 (00:47 +0000)]
More forcibly resolve exception specifications when checking a function
redeclaration in C++1z mode. We need the exception specification in order for
the function's type to be complete.

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

7 years agoBitcode: Change reader interface to take memory buffers.
Peter Collingbourne [Wed, 2 Nov 2016 00:08:19 +0000 (00:08 +0000)]
Bitcode: Change reader interface to take memory buffers.

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

This change also fixes an API oddity where BitstreamCursor::Read() would
return zero for the first read past the end of the bitstream, but would
report_fatal_error for subsequent reads. Now we always report_fatal_error
for all reads past the end. Updated clients to check for the end of the
bitstream before reading from it.

I also needed to add padding to the invalid bitcode tests in
test/Bitcode/. This is because the streaming interface was not checking that
the file size is a multiple of 4.

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

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

7 years ago[analyzer] Fix capitalization in ObjCSuperDealloc checker diagnostic.
Devin Coughlin [Tue, 1 Nov 2016 22:16:39 +0000 (22:16 +0000)]
[analyzer] Fix capitalization in ObjCSuperDealloc checker diagnostic.

Change "use of 'self'..." to "Use of 'self'...". The convention is to
start diagnostics with a capital letter.

rdar://problem/28322494

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

7 years ago[test] Fix detecting LLVM zlib support in stand-alone builds
Michal Gorny [Tue, 1 Nov 2016 20:31:52 +0000 (20:31 +0000)]
[test] Fix detecting LLVM zlib support in stand-alone builds

Fix the test run to declare missing HAVE_LIBZ value in stand-alone
builds, using the LLVM_ENABLE_ZLIB that is exported in LLVMConfig.cmake.

When using in-tree builds, HAVE_LIBZ is declared in
cmake/config-ix.cmake as a result of LLVM's CMake checks. When building
stand-alone, this value is not available and as a result caused clang to
wrongly assume that LLVM was built without zlib support.

To fix it, set it to the value of LLVM_ENABLE_ZLIB. While this variable
is originally used to control the user preference, LLVM updates its
value to 0 if zlib checks fail. Therefore, we can use it to reliably
determine whether LLVM was built with zlib support or not.

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

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

7 years agoclang/test/CodeGenOpenCL/convergent.cl: Satisfy -Asserts with "opt -instnamer".
NAKAMURA Takumi [Tue, 1 Nov 2016 20:08:17 +0000 (20:08 +0000)]
clang/test/CodeGenOpenCL/convergent.cl: Satisfy -Asserts with "opt -instnamer".

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

7 years ago[OpenCL] Mark group functions as convergent in opencl-c.h
Yaxun Liu [Tue, 1 Nov 2016 18:45:32 +0000 (18:45 +0000)]
[OpenCL] Mark group functions as convergent in opencl-c.h

Certain OpenCL builtin functions are supposed to be executed by all threads in a work group or sub group. Such functions should not be made divergent during transformation. It makes sense to mark them with convergent attribute.

The adding of convergent attribute is based on Ettore Speziale's work and the original proposal and patch can be found at https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg22271.html.

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

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

7 years ago[OpenCL] Override supported OpenCL extensions with -cl-ext option
Alexey Bader [Tue, 1 Nov 2016 15:50:52 +0000 (15:50 +0000)]
[OpenCL] Override supported OpenCL extensions with -cl-ext option

Summary:
This patch adds a command line option '-cl-ext' to control a set of
supported OpenCL extensions. Option accepts a comma-separated list
of extensions prefixed with '+' or '-'.

It can be used together with a target triple to override support for some
extensions:

  // spir target supports all extensions, but we want to disable fp64
  clang -cc1 -triple spir-unknown-unknown -cl-ext=-cl_khr_fp64

Special 'all' extension allows to enable or disable all possible
extensions:

  // only fp64 will be supported
  clang -cc1 -triple spir-unknown-unknown -cl-ext=-all,+cl_khr_fp64

Patch by asavonic (Andrew Savonichev).

Reviewers: joey, yaxunl

Subscribers: yaxunl, bader, Anastasia, cfe-commits

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

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

7 years ago[PowerPC] Implement vector shift builtins - clang portion
Nemanja Ivanovic [Tue, 1 Nov 2016 14:46:20 +0000 (14:46 +0000)]
[PowerPC] Implement vector shift builtins - clang portion

This patch corresponds to review https://reviews.llvm.org/D26092.
Committing on behalf of Tony Jiang.

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

7 years ago[x86][inline-asm][clang] accept 'v' constraint
Michael Zuckerman [Tue, 1 Nov 2016 13:16:44 +0000 (13:16 +0000)]
[x86][inline-asm][clang] accept 'v' constraint
Commit on behalf of: Coby Tayree

1.'v' constraint for (x86) non-avx arch imitates the already implemented 'x' constraint, i.e. allows XMM{0-15} & YMM{0-15} depending on the apparent arch & mode (32/64).
2.for the avx512 arch it allows [X,Y,Z]MM{0-31} (mode dependent)

This patch applies the needed changes to clang
LLVM patch: https://reviews.llvm.org/D25005

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

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

7 years ago[www] Fix a typo on the analyzer website
Alex Lorenz [Tue, 1 Nov 2016 11:12:41 +0000 (11:12 +0000)]
[www] Fix a typo on the analyzer website

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

7 years agoFix parenthesized assert (nfc).
Manuel Klimek [Tue, 1 Nov 2016 10:30:50 +0000 (10:30 +0000)]
Fix parenthesized assert (nfc).

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

7 years ago[PPC] Add vec_absd functions to altivec.h
Nemanja Ivanovic [Tue, 1 Nov 2016 08:39:56 +0000 (08:39 +0000)]
[PPC] Add vec_absd functions to altivec.h

This patch corresponds to review https://reviews.llvm.org/D26073.
Committing on behalf of Sean Fertile.

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

7 years agoclang-format: Fix bug in function reference qualifier detection.
Daniel Jasper [Tue, 1 Nov 2016 06:23:19 +0000 (06:23 +0000)]
clang-format: Fix bug in function reference qualifier detection.

Before:
  template <typename T>
      void F(T) &&
      = delete;

After:
  template <typename T>
  void F(T) && = delete;

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

7 years agoclang-format: Fix incorrect pointer detection.
Daniel Jasper [Tue, 1 Nov 2016 06:23:14 +0000 (06:23 +0000)]
clang-format: Fix incorrect pointer detection.

Before:
  void f() { f(float{1}, a *a); }

After:
  void f() { f(float{1}, a * a); }

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

7 years agoclang-format: [JS] Fix incorrect space when "as" is used as identifier.
Daniel Jasper [Tue, 1 Nov 2016 06:23:10 +0000 (06:23 +0000)]
clang-format: [JS] Fix incorrect space when "as" is used as identifier.

Before:
  aaaaa.as ();

After:
  aaaaa.as();

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

7 years agoclang-format: Fix incorrect binary operator detection.
Daniel Jasper [Tue, 1 Nov 2016 06:23:05 +0000 (06:23 +0000)]
clang-format: Fix incorrect binary operator detection.

Before:
  int x = f(* + [] {});

After:
  int x = f(*+[] {});

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

7 years agoclang-format: [JS] Fix formatting of generator functions.
Daniel Jasper [Tue, 1 Nov 2016 06:22:59 +0000 (06:22 +0000)]
clang-format: [JS] Fix formatting of generator functions.

Before:
  var x = {
    a: function*
() {
  //
}
  }

After:
  var x = {
    a: function*() {
      //
    }
  }

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

7 years agoclang-format: [JS] Fix space when for is used as regular identifier.
Daniel Jasper [Tue, 1 Nov 2016 06:22:54 +0000 (06:22 +0000)]
clang-format: [JS] Fix space when for is used as regular identifier.

Before:
  x.for () = 1;

After:
  x.for() = 1;

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

7 years ago[AVX-512] Remove masked vector insert builtins and replace with native shufflevectors...
Craig Topper [Tue, 1 Nov 2016 05:47:56 +0000 (05:47 +0000)]
[AVX-512] Remove masked vector insert builtins and replace with native shufflevectors and selects.

Unfortunately, the backend currently doesn't fold masks into the instructions correctly when they come from these shufflevectors. I'll work on that in a future commit.

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

7 years ago[index] Avoid using a RecursiveASTVisitor for SyntacticFormIndexer and iterate the...
Argyrios Kyrtzidis [Tue, 1 Nov 2016 04:29:39 +0000 (04:29 +0000)]
[index] Avoid using a RecursiveASTVisitor for SyntacticFormIndexer and iterate the DesignatedInitExprs of the InitListExpr directly.

This is more efficient, as per feedback by Richard.

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

7 years agoImplement ABI proposal for throwing noexcept function pointers, per discussion
Richard Smith [Tue, 1 Nov 2016 01:34:46 +0000 (01:34 +0000)]
Implement ABI proposal for throwing noexcept function pointers, per discussion
on cxx-abi-dev (thread starting 2016-10-11). This is currently hidden behind a
cc1-only -m flag, pending discussion of how best to deal with language changes
that require use of new symbols from the ABI library.

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

7 years agop0012: Teach resolving address of overloaded function with dependent exception
Richard Smith [Tue, 1 Nov 2016 01:31:23 +0000 (01:31 +0000)]
p0012: Teach resolving address of overloaded function with dependent exception
specification to resolve the exception specification as part of the type check,
in C++1z onwards. This is not actually part of P0012 / CWG1330 rules for when
an exception specification is "needed", but is necessary for sanity.

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

7 years agoBitcode: Simplify BitstreamWriter::EnterBlockInfoBlock() interface.
Peter Collingbourne [Tue, 1 Nov 2016 01:18:57 +0000 (01:18 +0000)]
Bitcode: Simplify BitstreamWriter::EnterBlockInfoBlock() interface.

No block info block should need to define local abbreviations, so we can
always use a code width of 2.

Also change all block info block writers to use EnterBlockInfoBlock.

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

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

7 years ago[ReachableCode] Skip over ExprWithCleanups in isConfigurationValue
Tim Shen [Tue, 1 Nov 2016 00:19:04 +0000 (00:19 +0000)]
[ReachableCode] Skip over ExprWithCleanups in isConfigurationValue

Summary: Fixes pr29152.

Reviewers: rsmith, pirama, krememek

Subscribers: cfe-commits

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

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

7 years ago[modules] Mark deleted functions as implicitly inline to allow merging
Eric Fiselier [Mon, 31 Oct 2016 23:07:15 +0000 (23:07 +0000)]
[modules] Mark deleted functions as implicitly inline to allow  merging

Summary: When merging definitions with ModulesLocalVisibility enabled it's important to make deleted definitions implicitly inline, otherwise they'll be diagnosed as a redefinition.

Reviewers: silvas, manmanren, rsmith

Subscribers: cfe-commits

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

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

7 years ago[cfi] Fix missing !type annotation.
Evgeniy Stepanov [Mon, 31 Oct 2016 22:28:10 +0000 (22:28 +0000)]
[cfi] Fix missing !type annotation.

CFI (only in the cross-dso mode) fails to set !type annotations when
a function is used before it is defined.

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

7 years ago[index] Fix repeated visitation of the same InitListExpr for indexing.
Argyrios Kyrtzidis [Mon, 31 Oct 2016 22:12:12 +0000 (22:12 +0000)]
[index] Fix repeated visitation of the same InitListExpr for indexing.

It was visited multiple times unnecessarily.

rdar://28985038

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

7 years ago[ASTMatcher] Add CXXNewExpr support to hasDeclaration
Malcolm Parsons [Mon, 31 Oct 2016 22:04:07 +0000 (22:04 +0000)]
[ASTMatcher] Add CXXNewExpr support to hasDeclaration

Reviewers: sbenza, lukasza, aaron.ballman, klimek

Subscribers: lukasza, sbenza, cfe-commits

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

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

7 years agoA compound literal within a global lambda or block is still within
John McCall [Mon, 31 Oct 2016 21:56:26 +0000 (21:56 +0000)]
A compound literal within a global lambda or block is still within
the body of a function for the purposes of computing its storage
duration and deciding whether its initializer must be constant.

There are a number of problems in our current treatment of compound
literals.  C specifies that a compound literal yields an l-value
referring to an object with either static or automatic storage
duration, depending on where it was written; in the latter case,
the literal object has a lifetime tied to the enclosing scope (much
like an ObjC block), not the enclosing full-expression.  To get these
semantics fully correct in our current design, we would need to
collect compound literals on the ExprWithCleanups, just like we do
with ObjC blocks; we would probably also want to identify literals
like we do with materialized temporaries.  But it gets stranger;
GCC adds compound literals to C++ as an extension, but makes them
r-values, which are generally assumed to have temporary storage
duration.  Ignoring destructor ordering, the difference only matters
if the object's address escapes the full-expression, which for an
r-value can only happen with reference binding (which extends
temporaries) or array-to-pointer decay (which does not).  GCC then
attempts to lock down on array-to-pointer decay in ad hoc ways.
Arguably a far superior language solution for C++ (and perhaps even
array r-values in C, which can occur in other ways) would be to
propagate lifetime extension through array-to-pointer decay, so
that initializing a pointer object to a decayed r-value array
extends the lifetime of the complete object containing the array.
But this would be a major change in semantics which arguably ought
to be blessed by the committee(s).

Anyway, I'm not fixing any of that in this patch; I did try, but
it got out of hand.

Fixes rdar://28949016.

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

7 years ago[analyzer] Allow undefined values in performTrivialCopy.
Artem Dergachev [Mon, 31 Oct 2016 21:11:20 +0000 (21:11 +0000)]
[analyzer] Allow undefined values in performTrivialCopy.

Reading from a garbage pointer should be modeled as garbage,
and performTrivialCopy should be able to deal with any SVal input.

Patch by Ilya Palachev!

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

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

7 years ago[analyzer] MacOSXAPIChecker: Improve warnings for __block vars in dispatch_once.
Artem Dergachev [Mon, 31 Oct 2016 21:04:54 +0000 (21:04 +0000)]
[analyzer] MacOSXAPIChecker: Improve warnings for __block vars in dispatch_once.

The checker already warns for __block-storage variables being used as a
dispatch_once() predicate, however it refers to them as local which is not quite
accurate, so we fix that.

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

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

7 years agoAdd comment explaining this mysterious macro name.
Richard Smith [Mon, 31 Oct 2016 20:25:52 +0000 (20:25 +0000)]
Add comment explaining this mysterious macro name.

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

7 years agoDebugInfo: support for DW_TAG_atomic_type
Victor Leschuk [Mon, 31 Oct 2016 19:09:47 +0000 (19:09 +0000)]
DebugInfo: support for DW_TAG_atomic_type

Mark C11 _Atomic variables with DW_TAG_atomic_type tag.

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

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

7 years agoNFC - Reorder test case names in a PPC test case
Nemanja Ivanovic [Mon, 31 Oct 2016 19:02:54 +0000 (19:02 +0000)]
NFC - Reorder test case names in a PPC test case

A few recent commits have messed up the order of some tests
in a PPC test case. This just reorders them in a sensible way.

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

7 years agoFixing problem with CodeGen/avx512-kconstraints-att_inline_asm.c
Michael Zuckerman [Mon, 31 Oct 2016 18:40:17 +0000 (18:40 +0000)]
Fixing problem with CodeGen/avx512-kconstraints-att_inline_asm.c

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

7 years agoAdd a warning flag for warn_alloca_align_alignof
David Majnemer [Mon, 31 Oct 2016 18:23:02 +0000 (18:23 +0000)]
Add a warning flag for warn_alloca_align_alignof

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

7 years agoWhen diagnosing that a defaulted function is ill-formed because it would be
Richard Smith [Mon, 31 Oct 2016 18:18:29 +0000 (18:18 +0000)]
When diagnosing that a defaulted function is ill-formed because it would be
implicitly deleted and overrides a non-deleted function, explain why the
function is deleted. For PR30844.

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

7 years ago[Sema] Warn when alignof is used with __builtin_alloca_with_align
David Majnemer [Mon, 31 Oct 2016 18:07:57 +0000 (18:07 +0000)]
[Sema] Warn when alignof is used with __builtin_alloca_with_align

The second argument to __builtin_alloca_with_align is supposed to be in
bits, not bytes.  Using alignof there would be indicative of a bug.

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

7 years ago[analyzer] MacOSXAPIChecker: Disallow dispatch_once_t in ivars and heap.
Artem Dergachev [Mon, 31 Oct 2016 17:27:26 +0000 (17:27 +0000)]
[analyzer] MacOSXAPIChecker: Disallow dispatch_once_t in ivars and heap.

Unlike global/static variables, calloc etc. functions that allocate ObjC
objects behave differently in terms of memory barriers, and hacks that make
dispatch_once as fast as it possibly could be start failing.

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

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

7 years ago[x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for...
Michael Zuckerman [Mon, 31 Oct 2016 17:23:52 +0000 (17:23 +0000)]
[x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

Commit on behalf of mharoush

Extending inline assembly support, compatible with GCC as folowing:
 "k" constraint hints the compiler to select any of AVX512 k0-k7 registers.
 "Yk" constraint is a subset of "k" excluding k0 which is not allowd to be used as a mask.

Reviewer: 1. rnk

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

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

7 years agoUse toCharUnitsFromBits instead of TargetInfo::getCharWidth
David Majnemer [Mon, 31 Oct 2016 16:48:30 +0000 (16:48 +0000)]
Use toCharUnitsFromBits instead of TargetInfo::getCharWidth

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

7 years ago[x86][inline-asm] Add support for curly brackets escape using "%" in extended inline...
Michael Zuckerman [Mon, 31 Oct 2016 15:27:54 +0000 (15:27 +0000)]
[x86][inline-asm] Add support for curly brackets escape using "%" in extended inline asm.

Commit on behalf of mharoush

After LGTM and check all:

This patch is a compatibility fix for clang, matching GCC support for charter escape when using extended in-line assembly (i.e, "%{" ,"%}" --> "{" ,"}" ).
 It is meant to enable support for advanced features such as AVX512 conditional\masked vector instructions/broadcast assembly syntax.

Reviewer: 1. rnk

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

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

7 years ago[SystemZ] Add -march=archX aliases
Ulrich Weigand [Mon, 31 Oct 2016 14:38:05 +0000 (14:38 +0000)]
[SystemZ] Add -march=archX aliases

For compatibility with other compilers on the platform, allow specifying
levels of the z/Architecture instead of model names with -march.  In
particular, the following aliases are now supported:

  -march=arch8   equals  -march=z10
  -march=arch9   equals  -march=z196
  -march=arch10  equals  -march=zEC12
  -march=arch11  equals  -march=z13

This parallels the equivalent (and prerequisite) LLVM change in r285577.

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

7 years agosecond attempt at r285565.
Michael Zuckerman [Mon, 31 Oct 2016 14:16:57 +0000 (14:16 +0000)]
second attempt at r285565.

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

7 years agoSkip over AnnotatedLines with >50 levels of nesting; don't format them.
Daniel Jasper [Mon, 31 Oct 2016 13:23:00 +0000 (13:23 +0000)]
Skip over AnnotatedLines with >50 levels of nesting; don't format them.

Reasoning:
- ExpressionParser uses a lot of stack for these, bad in some environments.
- Our formatting algorithm is N^3 and gets really slow.
- The resulting formatting is unlikely to be any good.
- This is probably generated code we're formatting by accident.

We treat these as unparseable, and signal incomplete formatting. 50 is
an arbitrary number, I've only seen real problems from ~150 levels.

Patch by Sam McCall. Thank you.

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

7 years agoclang-format: [JS] Fix missing space after 'yield'.
Daniel Jasper [Mon, 31 Oct 2016 13:18:25 +0000 (13:18 +0000)]
clang-format: [JS] Fix missing space after 'yield'.

Before:
  class X {
    delete(val) {
      return null;
    }
    * gen() {
      yield[1, 2];
    }
    * gen() {
      yield{a: 1};
    }
  };

After:
  class X {
    delete(val) {
      return null;
    }
    * gen() {
      yield [1, 2];
    }
    * gen() {
      yield {a: 1};
    }
  };

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

7 years agorevert r285563 fail in test CodeGen/avx512-inline-asm-kregisters-basics.c
Michael Zuckerman [Mon, 31 Oct 2016 12:49:36 +0000 (12:49 +0000)]
revert r285563 fail in test CodeGen/avx512-inline-asm-kregisters-basics.c

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

7 years ago [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage
Michael Zuckerman [Mon, 31 Oct 2016 12:05:41 +0000 (12:05 +0000)]
 [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

 Commit on behalf of mharoush

 After LGTM and check all:
 This patch enables usage of k registers in inline assembly syntax.
 Adding triple

 Reviewer: 1. rnk
           2. delena

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

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

7 years agoFix this test when we have clang-offload-bundler.exe.
Rafael Espindola [Mon, 31 Oct 2016 11:47:37 +0000 (11:47 +0000)]
Fix this test when we have clang-offload-bundler.exe.

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

7 years ago[OpenCL] Setting constant address space for array initializers
Alexey Bader [Mon, 31 Oct 2016 10:26:31 +0000 (10:26 +0000)]
[OpenCL] Setting constant address space for array initializers

Summary: Setting constant address space for global constants used for memcpy-initialization of arrays.

Patch by Alexey Sotkin.

Reviewers: bader, yaxunl, Anastasia

Subscribers: cfe-commits, AlexeySotkin

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

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

7 years agoRevert reviosion 285555
Michael Zuckerman [Mon, 31 Oct 2016 10:12:36 +0000 (10:12 +0000)]
Revert reviosion 285555

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

7 years ago[x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage
Michael Zuckerman [Mon, 31 Oct 2016 09:37:59 +0000 (09:37 +0000)]
[x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

Commit on behalf of mharoush

After LGTM and check all:
This patch enables usage of k registers in inline assembly syntax.

Reviewer: 1. rnk
          2. delena

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

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

7 years ago[Modules] Add a command line option for loading the clang builtins modulemap.
Elad Cohen [Mon, 31 Oct 2016 08:21:54 +0000 (08:21 +0000)]
[Modules] Add a command line option for loading the clang builtins modulemap.

-fbuiltin-module-map loads the clang builtins modulemap file. (This is
equivalent to -fmodule-map-file=<resource dir>/include/module.modulemap)

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

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

7 years ago[AVX-512] Add a regular expression to a test that was missed in r285540.
Craig Topper [Mon, 31 Oct 2016 06:24:00 +0000 (06:24 +0000)]
[AVX-512] Add a regular expression to a test that was missed in r285540.

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

7 years ago[AVX-512] Use selectd instead of selectps for _mm256_mask_extracti32x4_epi32.
Craig Topper [Mon, 31 Oct 2016 05:49:11 +0000 (05:49 +0000)]
[AVX-512] Use selectd instead of selectps for _mm256_mask_extracti32x4_epi32.

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

7 years agoAdd support for __builtin_alloca_with_align
David Majnemer [Mon, 31 Oct 2016 05:37:48 +0000 (05:37 +0000)]
Add support for __builtin_alloca_with_align

__builtin_alloca always uses __BIGGEST_ALIGNMENT__ for the alignment of
the allocation.  __builtin_alloca_with_align allows the programmer to
specify the alignment of the allocation.

This fixes PR30658.

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

7 years agoMake output of ast-print closer to C++ code
Serge Pavlov [Mon, 31 Oct 2016 05:11:12 +0000 (05:11 +0000)]
Make output of ast-print closer to C++ code

Put semicolon after non-defining method declaration and a class
specialization body.

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

7 years ago[AVX-512] Remove masked vector extract builtins and replace with native shufflevector...
Craig Topper [Mon, 31 Oct 2016 04:30:56 +0000 (04:30 +0000)]
[AVX-512] Remove masked vector extract builtins and replace with native shufflevectors and selects.

Unfortunately, the backend currently doesn't fold masks into the instructions correctly when they come from these shufflevectors. I'll work on that in a future commit.

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