]> granicus.if.org Git - clang/log
clang
7 years agoProperly parse a postfix expression following a Boolean literal. Fixes PR34273.
Aaron Ballman [Thu, 28 Sep 2017 21:29:18 +0000 (21:29 +0000)]
Properly parse a postfix expression following a Boolean literal. Fixes PR34273.

Patch by Nicolas Lesser.

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

7 years ago[Sema] Correct nothrow inherited by noexcept
Erich Keane [Thu, 28 Sep 2017 20:47:10 +0000 (20:47 +0000)]
[Sema] Correct nothrow inherited by noexcept

As reported in https://bugs.llvm.org/show_bug.cgi?id=33235,
a noexcept function was unable to inherit from a nothrow defaulted
constructor. Attribute "nothrow" is supposed to be semantically
identical to noexcept, and in fact, a number of other places in the
code treat them identically.

This patch simply checks the RecordDecl for the correct attribute in
the case where no other exception specifier was set.

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

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

7 years ago[Sema] Warn on attribute nothrow conflicting with language specifiers
Erich Keane [Thu, 28 Sep 2017 20:36:53 +0000 (20:36 +0000)]
[Sema] Warn on attribute nothrow conflicting with language specifiers

I discovered it was possible to create a 'nothrow' noexcept(false)
function, which is both non-sensical as well as seemingly breaking.

This patch warns if attribute nothrow is used with anything besides "noexcept".

"noexcept(true)" isn't possible, because the noexcept decl isn't parsed until
later.

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

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

7 years agoFix test change missed in r314456
Erich Keane [Thu, 28 Sep 2017 20:23:43 +0000 (20:23 +0000)]
Fix test change missed in r314456

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

7 years agoAdd Documentation to attribute-nothrow. Additionally, limit to functions.
Erich Keane [Thu, 28 Sep 2017 20:08:03 +0000 (20:08 +0000)]
Add Documentation to attribute-nothrow. Additionally, limit to functions.

Attribute nothrow is only allowed on functions, so I added that. Additionally,
it lacks any documentation, so I added some.

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

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

7 years ago[AMDGPU] Allow flexible register names in inline asm constraints
Yaxun Liu [Thu, 28 Sep 2017 19:07:59 +0000 (19:07 +0000)]
[AMDGPU] Allow flexible register names in inline asm constraints

Currently AMDGPU inline asm only allow v and s as register names in constraints.

This patch allows the following register names in constraints: (n, m is unsigned integer, n < m)

v

s

{vn} or {v[n]}

{sn} or {s[n]}

{S} , where S is a special register name

{v[n:m]}

{s[n:m]}

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

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

7 years ago[DWARF] Allow forward declarations of a class template instantiation
Paul Robinson [Thu, 28 Sep 2017 18:37:02 +0000 (18:37 +0000)]
[DWARF] Allow forward declarations of a class template instantiation
to have child entries describing the template parameters.  This will
be on by default for SCE tuning.

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

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

7 years agoConsolidate std::move() detection code. No behavior change.
Nico Weber [Thu, 28 Sep 2017 16:16:39 +0000 (16:16 +0000)]
Consolidate std::move() detection code. No behavior change.

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

7 years agoFix -Wcast-qual warning after r314336.
Nico Weber [Thu, 28 Sep 2017 15:44:46 +0000 (15:44 +0000)]
Fix -Wcast-qual warning after r314336.

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

7 years agoUse std::is_trivial instead of is_trivially_copyable.
Benjamin Kramer [Thu, 28 Sep 2017 08:50:30 +0000 (08:50 +0000)]
Use std::is_trivial instead of is_trivially_copyable.

The oldest versions of GCC we support (before 5) didn't support that
trait. is_trivial is stronger superset that clang::Token fulfills, so
just use that instead.

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

7 years agoAdd the new -Wnull-pointer-arithmetic warnings to the release notes
Sylvestre Ledru [Thu, 28 Sep 2017 08:00:18 +0000 (08:00 +0000)]
Add the new -Wnull-pointer-arithmetic warnings to the release notes

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

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

7 years ago[NFC] Don't use C++17 standard lib variable template helper traits, instead use ...
Faisal Vali [Thu, 28 Sep 2017 02:00:40 +0000 (02:00 +0000)]
[NFC] Don't use C++17 standard lib variable template helper traits, instead use ::value.

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

7 years ago[NFC] Modernize MacroArgs using TrailingObjects
Faisal Vali [Thu, 28 Sep 2017 01:50:23 +0000 (01:50 +0000)]
[NFC] Modernize MacroArgs using TrailingObjects

Refactor MacroArgs to use TrailingObjects when creating a variably sized object on the heap to store the unexpanded tokens immediately after the MacroArgs object.

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

7 years agoLook through parentheses.
Akira Hatanaka [Thu, 28 Sep 2017 01:31:17 +0000 (01:31 +0000)]
Look through parentheses.

This fixes a bug where clang would emit instructions to reclaim a value
that's going to be __bridge-casted to CF.

rdar://problem/34687542

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

7 years ago[Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.
Davide Italiano [Thu, 28 Sep 2017 00:24:20 +0000 (00:24 +0000)]
[Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.

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

7 years ago[Preprocessor] Preserve #pragma clang assume_nonnull in preprocessed output
Eli Friedman [Wed, 27 Sep 2017 23:29:37 +0000 (23:29 +0000)]
[Preprocessor] Preserve #pragma clang assume_nonnull in preprocessed output

Patch by Zbigniew Sarbinowski!

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

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

7 years ago[AVR] Update data layout to match current LLVM trunk
Dylan McKay [Wed, 27 Sep 2017 22:09:01 +0000 (22:09 +0000)]
[AVR] Update data layout to match current LLVM trunk

The data layout was changed in r314179 to fix atomic loads and stores.

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

7 years agoAdd support for remembering origins to ExternalASTMerger
Sean Callanan [Wed, 27 Sep 2017 19:57:58 +0000 (19:57 +0000)]
Add support for remembering origins to ExternalASTMerger

ExternalASTMerger has hitherto relied on being able to look up
any Decl through its named DeclContext chain. This works for
many cases, but causes problems for function-local structs,
which cannot be looked up in their containing FunctionDecl. An
example case is

void f() {
  { struct S { int a; }; }
  { struct S { bool b; }; }
}

It is not possible to lookup either of the two Ses individually
(or even to provide enough information to disambiguate) after
parsing is over; and there is typically no need to, since they
are invisible to the outside world.

However, ExternalASTMerger needs to be able to complete either
S on demand. This led to an XFAIL on test/Import/local-struct,
which this patch removes. The way the patch works is:

It defines a new data structure, ExternalASTMerger::OriginMap,
which clients are expected to maintain (default-constructing
if the origin does not have an ExternalASTMerger servicing it)
As DeclContexts are imported, if they cannot be looked up by
name they are placed in the OriginMap. This allows
ExternalASTMerger to complete them later if necessary.
As DeclContexts are imported from an origin that already has
its own OriginMap, the origins are forwarded – but only for
those DeclContexts that are actually used. This keeps the
amount of stored data minimal.

The patch also applies several improvements from review:

- Thoroughly documents the interface to ExternalASTMerger;
- Adds optional logging to help track what's going on; and
- Cleans up a bunch of braces and dangling elses.

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

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

7 years ago[CUDA] Work around conflicting function definitions in CUDA-9 headers.
Artem Belevich [Wed, 27 Sep 2017 19:07:15 +0000 (19:07 +0000)]
[CUDA] Work around conflicting function definitions in CUDA-9 headers.

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

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

7 years ago[OpenMP] Fix translation of target args
Jonas Hahnfeld [Wed, 27 Sep 2017 18:12:36 +0000 (18:12 +0000)]
[OpenMP] Fix translation of target args

ToolChain::TranslateArgs() returns nullptr if no changes are performed.
This would currently mean that OpenMPArgs are lost. Patch fixes this
by falling back to simply using OpenMPArgs in that case.

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

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

7 years ago[OpenMP] Fix passing of -m arguments to device toolchain
Jonas Hahnfeld [Wed, 27 Sep 2017 18:12:34 +0000 (18:12 +0000)]
[OpenMP] Fix passing of -m arguments to device toolchain

AuxTriple is not set if host and device share a toolchain. Also,
removing an argument modifies the DAL which needs to be returned
for future use.
(Move tests back to offload-openmp.c as they are not related to GPUs.)

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

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

7 years ago[OpenMP] Fix memory leak when translating arguments
Jonas Hahnfeld [Wed, 27 Sep 2017 18:12:31 +0000 (18:12 +0000)]
[OpenMP] Fix memory leak when translating arguments

Parsing the argument after -Xopenmp-target allocates memory that needs
to be freed. Associate it with the final DerivedArgList after we know
which one will be used.

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

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

7 years agoclang-format/java: Unbreak genenrics formatting after r299952.
Nico Weber [Wed, 27 Sep 2017 17:57:50 +0000 (17:57 +0000)]
clang-format/java: Unbreak genenrics formatting after r299952.

https://reviews.llvm.org/rL299952 merged '>>>' tokens into a single
JavaRightLogicalShift token. This broke formatting of generics nested more than
two deep, e.g. Foo<Bar<Baz>>> because the '>>>' now weren't three '>' for
parseAngle().

Luckily, just deleting JavaRightLogicalShift fixes things without breaking the
test added in r299952, so do that.

https://reviews.llvm.org/D38291

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

7 years ago[OpenCL] Fixed CL version in failing test.
Anastasia Stulova [Wed, 27 Sep 2017 17:03:35 +0000 (17:03 +0000)]
[OpenCL] Fixed CL version in failing test.

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

7 years ago[OpenCL] Handle address space conversion while setting type alignment.
Anastasia Stulova [Wed, 27 Sep 2017 14:37:00 +0000 (14:37 +0000)]
[OpenCL] Handle address space conversion while setting type alignment.

Added missing addrspacecast case in alignment computation
logic of pointer type emission in IR generation.

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

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

7 years ago[OpenMP] Add an additional test for D34888
Gheorghe-Teodor Bercea [Wed, 27 Sep 2017 14:31:08 +0000 (14:31 +0000)]
[OpenMP] Add an additional test for D34888

Summary: Test for checking if the mapping is performed correctly. This is a test initially included in Patch https://reviews.llvm.org/D29905

Reviewers: Hahnfeld, carlo.bertolli, caomhin, ABataev

Reviewed By: Hahnfeld

Subscribers: tra, cfe-commits

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

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

7 years agorevert rL314300
Coby Tayree [Wed, 27 Sep 2017 13:02:44 +0000 (13:02 +0000)]
revert rL314300
accidently added only tests w/o the respective changes..

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

7 years ago[X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediat...
Coby Tayree [Wed, 27 Sep 2017 12:36:54 +0000 (12:36 +0000)]
[X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediate expressions

Allow the proper recognition of Enum values and global variables inside ms inline-asm memory / immediate expressions, as they require some additional overhead and treated incorrect if doesn't early recognized.
supersedes D33277, D35775
Corrsponds with D37412, D37413

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

7 years ago[analyzer] Fix an outdated comment in a test. NFC.
Artem Dergachev [Wed, 27 Sep 2017 10:59:06 +0000 (10:59 +0000)]
[analyzer] Fix an outdated comment in a test. NFC.

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

7 years ago[analyzer] Match more patterns in bugreporter::getDerefExpr() API.
Artem Dergachev [Wed, 27 Sep 2017 09:50:45 +0000 (09:50 +0000)]
[analyzer] Match more patterns in bugreporter::getDerefExpr() API.

This function can now track null pointer through simple pointer arithmetic,
such as '*&*(p + 2)' => 'p' and so on, displaying intermediate diagnostic pieces
for the user to understand where the null pointer is coming from.

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

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

7 years ago[analyzer] Fix and refactor bugreporter::getDerefExpr() API.
Artem Dergachev [Wed, 27 Sep 2017 09:33:37 +0000 (09:33 +0000)]
[analyzer] Fix and refactor bugreporter::getDerefExpr() API.

This API is used by checkers (and other entities) in order to track where does
a value originate from, by jumping from an expression value of which is equal
to that value to the expression from which this value has "appeared". For
example, it may be an lvalue from which the rvalue was loaded, or a function
call from which the dereferenced pointer was returned.

The function now avoids incorrectly unwrapping implicit lvalue-to-rvalue casts,
which caused crashes and incorrect intermediate diagnostic pieces. It also no
longer relies on how the expression is written when guessing what it means.

Fixes pr34373 and pr34731.

rdar://problem/33594502

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

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

7 years ago[clang-format] Fix FixNamespaceComments when BraceWrapping AfterNamespace is true.
Marek Kurdej [Wed, 27 Sep 2017 07:51:51 +0000 (07:51 +0000)]
[clang-format] Fix FixNamespaceComments when BraceWrapping AfterNamespace is true.

Summary:
NamespaceEndCommentsFixer did not fix namespace comments when the brace opening the namespace was not on the same line as the "namespace" keyword.
It occurs in Allman, GNU and Linux styles and whenever BraceWrapping.AfterNamespace is true.

Before:
```lang=cpp
    namespace a
    {
    void f();
    void g();
    }
```

After:
```lang=cpp
    namespace a
    {
    void f();
    void g();
    } // namespace a
```

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

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

7 years agoAdd test forgotten in r314262.
Erich Keane [Wed, 27 Sep 2017 03:23:02 +0000 (03:23 +0000)]
Add test forgotten in r314262.

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

7 years agoFix capitalization of a bunch of parameters in SemaDeclAttr [NFC]
Erich Keane [Wed, 27 Sep 2017 03:20:13 +0000 (03:20 +0000)]
Fix capitalization of a bunch of parameters in SemaDeclAttr [NFC]

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

7 years ago[clang-format] Adjust space around &/&& of structured bindings
Chih-Hung Hsieh [Wed, 27 Sep 2017 00:58:45 +0000 (00:58 +0000)]
[clang-format] Adjust space around &/&& of structured bindings

Keep space before or after the &/&& tokens, but not both. For example,
  auto [x,y] = a;
  auto &[xr, yr] = a; // LLVM style
  auto& [xr, yr] = a; // google style

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

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

7 years agoEmit section information for extern variables.
Erich Keane [Tue, 26 Sep 2017 23:42:34 +0000 (23:42 +0000)]
Emit section information for extern variables.

Currently, if _attribute_((section())) is used for extern variables,
section information is not emitted in generated IR when the variables are used.
This is expected since sections are not generated for external linkage objects.
However NiosII requires this information as it uses special GP-relative accesses
for any objects that use attribute section (.sdata). GCC keeps this attribute in
  middle-end.

This change emits the section information for all targets.

Patch By: Elizabeth Andrews

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

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

7 years agoFix uninitialized member found by msan build bot.
Richard Smith [Tue, 26 Sep 2017 21:33:43 +0000 (21:33 +0000)]
Fix uninitialized member found by msan build bot.

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

7 years agoSema: rename SemaBuiltinVAStart to SemaBuiltinVAStartMicrosoft
Saleem Abdulrasool [Tue, 26 Sep 2017 20:12:04 +0000 (20:12 +0000)]
Sema: rename SemaBuiltinVAStart to SemaBuiltinVAStartMicrosoft

This function is used to perform semantic analysis on Microsoft style
`__va_start`.  Rename it to make this more explicit.  `__va_start` is
marked as `ALL_MS_LANGUAGES`, and requires Microsoft compatibility.
Other GNU targets will use `__builtin_va_start` instead.  NFC.

Addresses post-commit review comments from David Majnemer.

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

7 years agoRevert commmit 314228.
Gheorghe-Teodor Bercea [Tue, 26 Sep 2017 19:58:23 +0000 (19:58 +0000)]
Revert commmit 314228.

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

7 years agoBasic: support Preserve{Most,All} CC on Windows
Saleem Abdulrasool [Tue, 26 Sep 2017 19:26:01 +0000 (19:26 +0000)]
Basic: support Preserve{Most,All} CC on Windows

Add support for the `preserve_mostcc` and `preserve_allcc` on Windows
x86_64 and AArch64.  This is used by Swift.

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

7 years agoAllow IUnknown/IInterface types to come from extern C++
Erich Keane [Tue, 26 Sep 2017 18:55:16 +0000 (18:55 +0000)]
Allow IUnknown/IInterface types to come from extern C++

It was brought up in response to my last implementation for
this struct-as-interface features that at least 1 header in
the MS SDK uses "extern C++" around an IUnknown declaration.

The previous implementation demanded that this type exist
in the TranslationUnit DeclContext.  This small change simply
also allows in the situation where we're extern "C++".

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

7 years agoDelete trailing whitespace.
Nico Weber [Tue, 26 Sep 2017 18:38:56 +0000 (18:38 +0000)]
Delete trailing whitespace.

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

7 years agoResolve a defect in C++17 copy omission.
Richard Smith [Tue, 26 Sep 2017 18:37:55 +0000 (18:37 +0000)]
Resolve a defect in C++17 copy omission.

When selecting constructors for initializing an object of type T from a single
expression of class type U, also consider conversion functions of U that
convert to T (rather than modeling such conversions as calling a conversion
function and then calling a constructor).

This approach is proposed as the resolution for the defect, and is also already
implemented by GCC.

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

7 years ago[Sema] Corrected the warn-on-throw-from-noexcept behavior to include nothrow
Erich Keane [Tue, 26 Sep 2017 18:20:39 +0000 (18:20 +0000)]
[Sema] Corrected the warn-on-throw-from-noexcept behavior to include nothrow

Discovered that 'nothrow' (which is supposed to be an alias for noexcept)
was not warning with a throw inside of it. This patch corrects the behavior
previously created to add 'nothrow' to this list.

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

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

7 years ago[OpenMP] Add an additional test for D34888
Gheorghe-Teodor Bercea [Tue, 26 Sep 2017 18:12:12 +0000 (18:12 +0000)]
[OpenMP] Add an additional test for D34888

Summary: Test for checking if the mapping is performed correctly. This is a test initially included in Patch https://reviews.llvm.org/D29905

Reviewers: Hahnfeld, carlo.bertolli, caomhin

Reviewed By: Hahnfeld

Subscribers: tra, cfe-commits

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

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

7 years agoSema: Windows/ARM __va_start is not const correct
Saleem Abdulrasool [Tue, 26 Sep 2017 17:44:10 +0000 (17:44 +0000)]
Sema: Windows/ARM __va_start is not const correct

The `__va_start` intrinsic for Windows ARM does not account for const
correctness when performing a check.  All local qualifiers are ignored
when validating the invocation.  This was exposed by building the swift
stdlib against the Windows 10586 SDK for ARM.  Simply expand out the
check for the two parameters and ignore the qualifiers for the check.

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

7 years ago[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.
Artem Belevich [Tue, 26 Sep 2017 17:07:23 +0000 (17:07 +0000)]
[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.

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

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

7 years ago[OPENMP] Fix handling of implicit mapping of array sections.
Alexey Bataev [Tue, 26 Sep 2017 16:19:04 +0000 (16:19 +0000)]
[OPENMP] Fix handling of implicit mapping of array sections.

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

7 years ago[analyzer] Keep track of design discusions as part of analyzer documentation.
Artem Dergachev [Tue, 26 Sep 2017 15:49:53 +0000 (15:49 +0000)]
[analyzer] Keep track of design discusions as part of analyzer documentation.

Create a directory to store discussions on potentially useful features that are
not yet implemented in the analyzer.

Fill it with a discussion on representing checker-specific parts of the program
state for C++ object modeling, that occured in D35216.

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

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

7 years ago[OpenMP] Don't throw cudalib not found error if only front-end is required.
Gheorghe-Teodor Bercea [Tue, 26 Sep 2017 15:36:20 +0000 (15:36 +0000)]
[OpenMP] Don't throw cudalib not found error if only front-end is required.

Summary: If we only use the compiler front-end, do not throw an error about the cuda device library not being found. This allows the front-end to be run on systems where no Cuda installation is found.

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

Reviewed By: tra

Subscribers: hfinkel, tra, cfe-commits

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

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

7 years agoRevert commit 314210.
Gheorghe-Teodor Bercea [Tue, 26 Sep 2017 15:24:34 +0000 (15:24 +0000)]
Revert commit 314210.

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

7 years ago[mips] Accept but ignore -m(no-)branch-likely
Simon Dardis [Tue, 26 Sep 2017 15:01:21 +0000 (15:01 +0000)]
[mips] Accept but ignore -m(no-)branch-likely

-mbranch-likely and -mno-branch-likely are used in some build systems for
some MIPS targets. Accept these options but ignore them as they are an
(de)optimiztion hint, and that branch likely instructions were deprecated
but not removed from MIPS32 and MIPS64 ISAs.

Reviewers: atanasyan, nitesh.jain

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

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

7 years ago[clang-format] Add ext/ to google include categories
Krasimir Georgiev [Tue, 26 Sep 2017 14:58:29 +0000 (14:58 +0000)]
[clang-format] Add ext/ to google include categories

Summary: This adds an ext/ header include category for google style.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[OpenMP] Add an additional test for D34888
Gheorghe-Teodor Bercea [Tue, 26 Sep 2017 14:56:50 +0000 (14:56 +0000)]
[OpenMP] Add an additional test for D34888

Summary: Test for checking if the mapping is performed correctly. This is a test initially included in Patch https://reviews.llvm.org/D29905

Reviewers: Hahnfeld, carlo.bertolli, caomhin

Reviewed By: Hahnfeld

Subscribers: tra, cfe-commits

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

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

7 years agoFix TBAA information for reference accesses
Ivan A. Kosarev [Tue, 26 Sep 2017 14:22:48 +0000 (14:22 +0000)]
Fix TBAA information for reference accesses

This patch fixes clang to decorate reference accesses as pointers
and not as "omnipotent chars".

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

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

7 years ago[OPENMP] Generate implicit map|firstprivate clauses for target-based
Alexey Bataev [Tue, 26 Sep 2017 13:47:31 +0000 (13:47 +0000)]
[OPENMP] Generate implicit map|firstprivate clauses for target-based
directives.

If the variable is used in the target-based region but is not found in
any private|mapping clause, then generate implicit firstprivate|map
clauses for these implicitly mapped variables.

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

7 years ago[XRay] Avoid actual linking when testing the driver
Dean Michael Berris [Tue, 26 Sep 2017 04:29:25 +0000 (04:29 +0000)]
[XRay] Avoid actual linking when testing the driver

Use -### in the command to see just look for the output of -v.

Follow-up to D38226.

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

7 years ago[XRay] Run command once without piping to FileCheck
Dean Michael Berris [Tue, 26 Sep 2017 04:17:37 +0000 (04:17 +0000)]
[XRay] Run command once without piping to FileCheck

This allows us to debug the failures that come up from the build bots.

Follow-up to D38226.

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

7 years ago[XRay] Only run shared tests when 'enable_shared' is true
Dean Michael Berris [Tue, 26 Sep 2017 04:07:45 +0000 (04:07 +0000)]
[XRay] Only run shared tests when 'enable_shared' is true

Follow-up to D38226.

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

7 years ago[XRay] Remove -fPIC from shared build test.
Dean Michael Berris [Tue, 26 Sep 2017 04:00:41 +0000 (04:00 +0000)]
[XRay] Remove -fPIC from shared build test.

Follow-up to D38226.

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

7 years ago[XRay] Stop running tests for 'amd64', and remove -fPIE from tests.
Dean Michael Berris [Tue, 26 Sep 2017 03:45:37 +0000 (03:45 +0000)]
[XRay] Stop running tests for 'amd64', and remove -fPIE from tests.

Follow-up to D38226.

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

7 years ago[XRay][Driver] Do not link in XRay runtime in shared libs
Dean Michael Berris [Tue, 26 Sep 2017 03:18:11 +0000 (03:18 +0000)]
[XRay][Driver] Do not link in XRay runtime in shared libs

Summary:
This change ensures that we don't link in the XRay runtime when building
shared libraries with clang. This doesn't prevent us from building
shared libraris tht have XRay instrumentation sleds, but it does prevent
us from linking in the static XRay runtime into a shared library.

The XRay runtime currently doesn't support dynamic registration of
instrumentation sleds in shared objects, which we'll start enabling in
the future. That work has to happen in the back-end and in the runtime.

Reviewers: rnk, pelikan

Subscribers: cfe-commits

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

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

7 years agoCodeGenModule: Adapt to LLVM TargetLibraryInfo changes
Matthias Braun [Tue, 26 Sep 2017 02:37:23 +0000 (02:37 +0000)]
CodeGenModule: Adapt to LLVM TargetLibraryInfo changes

Adapt to LLVM TargetLibraryInfo changes in r314185.

See also https://reviews.llvm.org/D38106 and https://reviews.llvm.org/D37891

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

7 years agoRevert "[XRay][Driver] Do not link in XRay runtime in shared libs"
Dean Michael Berris [Tue, 26 Sep 2017 00:41:08 +0000 (00:41 +0000)]
Revert "[XRay][Driver] Do not link in XRay runtime in shared libs"

Reverts r314177.

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

7 years ago[XRay][Driver] Do not link in XRay runtime in shared libs
Dean Michael Berris [Mon, 25 Sep 2017 23:40:33 +0000 (23:40 +0000)]
[XRay][Driver] Do not link in XRay runtime in shared libs

Summary:
This change ensures that we don't link in the XRay runtime when building
shared libraries with clang. This doesn't prevent us from building
shared libraris tht have XRay instrumentation sleds, but it does prevent
us from linking in the static XRay runtime into a shared library.

The XRay runtime currently doesn't support dynamic registration of
instrumentation sleds in shared objects, which we'll start enabling in
the future. That work has to happen in the back-end and in the runtime.

Reviewers: rnk, pelikan

Subscribers: cfe-commits

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

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

7 years agoclang-format/java: Always put space after `assert` keyword.
Nico Weber [Mon, 25 Sep 2017 22:42:49 +0000 (22:42 +0000)]
clang-format/java: Always put space after `assert` keyword.

Previously, it was missing if the expression after the assert started with a (.

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

7 years agoAllow specifying sanitizers in blacklists
Vlad Tsyrklevich [Mon, 25 Sep 2017 22:11:12 +0000 (22:11 +0000)]
Allow specifying sanitizers in blacklists

Summary:
This is the follow-up patch to D37924.

This change refactors clang to use the the newly added section headers
in SpecialCaseList to specify which sanitizers blacklists entries
should apply to, like so:

  [cfi-vcall]
  fun:*bad_vcall*
  [cfi-derived-cast|cfi-unrelated-cast]
  fun:*bad_cast*

The SanitizerSpecialCaseList class has been added to allow querying by
SanitizerMask, and SanitizerBlacklist and its downstream users have been
updated to provide that information. Old blacklists not using sections
will continue to function identically since the blacklist entries will
be placed into a '[*]' section by default matching against all
sanitizers.

Reviewers: pcc, kcc, eugenis, vsk

Reviewed By: eugenis

Subscribers: dberris, cfe-commits, mgorny

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

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

7 years ago[OpenMP] Enable the existing nocudalib flag for OpenMP offloading toolchain.
Gheorghe-Teodor Bercea [Mon, 25 Sep 2017 21:56:32 +0000 (21:56 +0000)]
[OpenMP] Enable the existing nocudalib flag for OpenMP offloading toolchain.

Summary: Enable the -nocudalib flag for the OpenMP device offloading toolchain as well. Currently it can only be used for the CUDA toolchain.

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

Reviewed By: tra

Subscribers: hfinkel, cfe-commits

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

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

7 years ago[x86] make assertions less strict in avx512f test file
Sanjay Patel [Mon, 25 Sep 2017 21:31:08 +0000 (21:31 +0000)]
[x86] make assertions less strict in avx512f test file

Missed a line in r314158.

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

7 years ago[x86] make assertions less strict in avx512f test file
Sanjay Patel [Mon, 25 Sep 2017 21:27:37 +0000 (21:27 +0000)]
[x86] make assertions less strict in avx512f test file

I'm not sure why yet, but there may be differences depending on the host?

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

7 years ago[OpenMP] Bugfix: output file name drops the absolute path where full path is needed.
Gheorghe-Teodor Bercea [Mon, 25 Sep 2017 21:25:38 +0000 (21:25 +0000)]
[OpenMP] Bugfix: output file name drops the absolute path where full path is needed.

Summary: When composing the output file name, the path to the file is being dropped. The full path is required.

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

Reviewed By: tra

Subscribers: hfinkel, tra, cfe-commits

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

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

7 years agoRevert commit with wrong message.
Gheorghe-Teodor Bercea [Mon, 25 Sep 2017 21:22:49 +0000 (21:22 +0000)]
Revert commit with wrong message.

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

7 years ago[OpenMP] Don't throw cudalib not found error if only front-end is required.
Gheorghe-Teodor Bercea [Mon, 25 Sep 2017 21:07:16 +0000 (21:07 +0000)]
[OpenMP] Don't throw cudalib not found error if only front-end is required.

Summary: If we only use the compiler front-end, do not throw an error about the cuda device library not being found. This allows the front-end to be run on systems where no Cuda installation is found.

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

Reviewed By: tra

Subscribers: hfinkel, tra, cfe-commits

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

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

7 years agoReinstall the patch "Use EmitPointerWithAlignment to get alignment information of...
Wei Mi [Mon, 25 Sep 2017 19:57:59 +0000 (19:57 +0000)]
Reinstall the patch "Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr" after fixing PR31620.

This is to fix PR34347. EmitAtomicExpr now only uses alignment information from
Type, instead of Decl, so when the declaration of an atomic variable is marked
to have the alignment equal as its size, EmitAtomicExpr doesn't know about it and
will generate libcall instead of atomic op. The patch uses EmitPointerWithAlignment
to get the precise alignment information.

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

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

7 years ago[x86] remove RUNs that were checking fully optimized IR
Sanjay Patel [Mon, 25 Sep 2017 19:56:57 +0000 (19:56 +0000)]
[x86] remove RUNs that were checking fully optimized IR

Clang regression tests that depend on the optimizer can break
when there are changes to LLVM...as in:
https://reviews.llvm.org/rL314117

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

7 years agoRevert "[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins."...
Justin Lebar [Mon, 25 Sep 2017 19:41:56 +0000 (19:41 +0000)]
Revert "[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.", rL314135.

Causing assertion failures on macos:

> Assertion failed: (Num < NumOperands && "Invalid child # of SDNode!"),
> function getOperand, file
> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm/include/llvm/CodeGen/SelectionDAGNodes.h,
> line 835.

http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/42739/testReport/LLVM/CodeGen_NVPTX/surf_read_cuda_ll/

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

7 years ago[analyzer] Fix crash on modeling of pointer arithmetic
Alexander Shaposhnikov [Mon, 25 Sep 2017 19:32:33 +0000 (19:32 +0000)]
[analyzer] Fix crash on modeling of pointer arithmetic

This patch fixes analyzer's crash on the newly added test case
(see also https://bugs.llvm.org/show_bug.cgi?id=34374).
Pointers subtraction appears to be modeled incorrectly
in the following example:
  char* p;
  auto n = p - reinterpret_cast<char*>((unsigned long)1);
In this case the analyzer (built without this patch)
tries to create a symbolic value for the difference
treating reinterpret_cast<char*>((unsigned long)1)
as an integer, that is not correct.

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

Test plan: make check-all

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

7 years ago[MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked
Martin Storsjo [Mon, 25 Sep 2017 19:24:45 +0000 (19:24 +0000)]
[MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked

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

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

7 years ago[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.
Artem Belevich [Mon, 25 Sep 2017 18:53:57 +0000 (18:53 +0000)]
[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.

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

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

7 years ago[CUDA] Fix names of __nvvm_vote* intrinsics.
Artem Belevich [Mon, 25 Sep 2017 17:55:26 +0000 (17:55 +0000)]
[CUDA] Fix names of __nvvm_vote* intrinsics.

Also fixed a syntax error in activemask().

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

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

7 years ago[Sema] Null check in BuildDeclarationNameExpr
Yi Kong [Mon, 25 Sep 2017 17:36:54 +0000 (17:36 +0000)]
[Sema] Null check in BuildDeclarationNameExpr

Qualtype may point to null if we cannot infer its type yet.

Fixes PR33843

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

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

7 years ago[Clang] Adding missing feature to goldmont
Michael Zuckerman [Mon, 25 Sep 2017 13:49:32 +0000 (13:49 +0000)]
[Clang] Adding missing feature to goldmont

Change-Id: I6c22478d16b8e02ce60dae2f8c80d43bc5ab3a9c

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

7 years agofixing a bug in mask[z]_set1 intrinsic
Jina Nahias [Mon, 25 Sep 2017 13:38:08 +0000 (13:38 +0000)]
fixing a bug in mask[z]_set1 intrinsic

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

Change-Id: I80bbff9cbe93e4be54d8a761ef9723edf3f57c57

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

7 years agoFix implicit-fallthrough warning by adding missing break
Simon Pilgrim [Sun, 24 Sep 2017 15:17:46 +0000 (15:17 +0000)]
Fix implicit-fallthrough warning by adding missing break

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

7 years agoDon't warn about runtime behavior problems in variable initializers that we
Richard Smith [Sat, 23 Sep 2017 18:27:11 +0000 (18:27 +0000)]
Don't warn about runtime behavior problems in variable initializers that we
know are going to be constant-evaluated.

Any relevant diagnostics should be produced by constant expression evaluation.

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

7 years agoSilence unused variable warning in Release builds.
Benjamin Kramer [Sat, 23 Sep 2017 16:08:48 +0000 (16:08 +0000)]
Silence unused variable warning in Release builds.

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

7 years ago[docs] Fix typos in Clang's User's Manual.
Reka Kovacs [Sat, 23 Sep 2017 12:13:32 +0000 (12:13 +0000)]
[docs] Fix typos in Clang's User's Manual.

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

7 years agoPromote storage-only __fp16 vector operands to float vectors.
Akira Hatanaka [Sat, 23 Sep 2017 05:02:02 +0000 (05:02 +0000)]
Promote storage-only __fp16 vector operands to float vectors.

This commit fixes a bug in the handling of storage-only __fp16 vectors
where clang didn't promote __fp16 vector operands to float vectors.

Conceptually, it performs the following transformation on the AST in
CreateBuiltinBinOp and CreateBuiltinUnaryOp:

(Before)
  typedef __fp16 half4 __attribute__ ((vector_size (8)));
  typedef float float4 __attribute__ ((vector_size (16)));
  half4 hv0, hv1, hv2, hv3;

  hv0 = hv1 + hv2 + hv3;

(After)
  float4 t0 = (float4)hv1 + (float4)hv2;
  float4 t1 = t0 + (float4)hv3;
  hv0 = (half4)t1;

Note that this commit fixes the bug for targets that set
HalfArgsAndReturns to true (ARM and ARM64). Targets using intrinsics
such as llvm.convert.to.fp16 to handle __fp16 are still broken.

rdar://problem/20625184

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

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

7 years agoCorrectly compute linkage for members of internal linkage classes.
Richard Smith [Sat, 23 Sep 2017 04:02:17 +0000 (04:02 +0000)]
Correctly compute linkage for members of internal linkage classes.

We used to give such members no linkage instead of giving them the linkage of
the class.

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

7 years agoCommit missing fixes for tool_file_rename
Reid Kleckner [Sat, 23 Sep 2017 01:04:42 +0000 (01:04 +0000)]
Commit missing fixes for tool_file_rename

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

7 years ago[Support] Rename tool_output_file to ToolOutputFile, NFC
Reid Kleckner [Sat, 23 Sep 2017 01:03:17 +0000 (01:03 +0000)]
[Support] Rename tool_output_file to ToolOutputFile, NFC

This class isn't similar to anything from the STL, so it shouldn't use
the STL naming conventions.

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

7 years ago[Analyzer] Fix minor errors in python scripts.
George Karpenkov [Fri, 22 Sep 2017 22:58:46 +0000 (22:58 +0000)]
[Analyzer] Fix minor errors in python scripts.

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

7 years agoDR1113: anonymous namespaces formally give their contents internal linkage.
Richard Smith [Fri, 22 Sep 2017 22:21:44 +0000 (22:21 +0000)]
DR1113: anonymous namespaces formally give their contents internal linkage.

This doesn't affect our code generation in any material way -- we already give
such declarations internal linkage from a codegen perspective -- but it has
some subtle effects on code validity.

We suppress the 'L' (internal linkage) marker for mangled names in anonymous
namespaces, because it is redundant (the information is already carried by the
namespace); this deviates from GCC's behavior if a variable or function in an
anonymous namespace is redundantly declared 'static' (where GCC does include
the 'L'), but GCC's behavior is incoherent because such a declaration can be
validly declared with or without the 'static'.

We still deviate from the standard in one regard here: extern "C" declarations
in anonymous namespaces are still granted external linkage. Changing those does
not appear to have been an intentional consequence of the standard change in
DR1113.

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

7 years ago[test] Enable clang-func-mapping as a test dep with the analyzer
Vedant Kumar [Fri, 22 Sep 2017 22:17:10 +0000 (22:17 +0000)]
[test] Enable clang-func-mapping as a test dep with the analyzer

clang-func-mapping should not be a test dependency when the static
analyzer isn't being built.

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

7 years agoFix unused variable warning in non-debug builds.
Richard Trieu [Fri, 22 Sep 2017 22:16:13 +0000 (22:16 +0000)]
Fix unused variable warning in non-debug builds.

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

7 years agoclang-format plugin: Add missing NL (new line) at EOF (end of file)
Hans Wennborg [Fri, 22 Sep 2017 21:47:39 +0000 (21:47 +0000)]
clang-format plugin: Add missing NL (new line) at EOF (end of file)

clang-format.exe removes trailing new lines at end of file.

However, if no NL is found at EOF one should be added.

Patch by Teodor MICU!

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

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

7 years ago[CodeGen][ObjC] Build the global block structure before emitting the
Akira Hatanaka [Fri, 22 Sep 2017 21:32:06 +0000 (21:32 +0000)]
[CodeGen][ObjC] Build the global block structure before emitting the
body of global block invoke functions.

This commit fixes an infinite loop in IRGen that occurs when compiling
the following code:

void FUNC2() {
  static void (^const block1)(int) = ^(int a){
    if (a--)
      block1(a);
  };
}

This is how IRGen gets stuck in the infinite loop:

1. GenerateBlockFunction is called to emit the body of "block1".

2. GetAddrOfGlobalBlock is called to get the address of "block1". The
   function calls getAddrOfGlobalBlockIfEmitted to check whether the
   global block has been emitted. If it hasn't been emitted, it then
   tries to emit the body of the block function by calling
   GenerateBlockFunction, which goes back to step 1.

This commit prevents the inifinite loop by building the global block in
GenerateBlockFunction before emitting the body of the block function.

rdar://problem/34541684

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

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

7 years ago[clang] Fix isExternC matcher docs
Alexander Shaposhnikov [Fri, 22 Sep 2017 19:29:38 +0000 (19:29 +0000)]
[clang] Fix isExternC matcher docs

The wording in the documentation for the matcher isExternC
appears to be misleading since this matcher
is applicable to functions and variables as well.
This diff changes the comment and regenerates the html file.

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

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

7 years agoSet completion priority of destructors and operators to CCP_Unlikely.
Ilya Biryukov [Fri, 22 Sep 2017 19:07:37 +0000 (19:07 +0000)]
Set completion priority of destructors and operators to CCP_Unlikely.

Summary:
It will move destructors and operators to the end of completion list.
Destructors and operators are currently very high on the completion
list, as they have the same priority as member functions. However,
they are clearly not something users usually choose in completion
lists.

Reviewers: arphaman, erikjv, bkramer, krasimir

Reviewed By: arphaman

Subscribers: eraman, klimek, cfe-commits

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

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

7 years ago[lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing
Vedant Kumar [Fri, 22 Sep 2017 18:42:28 +0000 (18:42 +0000)]
[lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing

This un-breaks a lit workflow where you run lit tests from a test
sub-directory within clang without first building clang-func-mapping.

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