]> granicus.if.org Git - clang/log
clang
6 years ago[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 16 Feb 2018 23:40:07 +0000 (23:40 +0000)]
[Basic] 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@325412 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ThinLTO] Allow indexing to request backend to ignore the module
Vitaly Buka [Fri, 16 Feb 2018 23:38:22 +0000 (23:38 +0000)]
[ThinLTO] Allow indexing to request backend to ignore the module

Summary:
Gold plugin does not add pass to ThinLTO modules without useful symbols.
In this case ThinLTO can't create corresponding index file and some features, like CFI,
cannot be processes by backed correctly without index.
Given that we don't need the backed output we can request it to avoid
processing the module. This is implemented by this patch using new
"SkipModuleByDistributedBackend" flag.

Reviewers: pcc, tejohnson

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

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

6 years ago[ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is set
Vitaly Buka [Fri, 16 Feb 2018 23:34:16 +0000 (23:34 +0000)]
[ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is set

Summary:
ThinLTO compilation may decide not to split module and keep at as regular LTO.
In this can this module already processed during indexing and already a part of
merged object file. So here we can just skip it.

Reviewers: pcc, tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

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

6 years ago[OPENMP] Do not emit messages for templates in declare target
Alexey Bataev [Fri, 16 Feb 2018 21:23:23 +0000 (21:23 +0000)]
[OPENMP] Do not emit messages for templates in declare target
constructs.

The compiler may emit some extra warnings for functions, that are
implicit specialization of the templates, declared in the target region.

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

6 years ago[MS] Make constexpr static data members implicitly inline
Reid Kleckner [Fri, 16 Feb 2018 19:44:47 +0000 (19:44 +0000)]
[MS] Make constexpr static data members implicitly inline

This handles them exactly the same way that we handle const integral
static data members with inline definitions, which is what MSVC does.

As a follow-up, now that we have a way to mark variables inline in the
AST, we should consider marking them implicitly inline there instead of
only treating them as inline in CodeGen. Unfortunately, this breaks a
lot of dllimport test cases, so that is future work for now.

Fixes PR36125.

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

6 years ago[OPENMP] Fix PR35873: Fix data-sharing attributes for const variables.
Alexey Bataev [Fri, 16 Feb 2018 19:16:54 +0000 (19:16 +0000)]
[OPENMP] Fix PR35873: Fix data-sharing attributes for const variables.

Compiler erroneously returned wrong data-sharing attributes for the
constant variables if they have explictly specified attributes.

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

6 years ago[OPENMP] Fix parsing of the directives with inner directives.
Alexey Bataev [Fri, 16 Feb 2018 18:36:44 +0000 (18:36 +0000)]
[OPENMP] Fix parsing of the directives with inner directives.

The parsing may lead to compiler hanging because of the incorrect
processing of inner OpenMP pragmas.

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

6 years agoClean up 'target' attribute diagnostics
Erich Keane [Fri, 16 Feb 2018 17:31:59 +0000 (17:31 +0000)]
Clean up 'target' attribute diagnostics

There were a few issues previously with the target
attribute diagnostics implementation that lead to the
attribute being added to the AST despite having an error
in it.

This patch changes that, and adds a test to ensure it
does not get added to the AST.

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

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

6 years agoUse Token::isOneOf method in Parser.
Frederich Munch [Fri, 16 Feb 2018 16:07:33 +0000 (16:07 +0000)]
Use Token::isOneOf method in Parser.

Summary: Easier to read and possibly optimize.

Reviewers: rsmith, sepavloff

Reviewed By: sepavloff

Subscribers: sepavloff, cfe-commits

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

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

6 years ago[ARM] Add tests for the vcvtr builtins
Sjoerd Meijer [Fri, 16 Feb 2018 16:01:08 +0000 (16:01 +0000)]
[ARM] Add tests for the vcvtr builtins

This adds Sema and Codegen tests for the vcvtr builtins
(because they were missing).

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

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

6 years ago[Coroutines] Use target-agnostic size_t in test
Brian Gesiak [Fri, 16 Feb 2018 14:11:27 +0000 (14:11 +0000)]
[Coroutines] Use target-agnostic size_t in test

Summary:
Fix a test failure on ARM hosts that was caused by a difference in the type of
size_t, by using a target-agnostic definiton.

Test Plan:
```
clang -cc1 -internal-isystem build/lib/clang/7.0.0/include -nostdsysteminc \
      -std=c++14 -fcoroutines-ts -verify clang/test/SemaCXX/coroutines.cpp \
      -fcxx-exceptions -fexceptions \
      -triple armeb-none-eabi
```

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

6 years ago[clang-format] Enable google text proto formatting in R"proto('s
Krasimir Georgiev [Fri, 16 Feb 2018 12:10:06 +0000 (12:10 +0000)]
[clang-format] Enable google text proto formatting in R"proto('s

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

6 years agoRevert r325321 "[Sema] Take into account the current context when checking the"
Hans Wennborg [Fri, 16 Feb 2018 12:06:32 +0000 (12:06 +0000)]
Revert r325321 "[Sema] Take into account the current context when checking the"

This broke the Chromium build, see https://crbug.com/813017

> accessibility of a class member.
>
> This fixes PR32898.
>
> rdar://problem/33737747
>
> Differential revision: https://reviews.llvm.org/D36918

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

6 years ago[Sema] Take into account the current context when checking the
Akira Hatanaka [Fri, 16 Feb 2018 08:47:37 +0000 (08:47 +0000)]
[Sema] Take into account the current context when checking the
accessibility of a class member.

This fixes PR32898.

rdar://problem/33737747

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

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

6 years ago[Coverage] Handle break/continue outside of loop bodies
Vedant Kumar [Fri, 16 Feb 2018 07:59:43 +0000 (07:59 +0000)]
[Coverage] Handle break/continue outside of loop bodies

Teach the coverage mapping logic to handle break or continue statements
within for loop increments.

Fixes llvm.org/PR36406.

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

6 years ago[DOXYGEN] There was a request in the review D41507 to change the notation for hex...
Ekaterina Romanova [Fri, 16 Feb 2018 03:11:35 +0000 (03:11 +0000)]
[DOXYGEN] There was a request in the review D41507 to change the notation for hex numbers in doxygen documentation from <...>h to 0x<...>. Both of these notations were used in x86 intrinsics documentation. I promised to change them to 0x<...> for consistency.

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

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

6 years ago[Modules] Extend -fmodule-name semantic for frameworks with private modules
Bruno Cardoso Lopes [Fri, 16 Feb 2018 00:12:57 +0000 (00:12 +0000)]
[Modules] Extend -fmodule-name semantic for frameworks with private modules

Assume Foo.framework with two module maps and two modules Foo and
Foo_Private.

Framework authors need to skip building both Foo and Foo_Private when
using -fmodule-name=Foo, since both are part of the framework and used
interchangeably during compilation.

rdar://problem/37500098

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

6 years ago[OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.
Alexey Bataev [Thu, 15 Feb 2018 23:39:43 +0000 (23:39 +0000)]
[OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.

Codegen for ordered with doacross construct might produce incorrect code
because of missing cleanup scope for the construct. Without this scope
the final runtime function call could be emitted in the wrong order that
leads to incorrect codegen.

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

6 years ago[OPENMP] Fix PR38398: compiler crash on standalone pragma ordered with depend sink...
Alexey Bataev [Thu, 15 Feb 2018 22:42:57 +0000 (22:42 +0000)]
[OPENMP] Fix PR38398: compiler crash on standalone pragma ordered with depend sink|source clause.

Patch fixes compiler crash on standalone #pragmas ordered with
depend(sink|source) clauses.

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

6 years agoSilence a -Wparentheses warning; NFC.
Aaron Ballman [Thu, 15 Feb 2018 21:03:39 +0000 (21:03 +0000)]
Silence a -Wparentheses warning; NFC.

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

6 years agoSilence some -Wunused-variable warnings; NFC.
Aaron Ballman [Thu, 15 Feb 2018 20:56:19 +0000 (20:56 +0000)]
Silence some -Wunused-variable warnings; NFC.

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

6 years ago[Coroutines] Use allocator overload when available
Brian Gesiak [Thu, 15 Feb 2018 20:37:22 +0000 (20:37 +0000)]
[Coroutines] Use allocator overload when available

Summary:
Depends on https://reviews.llvm.org/D42605.

An implementation of the behavior described in `[dcl.fct.def.coroutine]/7`:
when a promise type overloads `operator new` using a "placement new"
that takes the same argument types as the coroutine function, that
overload is used when allocating the coroutine frame.

Simply passing references to the coroutine function parameters directly
to `operator new` results in invariant violations in LLVM's coroutine
splitting pass, so this implementation modifies Clang codegen to
produce allocator-specific alloc/store/loads for each parameter being
forwarded to the allocator.

Test Plan: `check-clang`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: lewissbaker, EricWF, cfe-commits

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

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

6 years ago[Sema] Toggle diags when finding allocators (NFCI)
Brian Gesiak [Thu, 15 Feb 2018 20:09:25 +0000 (20:09 +0000)]
[Sema] Toggle diags when finding allocators (NFCI)

Summary:
Many methods in Sema take a `bool Diagnose` parameter. Examples of such
methods include `Sema::FindDeallocationFunction` and
`Sema::SpecialMemberIsTrivial`. Calling these methods with
`Diagnose = false` allows callers to, for instance, check for the
existence of a deallocation function, without that check resulting in
error diagnostics being emitted if no matching deallocation function exists.

Add a similar `bool Diagnose` to the `Sema::FindAllocationFunctions`
method, so that checks for the existence of allocation functions can be
made without triggering error diagnostics.

This allows `SemaCoroutine.cpp`, in its implementation of the
Coroutines TS, to check for the existence of a particular `operator new`
overload, but then without error fall back to a default `operator new`
if no matching overload exists.

Test Plan: `check-clang`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Suppress temporary destructors for temporary arrays.
Artem Dergachev [Thu, 15 Feb 2018 19:34:19 +0000 (19:34 +0000)]
[analyzer] Suppress temporary destructors for temporary arrays.

Array destructors, like constructors, need to be called for each element of the
array separately. We do not have any mechanisms to do this in the analyzer,
so for now all we do is evaluate a single constructor or destructor
conservatively and give up. It automatically causes the necessary invalidation
and pointer escape for the whole array, because this is how RegionStore works.

Implement this conservative behavior for temporary destructors. This fixes the
crash on the provided test.

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

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

6 years ago[analyzer] Implement path notes for temporary destructors.
Artem Dergachev [Thu, 15 Feb 2018 19:28:21 +0000 (19:28 +0000)]
[analyzer] Implement path notes for temporary destructors.

Temporary destructors fire at the end of the full-expression. It is reasonable
to attach the path note for entering/leaving the temporary destructor to its
CXXBindTemporaryExpr. This would not affect lifetime-extended temporaries with
their automatic destructors which aren't temporary destructors.

The path note may be confusing in the case of destructors after elidable copy
constructors.

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

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

6 years ago[analyzer] Compute the correct this-region for temporary destructors.
Artem Dergachev [Thu, 15 Feb 2018 19:17:44 +0000 (19:17 +0000)]
[analyzer] Compute the correct this-region for temporary destructors.

Inline them if possible - a separate flag is added to control this.
The whole thing is under the cfg-temporary-dtors flag, off by default so far.

Temporary destructors are called at the end of full-expression. If the
temporary is lifetime-extended, automatic destructors kick in instead,
which are not addressed in this patch, and normally already work well
modulo the overally broken support for lifetime extension.

The patch operates by attaching the this-region to the CXXBindTemporaryExpr in
the program state, and then recalling it during destruction that was triggered
by that CXXBindTemporaryExpr. It has become possible because
CXXBindTemporaryExpr is part of the construction context since r325210.

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

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

6 years agoClean up AMDGCN tests
Yaxun Liu [Thu, 15 Feb 2018 19:12:41 +0000 (19:12 +0000)]
Clean up AMDGCN tests

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

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

6 years ago[analyzer] NFC: Eliminate ParentMap lookup in mayInlineCallKind().
Artem Dergachev [Thu, 15 Feb 2018 19:01:55 +0000 (19:01 +0000)]
[analyzer] NFC: Eliminate ParentMap lookup in mayInlineCallKind().

Don't look at the parent statement to figure out if the cxx-allocator-inlining
flag should kick in and prevent us from inlining the constructor within
a new-expression. We now have construction contexts for that purpose.

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

6 years ago[Test] Remove mangled name from test.
Matt Davis [Thu, 15 Feb 2018 17:55:52 +0000 (17:55 +0000)]
[Test] Remove mangled name from test.

This line is not needed in the test, and breaks Windows testing.
Fixes the test added in r325175.

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

6 years ago[OpenCL] Fix __enqueue_block for block with captures
Yaxun Liu [Thu, 15 Feb 2018 16:39:19 +0000 (16:39 +0000)]
[OpenCL] Fix __enqueue_block for block with captures

The following test case causes issue with codegen of __enqueue_block

void (^block)(void) = ^{ callee(id, out); };

enqueue_kernel(queue, 0, ndrange, block);
Clang first does codegen for block expression in the first line and deletes its block info.
Clang then tries to do codegen for the same block expression again for the second line,
and fails because the block info is gone.

The fix is to do normal codegen for both lines. Introduce an API to OpenCL runtime to
record llvm block invoke function and llvm block literal emitted for each AST block
expression, and use the recorded information for generating the wrapper kernel.

The EmitBlockLiteral APIs are cleaned up to minimize changes to the normal codegen
of blocks.

Another minor issue is that some clean up AST expression is generated for block
with captures, which can be stripped by IgnoreImplicit.

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

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

6 years agoAmend r325256. This change was not properly merged locally before the commit happened.
Aaron Ballman [Thu, 15 Feb 2018 16:28:10 +0000 (16:28 +0000)]
Amend r325256. This change was not properly merged locally before the commit happened.

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

6 years agoNFC; clean up this file based on our coding standards. The impetus was considerable...
Aaron Ballman [Thu, 15 Feb 2018 16:20:20 +0000 (16:20 +0000)]
NFC; clean up this file based on our coding standards. The impetus was considerable use of a type name as an identifier for an object.

Changed identifier names (especially function parameters) to not clash with type names and to follow the proper naming conventions. Use of explicit type names changed to use auto where appropriate. Removed unused parameters that should have never been added in the first place. Minor formatting cleanups.

The changes were mostly mechanical and should have no functional impact.

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

6 years ago[clang-format] Support repeated field lists in protos
Krasimir Georgiev [Thu, 15 Feb 2018 15:30:22 +0000 (15:30 +0000)]
[clang-format] Support repeated field lists in protos

Summary:
This patch adds support for list initialization of proto repeated fields:
```
keys: [1, 2, 3]
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years agoAdding msan support for FreeBSD
Kamil Rytarowski [Thu, 15 Feb 2018 14:19:23 +0000 (14:19 +0000)]
Adding msan support for FreeBSD

Summary: Enabling memory sanitiser for X86_64 arch only. To match the sanitiser counterpart.

Patch by: David CARLIER

Reviewers: krytarowski

Reviewed By: krytarowski

Subscribers: dim, emaste, cfe-commits

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

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

6 years agoAdd Xray instrumentation compile-time/link-time support to FreeBSD
Kamil Rytarowski [Thu, 15 Feb 2018 14:12:21 +0000 (14:12 +0000)]
Add Xray instrumentation compile-time/link-time support to FreeBSD

Summary: Similarly to the GNU driver version, adding proper compile and linker flags.

Patch by: David CARLIER

Reviewers: vitalybuka, krytarowski, dberris

Reviewed By: krytarowski, dberris

Subscribers: emaste, dberris, cfe-commits

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

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

6 years agoAdd -no-canonical-prefixes to allow different build modes.
Martin Bohme [Thu, 15 Feb 2018 13:50:07 +0000 (13:50 +0000)]
Add -no-canonical-prefixes to allow different build modes.

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

6 years ago[clang-format] Improve ObjC headers detection
Jacek Olesiak [Thu, 15 Feb 2018 08:47:56 +0000 (08:47 +0000)]
[clang-format] Improve ObjC headers detection

Summary: Detect ObjC characteristic types when they start a line and add additional keywords.

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

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

6 years ago[analyzer] Inline constructors for destroyable temporaries.
Artem Dergachev [Thu, 15 Feb 2018 03:26:43 +0000 (03:26 +0000)]
[analyzer] Inline constructors for destroyable temporaries.

Since r325210, in cfg-temporary-dtors mode, we can rely on the CFG to tell us
that we're indeed constructing a temporary, so we can trivially construct a
temporary region and inline the constructor.

Much like r325202, this is only done under the off-by-default
cfg-temporary-dtors flag because the temporary destructor, even if available,
will not be inlined and won't have the correct object value (target region).
Unless this is fixed, it is quite unsafe to inline the constructor.

If the temporary is lifetime-extended, the destructor would be an automatic
destructor, which would be evaluated with a "correct" target region - modulo
the series of incorrect relocations performed during the lifetime extension.
It means that at least, values within the object are guaranteed to be properly
escaped or invalidated.

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

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

6 years ago[CFG] Provide construction contexts for temproary objects.
Artem Dergachev [Thu, 15 Feb 2018 03:13:36 +0000 (03:13 +0000)]
[CFG] Provide construction contexts for temproary objects.

Constructors of C++ temporary objects that have destructors now can be queried
to discover that they're indeed constructing temporary objects.

The respective CXXBindTemporaryExpr, which is also repsonsible for destroying
the temporary at the end of full-expression, is now available at the
construction site in the CFG. This is all the context we need to provide for
temporary objects that are not lifetime extended. For lifetime-extended
temporaries, more context is necessary.

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

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

6 years ago[analyzer] Decide on inlining destructors via EvalCallOptions.
Artem Dergachev [Thu, 15 Feb 2018 02:51:58 +0000 (02:51 +0000)]
[analyzer] Decide on inlining destructors via EvalCallOptions.

EvalCallOptions were introduced in r324018 for allowing various parts of
ExprEngine to notify the inlining mechanism, while preparing for evaluating a
function call, of possible difficulties with evaluating the call that they
foresee. Then mayInlineCall() would still be a single place for making the
decision.

Use that mechanism for destructors as well - pass the necessary flags from the
CFG-element-specific destructor handlers.

Part of this patch accidentally leaked into r324018, which led into a change in
tests; this change is reverted now, because even though the change looked
correct, the underlying behavior wasn't. Both of these commits were not intended
to introduce any function changes otherwise.

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

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

6 years agoReapply r325193
Konstantin Zhuravlyov [Thu, 15 Feb 2018 02:37:04 +0000 (02:37 +0000)]
Reapply r325193

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

6 years ago[analyzer] Allow inlining constructors into return values.
Artem Dergachev [Thu, 15 Feb 2018 02:32:32 +0000 (02:32 +0000)]
[analyzer] Allow inlining constructors into return values.

This only affects the cfg-temporary-dtors mode - in this mode we begin inlining
constructors that are constructing function return values. These constructors
have a correct construction context since r324952.

Because temporary destructors are not only never inlined, but also don't have
the correct target region yet, this change is not entirely safe. But this
will be fixed in the subsequent commits, while this stays off behind the
cfg-temporary-dtors flag.

Lifetime extension for return values is still not modeled correctly.

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

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

6 years ago[analyzer] NFC: Remove dead checks when computing DeclStmt construction region.
Artem Dergachev [Thu, 15 Feb 2018 02:30:20 +0000 (02:30 +0000)]
[analyzer] NFC: Remove dead checks when computing DeclStmt construction region.

In CFG, every DeclStmt has exactly one decl, which is always a variable.

It is also pointless to check that the initializer is the constructor because
that's how construction contexts work now.

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

6 years agoRevert r325193 as it breaks buildbots
Konstantin Zhuravlyov [Thu, 15 Feb 2018 02:27:45 +0000 (02:27 +0000)]
Revert r325193 as it breaks buildbots

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

6 years agoAMDGPU: Enable PIC by default for amdgcn
Konstantin Zhuravlyov [Thu, 15 Feb 2018 01:01:53 +0000 (01:01 +0000)]
AMDGPU: Enable PIC by default for amdgcn

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

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

6 years agoAdd missing definition for class static after r325193.
Richard Smith [Thu, 15 Feb 2018 01:01:06 +0000 (01:01 +0000)]
Add missing definition for class static after r325193.

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

6 years agoAMDGPU: Cleanup most of the macros
Konstantin Zhuravlyov [Thu, 15 Feb 2018 00:20:26 +0000 (00:20 +0000)]
AMDGPU: Cleanup most of the macros

- Insert __AMD__ macro
- Insert __AMDGPU__ macro
- Insert __devicename__ macro
- Add missing tests for arch macros

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

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

6 years agoImprove documentation for attribute artificial
Erich Keane [Wed, 14 Feb 2018 23:00:31 +0000 (23:00 +0000)]
Improve documentation for attribute artificial

This patch is related to https://reviews.llvm.org/rC325081

The patch improves documentation for the attribute and removes reference to GCC
documentation.

Patch By: Elizabeth Andrews (eandrews)
Differential Revision: https://reviews.llvm.org/D43321

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

6 years agoMoved CHECK in test closer to source code
Vitaly Buka [Wed, 14 Feb 2018 22:52:49 +0000 (22:52 +0000)]
Moved CHECK in test closer to source code

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

6 years ago[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK
Vitaly Buka [Wed, 14 Feb 2018 22:41:15 +0000 (22:41 +0000)]
[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK

Summary:
TypeID summaries are used by CFI and need to be serialized by ThinLTO
indexing for later use by LTO Backend.

Reviewers: tejohnson, pcc

Subscribers: mehdi_amini, inglorion, eraman, hiraditya, llvm-commits

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

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

6 years ago[Debug] Annotate compiler generated range-for loop variables.
Matt Davis [Wed, 14 Feb 2018 21:22:11 +0000 (21:22 +0000)]
[Debug] Annotate compiler generated range-for loop variables.

Summary:
This change aims to simplify debugging by annotating the range-for loop artificial variables (range, begin, end) with the scope depth.

Reviewers: rsmith, dblaikie

Reviewed By: dblaikie

Subscribers: dblaikie, cfe-commits

Tags: #debug-info

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

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

6 years agoClean up -fdiscard-value-name handling
Eric Fiselier [Wed, 14 Feb 2018 20:56:52 +0000 (20:56 +0000)]
Clean up -fdiscard-value-name handling

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

6 years ago[clang-format] Recognize percents as format specifiers in protos
Krasimir Georgiev [Wed, 14 Feb 2018 19:47:58 +0000 (19:47 +0000)]
[clang-format] Recognize percents as format specifiers in protos

Summary:
Frequently, a percent in protos denotes a formatting specifier for string replacement.
Thus it is desirable to keep the percent together with what follows after it.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years agoUpdate for llvm change. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:11:37 +0000 (19:11 +0000)]
Update for llvm change. NFC.

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

6 years ago[Modules] Add more language features to be used with requires-declaration
Bruno Cardoso Lopes [Wed, 14 Feb 2018 19:01:03 +0000 (19:01 +0000)]
[Modules] Add more language features to be used with requires-declaration

Features added: c99, c11, c17, cplusplus14 and cplusplus17.

rdar://problem/36328787
rdar://problem/36668431

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

6 years ago[OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny
Alexey Bataev [Wed, 14 Feb 2018 17:38:47 +0000 (17:38 +0000)]
[OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny

Summary:
-ast-print prints omp pragmas with a trailing space.  While this
behavior is likely of little concern to most users, surely it's
unintentional, and it's annoying for some source-level work I'm
pursuing.  This patch focuses on omp pragmas, but it also fixes
init_seg and loop hint pragmas because they share implementation.

The testing strategy here is to add usually just one '{{$}}' per
relevant -ast-print test file.  This seems to achieve good code
coverage.  However, this strategy is probably easy to forget as the
tests evolve.  That's probably fine as this fix is far from critical.
The main goal of the testing is to aid the initial review.

This patch also adds a fixme for "#pragma unroll", which prints as
"#pragma unroll (enable)", which is invalid syntax.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: guansong, cfe-commits

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

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

6 years ago[CUDA] Allow external variables in separate compilation
Jonas Hahnfeld [Wed, 14 Feb 2018 16:04:03 +0000 (16:04 +0000)]
[CUDA] Allow external variables in separate compilation

According to the CUDA Programming Guide this is prohibited in
whole program compilation mode. This makes sense because external
references cannot be satisfied in that mode anyway. However,
such variables are allowed in separate compilation mode which
is a valid use case.

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

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

6 years agoRevert r324991 "Fix for PR32992. Static const classes not exported."
Hans Wennborg [Wed, 14 Feb 2018 15:19:46 +0000 (15:19 +0000)]
Revert r324991 "Fix for PR32992. Static const classes not exported."

This broke the Chromium build on Windows; see https://crbug.com/812231

> Fix for PR32992. Static const classes not exported.
>
> Patch by zahiraam!
>
> Differential Revision: https://reviews.llvm.org/D42968

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

6 years ago[AST] Fix passing large-array-init.cpp on builds without asserts
Ivan A. Kosarev [Wed, 14 Feb 2018 13:27:48 +0000 (13:27 +0000)]
[AST] Fix passing large-array-init.cpp on builds without asserts

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

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

6 years ago[AST] Refine the condition for element-dependent array fillers
Ivan A. Kosarev [Wed, 14 Feb 2018 13:10:35 +0000 (13:10 +0000)]
[AST] Refine the condition for element-dependent array fillers

This patch fixes clang to not consider braced initializers for
aggregate elements of arrays to be potentially dependent on the
indices of the initialized elements. Resolves bug 18978:
initialize a large static array = clang oom?
https://bugs.llvm.org/show_bug.cgi?id=18978

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

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

6 years agoQuick fix for 325116 buildbots: move template specialization into namespace
Aleksei Sidorin [Wed, 14 Feb 2018 11:39:33 +0000 (11:39 +0000)]
Quick fix for 325116 buildbots: move template specialization into namespace

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

6 years ago[Sema] Fix decltype of static data members
Mikhail Maltsev [Wed, 14 Feb 2018 11:34:25 +0000 (11:34 +0000)]
[Sema] Fix decltype of static data members

Summary:
According to the C++11 standard [dcl.type.simple]p4:
  The type denoted by decltype(e) is defined as follows:
  - if e is an unparenthesized id-expression or an unparenthesized
    class member access (5.2.5), decltype(e) is the type of the entity
    named by e.

Currently Clang handles the 'member access' case incorrectly for
static data members (decltype returns T& instead of T). This patch
fixes the issue.

Reviewers: faisalv, rsmith, rogfer01

Reviewed By: rogfer01

Subscribers: rogfer01, cfe-commits

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

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

6 years ago[ASTImporter] Fix lexical DC for templated decls; support VarTemplatePartialSpecDecl
Aleksei Sidorin [Wed, 14 Feb 2018 11:18:00 +0000 (11:18 +0000)]
[ASTImporter] Fix lexical DC for templated decls; support VarTemplatePartialSpecDecl

Also minor refactoring in related functions was done.

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

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

6 years agoTest commit access
Henry Wong [Wed, 14 Feb 2018 07:32:27 +0000 (07:32 +0000)]
Test commit access

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

6 years agoFix a couple of places where we assumed that non-type template parameters are always...
Richard Smith [Wed, 14 Feb 2018 02:07:53 +0000 (02:07 +0000)]
Fix a couple of places where we assumed that non-type template parameters are always rvalues.

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

6 years agoImplement function attribute artificial
Erich Keane [Wed, 14 Feb 2018 00:14:07 +0000 (00:14 +0000)]
Implement function attribute artificial

Added support in clang for GCC function attribute 'artificial'. This attribute
is used to control stepping behavior of debugger with respect to inline
functions.

Patch By: Elizabeth Andrews (eandrews)

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

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

6 years ago[analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded envir...
George Karpenkov [Tue, 13 Feb 2018 23:36:01 +0000 (23:36 +0000)]
[analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded environment

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

6 years agoTeach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat...
Nico Weber [Tue, 13 Feb 2018 21:31:47 +0000 (21:31 +0000)]
Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat __assume(0) like __builtin_unreachable.

Fixes PR29134.
https://reviews.llvm.org/D43221

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

6 years agoUpdate StmtProfile.cpp to handle zero template arguments.
Richard Trieu [Tue, 13 Feb 2018 19:53:40 +0000 (19:53 +0000)]
Update StmtProfile.cpp to handle zero template arguments.

Treat having no templates arguments differently than having zero template
arguments when profiling.

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

6 years ago[AMDGPU] Change constant addr space to 4
Yaxun Liu [Tue, 13 Feb 2018 18:01:21 +0000 (18:01 +0000)]
[AMDGPU] Change constant addr space to 4

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

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

6 years agoAn updated test to show the current warnings produced for implicit conversions from...
Andrew V. Tischenko [Tue, 13 Feb 2018 15:20:29 +0000 (15:20 +0000)]
An updated test to show the current warnings produced for implicit conversions from 'double' to 'float'.

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

6 years ago[clang-format] Support text proto extensions
Krasimir Georgiev [Tue, 13 Feb 2018 10:20:39 +0000 (10:20 +0000)]
[clang-format] Support text proto extensions

Summary:
This adds support for text proto extensions, like:
```
msg {
  [type.type/ext] {
    key: value
  }
}
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years agoFix for PR32992. Static const classes not exported.
Hans Wennborg [Tue, 13 Feb 2018 09:19:43 +0000 (09:19 +0000)]
Fix for PR32992. Static const classes not exported.

Patch by zahiraam!

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

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

6 years ago[DebugInfo] Avoid name conflict of generated VLA expression variable.
Sander de Smalen [Tue, 13 Feb 2018 07:49:34 +0000 (07:49 +0000)]
[DebugInfo] Avoid name conflict of generated VLA expression variable.

Summary:
This patch also adds the 'DW_AT_artificial' flag to the generated variable.

Addresses the issues mentioned in http://llvm.org/PR30553.

Reviewers: CarlosAlbertoEnciso, probinson, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, cfe-commits

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

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

6 years ago[Modules] Fix remapping from Foo.Private to Foo_Private to happen before typo correction
Bruno Cardoso Lopes [Mon, 12 Feb 2018 23:43:21 +0000 (23:43 +0000)]
[Modules] Fix remapping from Foo.Private to Foo_Private to happen before typo correction

Typo correction is the last step here, remapping should come first.

rdar://problem/37351970

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

6 years ago[analyzer] Exploration strategy prioritizing unexplored coverage first
George Karpenkov [Mon, 12 Feb 2018 22:39:57 +0000 (22:39 +0000)]
[analyzer] Exploration strategy prioritizing unexplored coverage first

See reviews.llvm.org/M1 for evaluation, and
lists.llvm.org/pipermail/cfe-dev/2018-January/056718.html for
discussion.

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

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

6 years ago[X86] Reverse the operand order of the implementation of the kunpack builtins.
Craig Topper [Mon, 12 Feb 2018 22:38:52 +0000 (22:38 +0000)]
[X86] Reverse the operand order of the implementation of the kunpack builtins.

The second operand needs to be in the lower bits of the concatenation. This matches llvm 5.0, gcc, and icc behavior.

Fixes PR36360.

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

6 years ago[CFG] Provide construction contexts for return value constructors.
Artem Dergachev [Mon, 12 Feb 2018 22:36:36 +0000 (22:36 +0000)]
[CFG] Provide construction contexts for return value constructors.

When the current function returns a C++ object by value, CFG elements for
constructors that construct the return values can now be queried to discover
that they're indeed participating in construction of the respective return value
at the respective return statement.

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

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

6 years agoLook for 32-bit libraries in /usr/lib32 for MIPS O32 on FreeBSD.
John Baldwin [Mon, 12 Feb 2018 22:22:01 +0000 (22:22 +0000)]
Look for 32-bit libraries in /usr/lib32 for MIPS O32 on FreeBSD.

Summary:
FreeBSD N64 MIPS systems can include 32-bit libraries for O32 in
/usr/lib32 similar to the 32-bit compatibility libraries provided
for FreeBSD/amd64 and FreeBSD/powerpc64.

Reviewers: dim

Reviewed By: dim

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

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

6 years ago[analyzer] [tests] Fix a typo in analyzer testing script.
George Karpenkov [Mon, 12 Feb 2018 22:13:01 +0000 (22:13 +0000)]
[analyzer] [tests] Fix a typo in analyzer testing script.

Incorrect option instance construction.

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

6 years ago[AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - clang portion
Abderrazek Zaafrani [Mon, 12 Feb 2018 21:26:06 +0000 (21:26 +0000)]
[AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - clang portion

https://reviews.llvm.org/D42993

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

6 years ago[DebugInfo] Update Checksum handling in CGDebugInfo
Scott Linder [Mon, 12 Feb 2018 19:47:05 +0000 (19:47 +0000)]
[DebugInfo] Update Checksum handling in CGDebugInfo

Update to match new DIFile API.

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

6 years agoAdd a unit test for Driver::getDefaultModuleCachePath().
Adrian Prantl [Mon, 12 Feb 2018 17:59:54 +0000 (17:59 +0000)]
Add a unit test for Driver::getDefaultModuleCachePath().

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

6 years agoFurther cleanup to Driver mode code, as suggested by dblaikie [NFC]
Erich Keane [Mon, 12 Feb 2018 17:47:01 +0000 (17:47 +0000)]
Further cleanup to Driver mode code, as suggested by dblaikie [NFC]

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

6 years ago[libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo
Fangrui Song [Mon, 12 Feb 2018 17:42:09 +0000 (17:42 +0000)]
[libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo

Summary:
CXIdxEntityRefInfo contains the member `CXIdxEntityRefKind kind;` to
differentiate implicit and direct calls. However, there are more roles
defined in SymbolRole. Among them, `Read/Write` are probably the most
useful ones as they can be used to differentiate Read/Write occurrences
of a symbol for document highlight in a text document.

See `export namespace DocumentHighlightKind`
on https://microsoft.github.io/language-server-protocol/specification

Subscribers: cfe-commits

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

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

6 years ago[Sema] Don't mark plain MS enums as fixed
Reid Kleckner [Mon, 12 Feb 2018 17:37:06 +0000 (17:37 +0000)]
[Sema] Don't mark plain MS enums as fixed

Summary:
This fixes a flaw in our AST: PR27098

MSVC always gives plain enums the underlying type 'int'. Clang does this
as well, but we claim the enum is "fixed", as if the user actually wrote
': int'. It means we end up emitting spurious -Wsign-compare warnings on
code like this:

  enum Vals { E1, E2, E3 };
  bool f(unsigned v1, Vals v2) {
    return v1 == v2;
  }

We think 'v2' can take on negative values because we think 'Vals' is
fixed. This fixes that.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

6 years agoUpdate target-note-test to be current with the AMDGPU changes
Erich Keane [Mon, 12 Feb 2018 17:19:57 +0000 (17:19 +0000)]
Update target-note-test to be current with the AMDGPU changes

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

6 years agoMake attribute-target on a Definition-after-use update the LLVM attributes
Erich Keane [Mon, 12 Feb 2018 17:01:41 +0000 (17:01 +0000)]
Make attribute-target on a Definition-after-use update the LLVM attributes

As reported here: https://bugs.llvm.org/show_bug.cgi?id=36301
The issue is that the 'use' causes the plain declaration to emit
the attributes to LLVM-IR. However, if the definition added it
later, these would silently disappear.

This commit extracts that logic to its own function in CodeGenModule,
and has the attribute-applications done during 'definition' update
the attributes properly.

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

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

6 years agoAdd Invalid-note test negllected in R324673,324674,324675,324676
Erich Keane [Mon, 12 Feb 2018 16:24:08 +0000 (16:24 +0000)]
Add Invalid-note test negllected in R324673,324674,324675,324676

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

6 years agoRe-commit r324490: [DebugInfo] Improvements to representation of enumeration types...
Momchil Velikov [Mon, 12 Feb 2018 16:12:52 +0000 (16:12 +0000)]
Re-commit r324490: [DebugInfo] Improvements to representation of enumeration types (PR36168)

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

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

6 years ago[clang-format] Fix comment indentation in text protos
Krasimir Georgiev [Mon, 12 Feb 2018 15:49:09 +0000 (15:49 +0000)]
[clang-format] Fix comment indentation in text protos

Summary: This patch fixes a bug where the comment indent of comments in text protos gets messed up because by default paren states get created with AlignColons = true (which makes snese for ObjC).

Subscribers: klimek, cfe-commits

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

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

6 years agoAllow the NS, CF, and ObjC attributes to be used with -fdouble-square-bracket-attribu...
Aaron Ballman [Mon, 12 Feb 2018 13:38:25 +0000 (13:38 +0000)]
Allow the NS, CF, and ObjC attributes to be used with -fdouble-square-bracket-attributes. The syntactic locations for such attributes on ObjC constructs have been specifically chosen to follow the GNU attribute syntactic locations.

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

6 years agoASan+operator new[]: Add an option for more thorough operator new[] cookie poisoning
Filipe Cabecinhas [Mon, 12 Feb 2018 11:49:02 +0000 (11:49 +0000)]
ASan+operator new[]: Add an option for more thorough operator new[] cookie poisoning

Summary:
Right now clang is skipping array cookie poisoning for any operator
new[] which is not part of the set of replaceable global allocation
functions.

This commit adds a flag to tell clang to poison all operator new[]
cookies.

A previous review was poisoning all array cookies unconditionally, but
there is an edge case which would stop working under ASan (a custom
operator new[] saves whatever pointer it returned, and then accesses
it).

This newer revision adds a command line argument to toggle this feature.

Original revision: https://reviews.llvm.org/D41301
Compiler-rt test revision with an explanation of the edge case: https://reviews.llvm.org/D41664

Reviewers: rjmccall, kcc, rsmith

Subscribers: cfe-commits

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

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

6 years ago[CUDA] Add option to generate relocatable device code
Jonas Hahnfeld [Mon, 12 Feb 2018 10:46:45 +0000 (10:46 +0000)]
[CUDA] Add option to generate relocatable device code

As a first step, pass '-c/--compile-only' to ptxas so that it
doesn't complain about references to external function. This
will successfully generate object files, but they won't work
at runtime because the registration routines need to adapted.

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

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

6 years ago[CUDA] Fix test cuda-external-tools.cu
Jonas Hahnfeld [Mon, 12 Feb 2018 10:46:34 +0000 (10:46 +0000)]
[CUDA] Fix test cuda-external-tools.cu

This didn't verify the CHECK prefix before!

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

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

6 years ago[X86] Change the signature of the AVX512 packed fp compare intrinsics to return vXi1...
Craig Topper [Sat, 10 Feb 2018 23:34:27 +0000 (23:34 +0000)]
[X86] Change the signature of the AVX512 packed fp compare intrinsics to return vXi1 mask. Make bitcasts to scalar explicit in IR

Summary: This is the clang equivalent of r324827

Reviewers: zvi, delena, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

6 years agoFix test clang-diff-json.cpp
Aaron Smith [Sat, 10 Feb 2018 21:28:55 +0000 (21:28 +0000)]
Fix test clang-diff-json.cpp

Summary:
This test would fail if the python path had spaces. Add a quote around the path to fix this problem and update some test values changed by the addition of quotes around the path.

Tested on Windows and Linux with Python 3.x

Reviewers: zturner, llvm-commits

Subscribers: klimek, cfe-commits

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

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

6 years agoAdd vector add/sub/mul/div by scalar tests (PR27085)
Simon Pilgrim [Sat, 10 Feb 2018 17:55:23 +0000 (17:55 +0000)]
Add vector add/sub/mul/div by scalar tests (PR27085)

Ensure the scalar is correctly splatted to all lanes

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

6 years agoMake a build bot happy.
Gabor Horvath [Sat, 10 Feb 2018 14:26:53 +0000 (14:26 +0000)]
Make a build bot happy.

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

6 years ago[Templight] Template Instantiation Observer
Gabor Horvath [Sat, 10 Feb 2018 14:04:45 +0000 (14:04 +0000)]
[Templight] Template Instantiation Observer

This patch adds a base-class called TemplateInstantiationObserver which gets
notified whenever a template instantiation is entered or exited during
semantic analysis. This is a base class used to implement the template
profiling and debugging tool called
Templight (https://github.com/mikael-s-persson/templight).

The patch also makes a few more changes:

* ActiveTemplateInstantiation class is moved out of the Sema class (so it can be used with inclusion of Sema.h).
* CreateFrontendAction function in front-end utilities is given external linkage (not longer a hidden static function).
* TemplateInstObserverChain data member added to Sema class to hold the list of template-inst observers.
* Notifications to the template-inst observer are added at the key places where templates are instantiated.

Patch by: Abel Sinkovics!

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

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