]> granicus.if.org Git - clang/log
clang
6 years ago[CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)
Vedant Kumar [Sat, 16 Dec 2017 01:28:25 +0000 (01:28 +0000)]
[CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

This patch introduces a specialized way to lower overflow-checked
multiplications with mixed-sign operands. This fixes link failures and
ICEs on code like this:

  void mul(int64_t a, uint64_t b) {
    int64_t res;
    __builtin_mul_overflow(a, b, &res);
  }

The generic checked-binop irgen would use a 65-bit multiplication
intrinsic here, which requires runtime support for _muloti4 (128-bit
multiplication), and therefore fails to link on i386. To get an ICE
on x86_64, change the example to use __int128_t / __uint128_t.

Adding runtime and backend support for 65-bit or 129-bit checked
multiplication on all of our supported targets is infeasible.

This patch solves the problem by using simpler, specialized irgen for
the mixed-sign case.

llvm.org/PR34920, rdar://34963321

Testing: Apart from check-clang, I compared the output from this fairly
comprehensive test driver using unpatched & patched clangs:
https://gist.github.com/vedantk/3eb9c88f82e5c32f2e590555b4af5081

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

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

6 years ago__is_target_environment: Check the environment after parsing it
Alex Lorenz [Fri, 15 Dec 2017 20:07:53 +0000 (20:07 +0000)]
__is_target_environment: Check the environment after parsing it

This ensures that target triples with environment versions can still work with
__is_target_environment.

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

6 years ago__is_target_arch: Check the arch and subarch instead of the arch name
Alex Lorenz [Fri, 15 Dec 2017 19:58:38 +0000 (19:58 +0000)]
__is_target_arch: Check the arch and subarch instead of the arch name

This ensures that when compiling for "arm64" __is_target_arch will succeed for
both "arm64" and "aarch64".

Thanks to Bob Wilson who pointed this out!

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

6 years agoRemove "FunctionName -" from docs on FunctionDecl(NFC)
Erich Keane [Fri, 15 Dec 2017 16:37:14 +0000 (16:37 +0000)]
Remove "FunctionName -" from docs on FunctionDecl(NFC)

Removed the repetative usage of the operator name on the
documentation for FunctionDecl.  Also reflowed some of the
comments since this changes the 80 character rule.

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

6 years ago[OPENMP] Codegen `declare simd` for function declarations.
Alexey Bataev [Fri, 15 Dec 2017 16:28:31 +0000 (16:28 +0000)]
[OPENMP] Codegen `declare simd` for function declarations.

Previously the attributes were emitted only for function definitions.
Patch adds emission of the attributes for function declarations.

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

6 years ago[clang] Add PPCallbacks list to preprocessor when building a preacompiled preamble.
Ilya Biryukov [Fri, 15 Dec 2017 11:27:51 +0000 (11:27 +0000)]
[clang] Add PPCallbacks list to preprocessor when building a preacompiled preamble.

Summary:
Revision D38639 needs this commit in order to properly make open
definition calls on include statements work.

Patch by William Enright.

Reviewers: malaperle, krasimir, bkramer, ilya-biryukov

Reviewed By: malaperle, ilya-biryukov

Subscribers: cfe-commits, arphaman, ilya-biryukov

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

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

6 years agoRemove duplicate python libclang changes from r320748
Alex Lorenz [Thu, 14 Dec 2017 23:40:42 +0000 (23:40 +0000)]
Remove duplicate python libclang changes from r320748

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

6 years agoCorrect UnaryTransformTypeLoc to properly initialize.
Erich Keane [Thu, 14 Dec 2017 23:37:08 +0000 (23:37 +0000)]
Correct UnaryTransformTypeLoc to properly initialize.

The initializeLocal function of UnaryTransformTypeLoc missed
the UnderlyingTInfo member.  This caused a null-dereference
issue, as reported in PR23421. This patch correctly initializss
the UnderlyingTInfo.

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

6 years agoD40901: Refactor lazy loading of template specializations. NFC
Vassil Vassilev [Thu, 14 Dec 2017 23:30:18 +0000 (23:30 +0000)]
D40901: Refactor lazy loading of template specializations. NFC

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

6 years agoDon't trigger -Wuser-defined-literals for system headers
Dimitry Andric [Thu, 14 Dec 2017 22:32:24 +0000 (22:32 +0000)]
Don't trigger -Wuser-defined-literals for system headers

Summary:
In D41064, I proposed adding `#pragma clang diagnostic ignored
"-Wuser-defined-literals"` to some of libc++'s headers, since these
warnings are now triggered by clang's new `-std=gnu++14` default:

```
$ cat test.cpp
#include <string>

$ clang -std=c++14 -Wsystem-headers -Wall -Wextra -c test.cpp
In file included from test.cpp:1:
In file included from /usr/include/c++/v1/string:470:
/usr/include/c++/v1/string_view:763:29: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
    basic_string_view<char> operator "" sv(const char *__str, size_t __len)
                            ^
/usr/include/c++/v1/string_view:769:32: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
    basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len)
                               ^
/usr/include/c++/v1/string_view:775:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
    basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len)
                                ^
/usr/include/c++/v1/string_view:781:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
    basic_string_view<char32_t> operator "" sv(const char32_t *__str, size_t __len)
                                ^
In file included from test.cpp:1:
/usr/include/c++/v1/string:4012:24: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
    basic_string<char> operator "" s( const char *__str, size_t __len )
                       ^
/usr/include/c++/v1/string:4018:27: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
    basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
                          ^
/usr/include/c++/v1/string:4024:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
    basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )
                           ^
/usr/include/c++/v1/string:4030:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
    basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )
                           ^
8 warnings generated.
```

Both @aaron.ballman and @mclow.lists felt that adding this workaround to
the libc++ headers was the wrong way, and it should be fixed in clang
instead.

Here is a proposal to do just that.  I verified that this suppresses the
warning, even when -Wsystem-headers is used, and that the warning is
still emitted for a declaration outside of system headers.

Reviewers: aaron.ballman, mclow.lists, rsmith

Reviewed By: aaron.ballman

Subscribers: mclow.lists, aaron.ballman, andrew, emaste, cfe-commits

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

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

6 years ago[ThreadSafetyAnalysis] Fix isCapabilityExpr
Yi Kong [Thu, 14 Dec 2017 22:24:45 +0000 (22:24 +0000)]
[ThreadSafetyAnalysis] Fix isCapabilityExpr

There are many more expr types that can be a capability expr, like
CXXThisExpr, CallExpr, MemberExpr. Instead of enumerating all of them,
just check typeHasCapability for any type given.

Also add & and * operators to allowed unary operators.

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

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

6 years agoHarmonize GNU- and C++-style attribute spellings.
Aaron Ballman [Thu, 14 Dec 2017 22:17:09 +0000 (22:17 +0000)]
Harmonize GNU- and C++-style attribute spellings.

Most attributes will now use the Clang<"name"> construct to provide both __attribute__((name)) and [[clang::name]] syntaxes for the attribute. Attributes deviating from this should be marked with a comment explaining why they are not supported under both spellings. Common reasons are: the attribute is provided by some other specification that controls the syntax or the attribute cannot be exposed under a particular spelling for some given reason.

Because this is a mechanical change that only introduces new spellings, there are no test cases for the commit.

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

6 years ago[debuginfo] Remove temporary FIXME.
Don Hinton [Thu, 14 Dec 2017 22:12:46 +0000 (22:12 +0000)]
[debuginfo] Remove temporary FIXME.

Summary:
Now that r320495, "[debuginfo-tests] Support moving
debuginfo-tests to llvm/projects," has landed, remove temporary FIXME
that supported the old mechanism.

Reviewers: zturner, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, cfe-commits

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

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

6 years agoFix many -Wsign-compare and -Wtautological-constant-compare warnings.
Zachary Turner [Thu, 14 Dec 2017 22:07:03 +0000 (22:07 +0000)]
Fix many -Wsign-compare and -Wtautological-constant-compare warnings.

Most of the -Wsign-compare warnings are due to the fact that
enums are signed by default in the MS ABI, while the
tautological comparison warnings trigger on x86 builds where
sizeof(size_t) is 4 bytes, so N > numeric_limits<unsigned>::max()
is always false.

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

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

6 years ago[libclang] Add support for checking abstractness of records
Alex Lorenz [Thu, 14 Dec 2017 22:01:50 +0000 (22:01 +0000)]
[libclang] Add support for checking abstractness of records

This patch allows checking whether a C++ record declaration is abstract through
libclang and clang.cindex (Python).

Patch by Johann Klähn!

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

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

6 years agoRevert "[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC...
Ben Hamilton [Thu, 14 Dec 2017 21:44:11 +0000 (21:44 +0000)]
Revert "[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style"

This reverts commit 37e69667f748e1458b46483b7c1b8f9ba33eec44.

We're going to discuss its ramifications further before making a
conclusion.

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

6 years agoCommit missing tests for r320734
Alex Lorenz [Thu, 14 Dec 2017 19:22:41 +0000 (19:22 +0000)]
Commit missing tests for r320734

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

6 years ago[Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like
Alex Lorenz [Thu, 14 Dec 2017 19:22:02 +0000 (19:22 +0000)]
[Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like
builtin macros

This patch implements the __is_target_arch, __is_target_vendor, __is_target_os,
and __is_target_environment Clang preprocessor extensions that were proposed by
@compnerd in Bob's cfe-dev post:
http://lists.llvm.org/pipermail/cfe-dev/2017-November/056166.html.

These macros can be used to examine the components of the target triple at
compile time. A has_builtin(is_target_???) preprocessor check can be used to
check for their availability.

__is_target_arch allows you to check if an arch is specified without worring
about a specific subarch, e.g.

__is_target_arch(arm) returns 1 for the target arch "armv7"
__is_target_arch(armv7) returns 1 for the target arch "armv7"
__is_target_arch(armv6) returns 0 for the target arch "armv7"

__is_target_vendor and __is_target_environment match the specific vendor
or environment. __is_target_os matches the specific OS, but
__is_target_os(darwin) will match any Darwin-based OS. "Unknown" can be used
to test if the triple's component is specified.

rdar://35753116

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

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

6 years ago[CodeGen][X86] Implement _InterlockedCompareExchange128 intrinsic
Reid Kleckner [Thu, 14 Dec 2017 19:00:21 +0000 (19:00 +0000)]
[CodeGen][X86] Implement _InterlockedCompareExchange128 intrinsic

Summary:
InterlockedCompareExchange128 is a bit more complicated than the other
InterlockedCompareExchange functions, so it requires a bit more work. It
doesn't directly refer to 128bit ints, instead it takes pointers to
64bit ints for Destination and ComparandResult, and exchange is taken as
two 64bit ints (high & low). The previous value is written to
ComparandResult, and success is returned. This implementation does the
following in order to produce a cmpxchg instruction:

  1. Cast everything to 128bit ints or int pointers, and glues together
     the Exchange values
  2. Reads from CompareandResult to get the comparand
  3. Calls cmpxchg volatile (on X86 this will produce a lock cmpxchg16b
     instruction)
    1. Result 0 (previous value) is written back to ComparandResult
    2. Result 1 (success bool) is zext'ed to a uchar and returned

Resolves bug https://llvm.org/PR35251

Patch by Colden Cullen!

Reviewers: rnk, agutowski

Reviewed By: rnk

Subscribers: majnemer, cfe-commits

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

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

6 years agoIn an ARC lambda-to-block conversion thunk, reclaim the return value of
John McCall [Thu, 14 Dec 2017 18:21:14 +0000 (18:21 +0000)]
In an ARC lambda-to-block conversion thunk, reclaim the return value of
the lambda so that we don't over-release it.

Patch by Dan Zimmerman!

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

6 years ago[OPENMP] Add codegen for target data constructs with `nowait` clause.
Alexey Bataev [Thu, 14 Dec 2017 17:00:17 +0000 (17:00 +0000)]
[OPENMP] Add codegen for target data constructs with `nowait` clause.

Added codegen for the `nowait` clause in target data constructs.

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

6 years ago[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style
Ben Hamilton [Thu, 14 Dec 2017 16:17:38 +0000 (16:17 +0000)]
[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style

Summary:
If we write the following code, it goes over 100 columns, so we need to wrap it:

```
- (VeryLongReturnTypeName)veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
                              longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```

Currently, clang-format with the google style aligns the method parameter names on the first column:

```
- (VeryLongReturnTypeName)
veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
    longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```

We'd like clang-format in the google style to align these to column 4 for Objective-C:

```
- (VeryLongReturnTypeName)
    veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
            longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```

Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: krasimir, djasper, klimek

Reviewed By: djasper

Subscribers: cfe-commits, thakis

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

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

6 years agoWhen attempting to complete an incomplete array bound type in an expression,
Richard Smith [Thu, 14 Dec 2017 15:40:16 +0000 (15:40 +0000)]
When attempting to complete an incomplete array bound type in an expression,
update the type from the definition even if we didn't instantiate a definition.

We may have instantiated the definition in an earlier stage of semantic
analysis, after creating the DeclRefExpr but before we reach a point where a
complete expression type is required.

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

6 years ago[c++20] P0515R3: Parsing support and basic AST construction for operator <=>.
Richard Smith [Thu, 14 Dec 2017 15:16:18 +0000 (15:16 +0000)]
[c++20] P0515R3: Parsing support and basic AST construction for operator <=>.

Adding the new enumerator forced a bunch more changes into this patch than I
would have liked. The -Wtautological-compare warning was extended to properly
check the new comparison operator, clang-format needed updating because it uses
precedence levels as weights for determining where to break lines (and several
operators increased their precedence levels with this change), thread-safety
analysis needed changes to build its own IL properly for the new operator.

All "real" semantic checking for this operator has been deferred to a future
patch. For now, we use the relational comparison rules and arbitrarily give
the builtin form of the operator a return type of 'void'.

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

6 years agoRenamed test file to use proper naming convention
Ilya Biryukov [Thu, 14 Dec 2017 14:51:17 +0000 (14:51 +0000)]
Renamed test file to use proper naming convention

Also changed the order of CHECK statements.
CHEKC-NOT must come before CHECK in skipped-function-bodies.cpp

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

6 years agoWarn if we find a Unicode homoglyph for a symbol in an identifier.
Richard Smith [Thu, 14 Dec 2017 13:15:08 +0000 (13:15 +0000)]
Warn if we find a Unicode homoglyph for a symbol in an identifier.

Specifically, warn if:
 * we find a character that the language standard says we must treat as an
   identifier, and
 * that character is not reasonably an identifier character (it's a punctuation
   character or similar), and
 * it renders identically to a valid non-identifier character in common
   fixed-width fonts.

Some tools "helpfully" substitute the surprising characters for the expected
characters, and replacing semicolons with Greek question marks is a common
"prank".

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

6 years ago[Frontend] Treat function with skipped body as definition
Ilya Biryukov [Thu, 14 Dec 2017 13:00:33 +0000 (13:00 +0000)]
[Frontend] Treat function with skipped body as definition

Summary:
This fixes an invalid warning about missing definition of a function when
parsing with SkipFunctionBodies=true

Reviewers: bkramer, sepavloff

Reviewed By: sepavloff

Subscribers: klimek, cfe-commits

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

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

6 years agoIRGen: When performing CFI checks, load vtable pointer from vbase when necessary.
Peter Collingbourne [Wed, 13 Dec 2017 21:53:04 +0000 (21:53 +0000)]
IRGen: When performing CFI checks, load vtable pointer from vbase when necessary.

Under the Microsoft ABI, it is possible for an object not to have
a virtual table pointer of its own if all of its virtual functions
were introduced by virtual bases. In that case, we need to load the
vtable pointer from one of the virtual bases and perform the type
check using its type.

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

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

6 years ago[OPENMP] Add codegen for `nowait` clause in target directives.
Alexey Bataev [Wed, 13 Dec 2017 21:04:20 +0000 (21:04 +0000)]
[OPENMP] Add codegen for `nowait` clause in target directives.

Added basic codegen for `nowait` clauses in target-based directives.

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

6 years ago[Hexagon] Intrinsic support for V62 and V65
Krzysztof Parzyszek [Wed, 13 Dec 2017 19:56:03 +0000 (19:56 +0000)]
[Hexagon] Intrinsic support for V62 and V65

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

6 years ago[OPENMP] Initial codegen for `target teams distribute simd` directive.
Alexey Bataev [Wed, 13 Dec 2017 19:45:06 +0000 (19:45 +0000)]
[OPENMP] Initial codegen for `target teams distribute simd` directive.

Host + generic device codegen for `target teams distribute simd`
directive.

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

6 years ago[OPENMP] Support `reduction` clause on target-based directives.
Alexey Bataev [Wed, 13 Dec 2017 17:31:39 +0000 (17:31 +0000)]
[OPENMP] Support `reduction` clause on target-based directives.

OpenMP 5.0 added support for `reduction` clause in target-based
directives. Patch adds this support to clang.

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

6 years ago[OPENMP] Fix handling of clauses in clause parsing mode.
Alexey Bataev [Wed, 13 Dec 2017 15:28:44 +0000 (15:28 +0000)]
[OPENMP] Fix handling of clauses in clause parsing mode.

The compiler may generate incorrect code if we try to capture the
variable in clause parsing mode.

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

6 years ago[Hexagon] Add front-end support for Hexagon V65
Krzysztof Parzyszek [Wed, 13 Dec 2017 13:48:07 +0000 (13:48 +0000)]
[Hexagon] Add front-end support for Hexagon V65

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

6 years ago[Sema] Ignore decls in namespaces when global decls are not wanted.
Eric Liu [Wed, 13 Dec 2017 10:26:49 +0000 (10:26 +0000)]
[Sema] Ignore decls in namespaces when global decls are not wanted.

Summary: ... in qualified code completion and decl lookup.

Reviewers: ilya-biryukov, arphaman

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[Coverage] Always emit unused coverage mappings in the same order.
Eli Friedman [Wed, 13 Dec 2017 00:14:17 +0000 (00:14 +0000)]
[Coverage] Always emit unused coverage mappings in the same order.

Non-determinism is confusing at best.

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

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

6 years ago[OpenMP] Add function attribute for triggering data sharing.
Gheorghe-Teodor Bercea [Tue, 12 Dec 2017 21:38:43 +0000 (21:38 +0000)]
[OpenMP] Add function attribute for triggering data sharing.

Summary:
The backend should only emit data sharing code for the cases where it is needed.
A new function attribute is used by Clang to enable data sharing only for the cases where OpenMP semantics require it and there are variables that need to be shared.

Reviewers: hfinkel, Hahnfeld, ABataev, carlo.bertolli, caomhin

Reviewed By: ABataev

Subscribers: cfe-commits, jholewinski

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

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

6 years ago[OpenMP] Diagnose function name on the link clause
Kelvin Li [Tue, 12 Dec 2017 20:08:12 +0000 (20:08 +0000)]
[OpenMP] Diagnose function name on the link clause

This patch is to add diagnose when a function name is
specified on the link clause. According to the  OpenMP
spec, only the list items that exclude the function
name are allowed on the link clause.

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

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

6 years ago[cmake] Follow-up to rL320494.
Don Hinton [Tue, 12 Dec 2017 19:47:40 +0000 (19:47 +0000)]
[cmake] Follow-up to rL320494.

EXISTS requires full paths.

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

6 years agoAdd --cuda-path to mock a CUDA Toolkit installation to avoid
Kelvin Li [Tue, 12 Dec 2017 18:33:39 +0000 (18:33 +0000)]
Add --cuda-path to mock a CUDA Toolkit installation to avoid
unexpected error messages for incompatibility between the
default SM level and the support in the installed toolkit.

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

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

6 years ago[debuginfo-tests] Add support for moving debuginfo-tests from clang/test to llvm...
Don Hinton [Tue, 12 Dec 2017 16:48:35 +0000 (16:48 +0000)]
[debuginfo-tests] Add support for moving debuginfo-tests from clang/test to llvm/projects or monorepo.

Summary:
The new version of debuginfo-tests will have it's own
lit.cfg.py file which is incompatible with the one in clang/test.
This change supports both the old and new versions, and can be used
until the bots actually move debuginfo-tests to either clang/test or
the monorepo.

This is a prerequisite for D40971.

Reviewers: zturner, aprantl

Subscribers: mgorny, JDevlieghere, llvm-commits, cfe-commits

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

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

6 years agoRevert a part of 320489 that was submitted unintentionally.
Erich Keane [Tue, 12 Dec 2017 16:22:31 +0000 (16:22 +0000)]
Revert a part of 320489 that was submitted unintentionally.

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

6 years agoFix ICE when __has_unqiue_object_representations called with invalid decl
Erich Keane [Tue, 12 Dec 2017 16:02:06 +0000 (16:02 +0000)]
Fix ICE when __has_unqiue_object_representations called with invalid decl

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

6 years ago[clang-format] Improve ObjC headers detection.
Krasimir Georgiev [Tue, 12 Dec 2017 13:43:59 +0000 (13:43 +0000)]
[clang-format] Improve ObjC headers detection.

This patch improves detection of ObjC header files.
Right now many ObjC headers, especially short ones, are categorized as C/C++.

Way of filtering still isn't the best, as most likely it should be token-based.

Contributed by jolesiak!

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

6 years ago[SemaCodeComplete] Allow passing out scope specifiers in qualified-id completions...
Eric Liu [Tue, 12 Dec 2017 11:35:46 +0000 (11:35 +0000)]
[SemaCodeComplete] Allow passing out scope specifiers in qualified-id completions via completion context.

Reviewers: ilya-biryukov, arphaman

Reviewed By: arphaman

Subscribers: nik, cfe-commits

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

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

6 years ago[analyzer] StackAddrEscape: For now, disable the new async escape checks.
Artem Dergachev [Tue, 12 Dec 2017 02:59:09 +0000 (02:59 +0000)]
[analyzer] StackAddrEscape: For now, disable the new async escape checks.

The new check introduced in r318705 is useful, but suffers from a particular
class of false positives, namely, it does not account for
dispatch_barrier_sync() API which allows one to ensure that the asyncronously
executed block that captures a pointer to a local variable does not actually
outlive that variable.

The new check is split into a separate checker, under the name of
alpha.core.StackAddressAsyncEscape, which is likely to get enabled by default
again once these positives are fixed. The rest of the StackAddressEscapeChecker
is still enabled by default.

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

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

6 years ago[analyzer] In getSVal() API, disable auto-detection of void type as char type.
Artem Dergachev [Tue, 12 Dec 2017 02:27:55 +0000 (02:27 +0000)]
[analyzer] In getSVal() API, disable auto-detection of void type as char type.

This is a follow-up from r314910. When a checker developer attempts to
dereference a location in memory through ProgramState::getSVal(Loc) or
ProgramState::getSVal(const MemRegion *), without specifying the second
optional QualType parameter for the type of the value he tries to find at this
location, the type is auto-detected from location type. If the location
represents a value beyond a void pointer, we thought that auto-detecting the
type as 'char' is a good idea. However, in most practical cases, the correct
behavior would be to specify the type explicitly, as it is available from other
sources, and the few cases where we actually need to take a 'char' are
workarounds rather than an intended behavior. Therefore, try to fail with an
easy-to-understand assertion when asked to read from a void pointer location.

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

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

6 years ago[Driver][CodeGen] Add -mprefer-vector-width driver option and attribute during CodeGen.
Craig Topper [Mon, 11 Dec 2017 21:09:19 +0000 (21:09 +0000)]
[Driver][CodeGen] Add -mprefer-vector-width driver option and attribute during CodeGen.

This adds a new command line option -mprefer-vector-width to specify a preferred vector width for the vectorizers. Valid values are 'none' and unsigned integers. The driver will check that it meets those constraints. Specific supported integers will be managed by the targets in the backend.

Clang will take the value and add it as a new function attribute during CodeGen.

This represents the alternate direction proposed by Sanjay in this RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-November/118734.html

The syntax here matches gcc, though gcc treats it as an x86 specific command line argument. gcc only allows values of 128, 256, and 512. I'm not having clang check any values.

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

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

6 years ago[Docs] Regenerate command line documentation.
Craig Topper [Mon, 11 Dec 2017 21:09:16 +0000 (21:09 +0000)]
[Docs] Regenerate command line documentation.

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

6 years agoPR35586: Relax two asserts that are overly restrictive
Erich Keane [Mon, 11 Dec 2017 19:44:28 +0000 (19:44 +0000)]
PR35586: Relax two asserts that are overly restrictive

The two asserts are too aggressive.  In C++  mode, an
enum is NOT considered an integral type, but an enum value
is allowed to be an enum.  This patch relaxes the two asserts
to allow the enum value as well (as typechecking does).

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

6 years ago[Hexagon] Remove unsupported vlut intrinsics
Krzysztof Parzyszek [Mon, 11 Dec 2017 19:29:56 +0000 (19:29 +0000)]
[Hexagon] Remove unsupported vlut intrinsics

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

6 years agoFix warn-enum-compare.cpp on Windows
Hans Wennborg [Mon, 11 Dec 2017 18:58:18 +0000 (18:58 +0000)]
Fix warn-enum-compare.cpp on Windows

It's been failing since r319875.

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

6 years agoP0620 follow-up: deducing `auto` from braced-init-list in new expr
Zhihao Yuan [Mon, 11 Dec 2017 18:29:54 +0000 (18:29 +0000)]
P0620 follow-up: deducing `auto` from braced-init-list in new expr

Summary:
This is a side-effect brought in by p0620r0, which allows other placeholder types (derived from `auto` and `decltype(auto)`) to be usable in a `new` expression with a single-clause //braced-init-list// as its initializer (8.3.4 [expr.new]/2).  N3922 defined its semantics.

References:
 http://wg21.link/p0620r0
 http://wg21.link/n3922

Reviewers: rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years agoRevert 320391: Certain targets are failing, pulling back to diagnose.
Erich Keane [Mon, 11 Dec 2017 18:14:51 +0000 (18:14 +0000)]
Revert 320391: Certain targets are failing, pulling back to diagnose.

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

6 years ago[Sema] Fix crash in unused-lambda-capture warning for VLAs
Malcolm Parsons [Mon, 11 Dec 2017 18:00:36 +0000 (18:00 +0000)]
[Sema] Fix crash in unused-lambda-capture warning for VLAs

Summary:
Clang was crashing when diagnosing an unused-lambda-capture for a VLA because
From.getVariable() is null for the capture of a VLA bound.
Warning about the VLA bound capture is not helpful, so only warn for the VLA
itself.

Fixes: PR35555
Reviewers: aaron.ballman, dim, rsmith

Reviewed By: aaron.ballman, dim

Subscribers: cfe-commits

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

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

6 years agoFor Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is available
Erich Keane [Mon, 11 Dec 2017 17:36:42 +0000 (17:36 +0000)]
For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is available

As reported in llvm bugzilla 32377.
Here’s a patch to add preinclude of stdc-predef.h.

The gcc documentation says â€śOn GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html;

The preinclude is inhibited with â€“ffreestanding.

Basically I fixed the failing test cases by adding â€“ffreestanding which inhibits this behavior.

I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here

Note: this is a recommit after a test failure took down the original (r318669)

Patch By: mibintc
Differential Revision: https://reviews.llvm.org/D34158

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

6 years ago[mips] Minor update to the comment (NFC)
Aleksandar Beserminji [Mon, 11 Dec 2017 12:12:16 +0000 (12:12 +0000)]
[mips] Minor update to the comment (NFC)

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

6 years ago[mips] Removal of microMIPS64R6
Aleksandar Beserminji [Mon, 11 Dec 2017 11:29:17 +0000 (11:29 +0000)]
[mips] Removal of microMIPS64R6

microMIPS64R6 is removed from backend, and therefore frontend
will show an error when target is microMIPS64R6.

This is Clang part of patch.

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

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

6 years agoFix MSVC 'not all control paths return a value' warning
Simon Pilgrim [Sun, 10 Dec 2017 11:05:14 +0000 (11:05 +0000)]
Fix MSVC 'not all control paths return a value' warning

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

6 years agoUpdate Clang CMake cache to use cxx-headers, NFC
Duncan P. N. Exon Smith [Sat, 9 Dec 2017 23:44:42 +0000 (23:44 +0000)]
Update Clang CMake cache to use cxx-headers, NFC

Apparently libcxx-headers is going away.  Fixes PR35584.

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

6 years agoSwitch to gnu++14 as the default dialect.
Tim Northover [Sat, 9 Dec 2017 12:09:54 +0000 (12:09 +0000)]
Switch to gnu++14 as the default dialect.

This is C++14 with conforming GNU extensions.

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

6 years agoRevert r320230 to fix buildbots.
Richard Trieu [Sat, 9 Dec 2017 03:02:21 +0000 (03:02 +0000)]
Revert r320230 to fix buildbots.

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

6 years agoFix Driver/darwin-version.c test
Alex Lorenz [Sat, 9 Dec 2017 02:56:48 +0000 (02:56 +0000)]
Fix Driver/darwin-version.c test

A target argument should be provided to avoid failures on non-Darwin

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

6 years ago[driver][darwin] Refactor the target selection code, NFC
Alex Lorenz [Sat, 9 Dec 2017 02:27:11 +0000 (02:27 +0000)]
[driver][darwin] Refactor the target selection code, NFC

The simulator variant of Darwin's platforms is removed in favor of a new
environment field.
The code that selects the platform and the version is split into 4 different
functions instead of being all in one function.
This is an NFC commit, although it slightly improves the
"invalid version number" diagnostic by displaying the environment variable
instead of -m<os>-version-min if the OS version was derived from the
environment.

rdar://35813850

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

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

6 years agoFix fsanitize-blacklist test on Windows.
Evgeniy Stepanov [Sat, 9 Dec 2017 02:15:42 +0000 (02:15 +0000)]
Fix fsanitize-blacklist test on Windows.

Broken in r320232.

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

6 years agoHardware-assisted AddressSanitizer (clang part).
Evgeniy Stepanov [Sat, 9 Dec 2017 01:32:07 +0000 (01:32 +0000)]
Hardware-assisted AddressSanitizer (clang part).

Summary:
Driver, frontend and LLVM codegen for HWASan.
A clone of ASan, basically.

Reviewers: kcc, pcc, alekseyshl

Subscribers: srhines, javed.absar, cfe-commits

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

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

6 years ago[ODRHash] Support ODR violation detection in functions.
Richard Trieu [Sat, 9 Dec 2017 01:29:40 +0000 (01:29 +0000)]
[ODRHash] Support ODR violation detection in functions.

Extend the hashing to functions, which allows detection of function definition
mismatches across modules.

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

6 years agoDon't link NetBSD programs with -ldl in linkXRayRuntimeDeps
Kamil Rytarowski [Sat, 9 Dec 2017 00:34:01 +0000 (00:34 +0000)]
Don't link NetBSD programs with -ldl in linkXRayRuntimeDeps

Summary:
There is no such library on NetBSD, the corresponding functions like dlopen(3) are in libc.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, eugenis

Reviewed By: vitalybuka

Subscribers: dberris, llvm-commits, #sanitizers

Tags: #sanitizers

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

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

6 years ago[CodeGen][X86] Fix handling of __fp16 vectors.
Akira Hatanaka [Sat, 9 Dec 2017 00:02:37 +0000 (00:02 +0000)]
[CodeGen][X86] Fix handling of __fp16 vectors.

This commit fixes a bug in IRGen where it generates completely broken
code for __fp16 vectors on X86. For example when the following code is
compiled:

half4 hv0, hv1, hv2; // these are vectors of __fp16.

void foo221() {
  hv0 = hv1 + hv2;
}

clang generates the following IR, in which two i16 vectors are added:

@hv1 = common global <4 x i16> zeroinitializer, align 8
@hv2 = common global <4 x i16> zeroinitializer, align 8
@hv0 = common global <4 x i16> zeroinitializer, align 8

define void @foo221() {
  %0 = load <4 x i16>, <4 x i16>* @hv1, align 8
  %1 = load <4 x i16>, <4 x i16>* @hv2, align 8
  %add = add <4 x i16> %0, %1
  store <4 x i16> %add, <4 x i16>* @hv0, align 8
  ret void
}

To fix the bug, this commit uses the code committed in r314056, which
modified clang to promote and truncate __fp16 vectors to and from float
vectors in the AST. It also fixes another IRGen bug where a short value
is assigned to an __fp16 variable without any integer-to-floating-point
conversion, as shown in the following example:

__fp16 a;
short b;

void foo1() {
  a = b;
}

@b = common global i16 0, align 2
@a = common global i16 0, align 2

define void @foo1() #0 {
  %0 = load i16, i16* @b, align 2
  store i16 %0, i16* @a, align 2
  ret void
}

rdar://problem/20625184

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

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

6 years agoRemove creation of out-of-bounds value of enumeration type (resulting in UB).
Richard Smith [Fri, 8 Dec 2017 23:29:59 +0000 (23:29 +0000)]
Remove creation of out-of-bounds value of enumeration type (resulting in UB).

Also remove unnecessary initialization of out-parameters with this value, so
that MSan is able to catch errors appropriately.

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

6 years agoUnify implementation of our two different flavours of -Wtautological-compare,
Richard Smith [Fri, 8 Dec 2017 22:57:11 +0000 (22:57 +0000)]
Unify implementation of our two different flavours of -Wtautological-compare,
and fold together into a single function.

In so doing, fix a handful of remaining bugs where we would report false
positives or false negatives if we promote a signed value to an unsigned type
for the comparison.

This re-commits r320122 and r320124, minus two changes:

 * Comparisons between a constant and a non-constant expression of enumeration
   type never warn, not even if the constant is out of range. We should be
   warning about the creation of such a constant, not about its use.

 * We do not use more precise bit-widths for comparisons against bit-fields.
   The more precise diagnostics probably are the right thing, but we should
   consider moving them under their own warning flag.

Other than the refactoring, this patch should only change the behavior for the
buggy cases (where the warnings didn't take into account that promotion from
signed to unsigned can leave a range of inaccessible values in the middle of
the promoted type).

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

6 years ago[Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 8 Dec 2017 22:39:26 +0000 (22:39 +0000)]
[Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[OPENMP] Simplify codegen for loop iteration variables in loop preamble.
Alexey Bataev [Fri, 8 Dec 2017 20:18:58 +0000 (20:18 +0000)]
[OPENMP] Simplify codegen for loop iteration variables in loop preamble.

Initial patch could cause trouble in the optimized code because of the
incorrectly generated lifetime intrinsics.

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

6 years ago[ubsan] array-bounds: Ignore params with constant size
Vedant Kumar [Fri, 8 Dec 2017 19:51:42 +0000 (19:51 +0000)]
[ubsan] array-bounds: Ignore params with constant size

This is a follow-up to r320128. Eli pointed out that there is some gray
area in the language standard about whether the constant size is exact,
or a lower bound.

https://reviews.llvm.org/D40940

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

6 years ago[hwasan] typo in docs
Kostya Serebryany [Fri, 8 Dec 2017 18:14:03 +0000 (18:14 +0000)]
[hwasan] typo in docs

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

6 years agoFix a comment in the code
Kamil Rytarowski [Fri, 8 Dec 2017 17:38:25 +0000 (17:38 +0000)]
Fix a comment in the code

The -ldl library is missing on NetBSD too, make the comment more generic.

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

6 years agoRevert "Unify implementation of our two different flavours of -Wtautological-compare."
Hans Wennborg [Fri, 8 Dec 2017 16:54:08 +0000 (16:54 +0000)]
Revert "Unify implementation of our two different flavours of -Wtautological-compare."

> Unify implementation of our two different flavours of -Wtautological-compare.
>
> In so doing, fix a handful of remaining bugs where we would report false
> positives or false negatives if we promote a signed value to an unsigned type
> for the comparison.

This caused a new warning in Chromium:

../../base/trace_event/trace_log.cc:1545:29: error: comparison of constant 64
with expression of type 'unsigned int' is always true
[-Werror,-Wtautological-constant-out-of-range-compare]
  DCHECK(handle.event_index < TraceBufferChunk::kTraceBufferChunkSize);
         ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The 'unsigned int' is really a 6-bit bitfield, which is why it's always
less than 64.

I thought we didn't use to warn (with out-of-range-compare) when comparing
against the boundaries of a type?

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

6 years ago[OPENMP] Initial codegen for `target teams distribute` directive.
Alexey Bataev [Fri, 8 Dec 2017 15:03:50 +0000 (15:03 +0000)]
[OPENMP] Initial codegen for `target teams distribute` directive.

Host + default devices codegen for `target teams distribute` directive.

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

6 years agoIn stdbool.h, define bool, false, true only in gnu++98
Stephan Bergmann [Fri, 8 Dec 2017 08:28:08 +0000 (08:28 +0000)]
In stdbool.h, define bool, false, true only in gnu++98

GCC has meanwhile corrected that with the similar
<https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=216679> "C++11
explicitly forbids macros for bool, true and false."

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

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

6 years agoRevert r320124 "Fold together the in-range and out-of-range portions of -Wtautologica...
Hans Wennborg [Fri, 8 Dec 2017 05:19:12 +0000 (05:19 +0000)]
Revert r320124 "Fold together the in-range and out-of-range portions of -Wtautological-compare."

This broke Chromium:

../../base/trace_event/trace_log.cc:1545:29: error: comparison of constant 64
with expression of type 'unsigned int' is always true
[-Werror,-Wtautological-constant-out-of-range-compare]
  DCHECK(handle.event_index < TraceBufferChunk::kTraceBufferChunkSize);
         ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The 'unsigned int' is really a 6-bit bitfield, which is why it's always
less than 63.

Did this use to fall under the "in-range" case before? I thought we
didn't use to warn when comparing against the boundaries of a type.

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

6 years ago[Blocks] Inherit sanitizer options from parent decl
Vedant Kumar [Fri, 8 Dec 2017 02:47:58 +0000 (02:47 +0000)]
[Blocks] Inherit sanitizer options from parent decl

There is no way to apply sanitizer suppressions to ObjC blocks. A
reasonable default is to have blocks inherit their parent's sanitizer
options.

rdar://32769634

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

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

6 years agoAdd a test that the __STDC_VERSION__ macro reports the correct value for -std=c17.
Aaron Ballman [Fri, 8 Dec 2017 02:39:26 +0000 (02:39 +0000)]
Add a test that the __STDC_VERSION__ macro reports the correct value for -std=c17.

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

6 years ago[ubsan] Use pass_object_size info in bounds checks
Vedant Kumar [Fri, 8 Dec 2017 01:51:47 +0000 (01:51 +0000)]
[ubsan] Use pass_object_size info in bounds checks

Teach UBSan's bounds check to opportunistically use pass_object_size
information to check array accesses.

rdar://33272922

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

6 years agoFold together the in-range and out-of-range portions of -Wtautological-compare.
Richard Smith [Fri, 8 Dec 2017 01:00:27 +0000 (01:00 +0000)]
Fold together the in-range and out-of-range portions of -Wtautological-compare.

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

6 years agoUnify implementation of our two different flavours of -Wtautological-compare.
Richard Smith [Fri, 8 Dec 2017 00:45:25 +0000 (00:45 +0000)]
Unify implementation of our two different flavours of -Wtautological-compare.

In so doing, fix a handful of remaining bugs where we would report false
positives or false negatives if we promote a signed value to an unsigned type
for the comparison.

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

6 years agoCorrect line endings that got mixed up in r320088; NFC.
Aaron Ballman [Thu, 7 Dec 2017 23:10:09 +0000 (23:10 +0000)]
Correct line endings that got mixed up in r320088; NFC.

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

6 years agoFix more line endings changed in r320089. NFC.
Ahmed Bougacha [Thu, 7 Dec 2017 23:08:46 +0000 (23:08 +0000)]
Fix more line endings changed in r320089. NFC.

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

6 years agoCorrect line endings that got mixed up in r320089; NFC.
Aaron Ballman [Thu, 7 Dec 2017 23:04:11 +0000 (23:04 +0000)]
Correct line endings that got mixed up in r320089; NFC.

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

6 years agoRemove line-endings added by r320089. NFC.
Ahmed Bougacha [Thu, 7 Dec 2017 22:58:02 +0000 (22:58 +0000)]
Remove line-endings added by r320089. NFC.

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

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Thu, 7 Dec 2017 21:55:09 +0000 (21:55 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoAdd new language mode flags for C17.
Aaron Ballman [Thu, 7 Dec 2017 21:46:26 +0000 (21:46 +0000)]
Add new language mode flags for C17.

This adds -std=c17, -std=gnu17, and -std=iso9899:2017 as language mode flags for C17 and updates the value of __STDC_VERSION__ to the value based on the C17 FDIS. Given that this ballot cannot succeed until 2018, it is expected that we (and GCC) will add c18 flags as aliases once the ballot passes.

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

6 years agoAdd support for the __has_c_attribute builtin preprocessor macro.
Aaron Ballman [Thu, 7 Dec 2017 21:37:49 +0000 (21:37 +0000)]
Add support for the __has_c_attribute builtin preprocessor macro.

This behaves similar to the __has_cpp_attribute builtin macro in that it allows users to detect whether an attribute is supported with the [[]] spelling syntax, which can be enabled in C with -fdouble-square-bracket-attributes.

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

6 years ago[libclang] Record code-completion invocations to a temporary file when
Alex Lorenz [Thu, 7 Dec 2017 20:37:50 +0000 (20:37 +0000)]
[libclang] Record code-completion invocations to a temporary file when
requested by client

This is a follow up to r319702 which records parsing invocations.

These files are not emitted by default, and the client has to specify the
invocation emission path first.

rdar://35322543

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

6 years ago[OpenMP] NVPTX: Set default/minimum compute capability to sm_35
George Rokos [Thu, 7 Dec 2017 20:27:31 +0000 (20:27 +0000)]
[OpenMP] NVPTX: Set default/minimum compute capability to sm_35

The current implementation of the nvptx runtime (to be upstreamed shortly) uses the atomicMax operation on 64-bit integers.
This is only supported in compute capabilities 3.5 and later. I've changed the clang default to sm_35.

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

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

6 years ago[OPENMP] Do not capture private variables in the target regions.
Alexey Bataev [Thu, 7 Dec 2017 19:49:28 +0000 (19:49 +0000)]
[OPENMP] Do not capture private variables in the target regions.

Private variables are completely redefined in the outlined regions, so
we don't need to capture them. Patch adds this behavior to the
target-based regions.

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

6 years agoupdate hwasan docs
Kostya Serebryany [Thu, 7 Dec 2017 19:21:30 +0000 (19:21 +0000)]
update hwasan docs

Summary:
* use more readable name
* document the hwasan attribute

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, cfe-commits

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

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

6 years ago[driver] Set the 'simulator' environment for Darwin when compiling for
Alex Lorenz [Thu, 7 Dec 2017 19:04:10 +0000 (19:04 +0000)]
[driver] Set the 'simulator' environment for Darwin when compiling for
iOS/tvOS/watchOS simulator

rdar://35135215

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

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

6 years ago[Index] Add setPreprocessor member to IndexDataConsumer.
Eric Liu [Thu, 7 Dec 2017 11:04:24 +0000 (11:04 +0000)]
[Index] Add setPreprocessor member to IndexDataConsumer.

Summary:
This enables us to use information in Preprocessor when handling symbol
occurrences.

Reviewers: arphaman, hokein

Reviewed By: hokein

Subscribers: malaperle, cfe-commits

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

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

6 years ago[ARM] ACLE parallel arithmetic and DSP style multiplications
Sjoerd Meijer [Thu, 7 Dec 2017 09:54:39 +0000 (09:54 +0000)]
[ARM] ACLE parallel arithmetic and DSP style multiplications

This is a follow up of r302131, in which we forgot to add SemaChecking
tests. Adding these tests revealed two problems which have been fixed:
- added missing intrinsic __qdbl,
- properly range checking ssat16 and usat16.

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

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

6 years agoIgnore pointers to incomplete types when diagnosing misaligned addresses
Roger Ferrer Ibanez [Thu, 7 Dec 2017 09:23:50 +0000 (09:23 +0000)]
Ignore pointers to incomplete types when diagnosing misaligned addresses

This is a fix for PR35509 in which we crash because we attempt to compute the
alignment of an incomplete type.

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

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