]> granicus.if.org Git - clang/log
clang
5 years agoReduce ASTMatchers stack footprint. Addresses http://llvm.org/PR38851
Alexander Kornienko [Tue, 15 Jan 2019 15:34:26 +0000 (15:34 +0000)]
Reduce ASTMatchers stack footprint. Addresses http://llvm.org/PR38851

The BoundNodesTreeBuilder class is used both directly and indirectly as a local
variable in matchesAncestorOfRecursively, memoizedMatchesAncestorOfRecursively
and other functions that happen to be on long recursive call paths. By reducing
the inline storage size of the SmallVector we dramatically reduce the stack
requirements of ASTMatchers. Running clang-tidy with a large number of checks
enabled on a few arbitrarily chosen files show no performance regression.

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

5 years agoUpdate year in license files
Hans Wennborg [Tue, 15 Jan 2019 15:10:32 +0000 (15:10 +0000)]
Update year in license files

In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

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

5 years ago[OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1,2}d_array_t variants...
Roman Lebedev [Tue, 15 Jan 2019 11:20:02 +0000 (11:20 +0000)]
[OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1,2}d_array_t variants are OpenCL-1.2+, mark them as such

Summary:
Refer to [[ https://www.khronos.org/registry/OpenCL/specs/opencl-1.1.pdf#page=242 | `6.11.13.2 Built-in Image Functions` ]],
and [[ https://www.khronos.org/registry/OpenCL/specs/opencl-1.1.pdf#page=306 | `9.6.8 Image Read and Write Functions` ]] of the OpenCL 1.1 spec.

* There is no mention of `image1d_array_t` and `image2d_array_t` anywhere in the OpenCL 1.1 spec.
* All the `read_image{f,i,ui,h}()` functions, as of OpenCL 1.1 spec, have a second required parameter `sampler_t sampler`

Should have prevented the following regression:
https://redmine.darktable.org/issues/12493

Reviewers: yaxunl, Anastasia, echuraev, asavonic

Reviewed By: Anastasia

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang][UBSan] Sanitization for alignment assumptions.
Roman Lebedev [Tue, 15 Jan 2019 09:44:25 +0000 (09:44 +0000)]
[clang][UBSan] Sanitization for alignment assumptions.

Summary:
UB isn't nice. It's cool and powerful, but not nice.
Having a way to detect it is nice though.
[[ https://wg21.link/p1007r3 | P1007R3: std::assume_aligned ]] / http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1007r2.pdf says:
```
We propose to add this functionality via a library function instead of a core language attribute.
...
If the pointer passed in is not aligned to at least N bytes, calling assume_aligned results in undefined behaviour.
```

This differential teaches clang to sanitize all the various variants of this assume-aligned attribute.

Requires D54588 for LLVM IRBuilder changes.
The compiler-rt part is D54590.

This is a second commit, the original one was r351105,
which was mass-reverted in r351159 because 2 compiler-rt tests were failing.

Reviewers: ABataev, craig.topper, vsk, rsmith, rnk, #sanitizers, erichkeane, filcab, rjmccall

Reviewed By: rjmccall

Subscribers: chandlerc, ldionne, EricWF, mclow.lists, cfe-commits, bkramer

Tags: #sanitizers

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

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

5 years agoNFC: Move Decl node handling to TextNodeDumper
Stephen Kelly [Tue, 15 Jan 2019 09:35:52 +0000 (09:35 +0000)]
NFC: Move Decl node handling to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[ASTDump] NFC: Move dump of type nodes to NodeDumper
Stephen Kelly [Tue, 15 Jan 2019 09:30:00 +0000 (09:30 +0000)]
[ASTDump] NFC: Move dump of type nodes to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it
Dan Gohman [Tue, 15 Jan 2019 06:58:16 +0000 (06:58 +0000)]
[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it

This adds support for multilib paths for wasm32 targets, following
[Debian's Multiarch conventions], and also adds an experimental OS name in
order to test it.

[Debian's Multiarch conventions]: https://wiki.debian.org/Multiarch/

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

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

5 years ago[X86] Make _xgetbv/_xsetbv on non-windows platforms
Craig Topper [Tue, 15 Jan 2019 05:03:18 +0000 (05:03 +0000)]
[X86] Make _xgetbv/_xsetbv on non-windows platforms

Summary:
This patch attempts to redo what was tried in r278783, but was reverted.

These intrinsics should be available on non-windows platforms with "xsave" feature check. But on Windows platforms they shouldn't have feature check since that's how MSVC behaves.

To accomplish this I've added a MS builtin with no feature check. And a normal gcc builtin with a feature check. When _MSC_VER is not defined _xgetbv/_xsetbv will be macros pointing to the gcc builtin name.

I've moved the forward declarations from intrin.h to immintrin.h to match the MSDN documentation and used that as the header file for the MS builtin.

I'm not super happy with this implementation, and I'm open to suggestions for better ways to do it.

Reviewers: rnk, RKSimon, spatel

Reviewed By: rnk

Subscribers: cfe-commits

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

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

5 years agoRevert alignment assumptions changes
Vlad Tsyrklevich [Tue, 15 Jan 2019 03:38:02 +0000 (03:38 +0000)]
Revert alignment assumptions changes

Revert r351104-6, r351109, r351110, r351119, r351134, and r351153. These
changes fail on the sanitizer bots.

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

5 years ago[COFF, ARM64] Add __byteswap intrinsics
Mandeep Singh Grang [Tue, 15 Jan 2019 01:26:26 +0000 (01:26 +0000)]
[COFF, ARM64] Add __byteswap intrinsics

Reviewers: rnk, efriedma, ssijaric, TomTan, haripul

Reviewed By: efriedma

Subscribers: javed.absar, cfe-commits, kristof.beyls

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

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

5 years ago[CMake][Fuchsia] Synchronize first and second stage builds
Petr Hosek [Tue, 15 Jan 2019 01:15:00 +0000 (01:15 +0000)]
[CMake][Fuchsia] Synchronize first and second stage builds

This reorders options between the first and second stage builds to make
them better lined up. The change also re-enables tests for first stage
which is useful e.g. for cross-compiling when we cannot run tests for
second stage directly (i.e. without emulation).

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

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

5 years ago[Sema] Change std::sort to llvm::sort
Mandeep Singh Grang [Mon, 14 Jan 2019 23:45:58 +0000 (23:45 +0000)]
[Sema] Change std::sort to llvm::sort

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

5 years ago[COFF, ARM64] Add __nop intrinsic
Mandeep Singh Grang [Mon, 14 Jan 2019 23:26:01 +0000 (23:26 +0000)]
[COFF, ARM64] Add __nop intrinsic

Reviewers: rnk, efriedma, TomTan, haripul, ssijaric

Reviewed By: rnk, efriedma

Subscribers: javed.absar, kristof.beyls, cfe-commits

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

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

5 years ago[ASTDump] NFC: Move dumping of QualType node to TextNodeDumper
Stephen Kelly [Mon, 14 Jan 2019 20:15:29 +0000 (20:15 +0000)]
[ASTDump] NFC: Move dumping of QualType node to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[ASTDump] NFC: Canonicalize handling of TypeLocInfo
Stephen Kelly [Mon, 14 Jan 2019 20:13:09 +0000 (20:13 +0000)]
[ASTDump] NFC: Canonicalize handling of TypeLocInfo

Summary: No need to avoid the Visit method.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[ASTDump] NFC: Move Type Visit implementation to TextNodeDumper
Stephen Kelly [Mon, 14 Jan 2019 20:11:02 +0000 (20:11 +0000)]
[ASTDump] NFC: Move Type Visit implementation to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoNFC: Fix nits I missed before
Stephen Kelly [Mon, 14 Jan 2019 19:50:34 +0000 (19:50 +0000)]
NFC: Fix nits I missed before

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

5 years agoImprove a -Wunguarded-availability note
Erik Pilkington [Mon, 14 Jan 2019 19:17:31 +0000 (19:17 +0000)]
Improve a -Wunguarded-availability note

Mention the deployment target, and don't say "partial" which doesn't
really mean anything to users.

rdar://problem/33601513

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

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

5 years ago[clang][UBSan] Sanitization for alignment assumptions.
Roman Lebedev [Mon, 14 Jan 2019 19:09:27 +0000 (19:09 +0000)]
[clang][UBSan] Sanitization for alignment assumptions.

Summary:
UB isn't nice. It's cool and powerful, but not nice.
Having a way to detect it is nice though.
[[ https://wg21.link/p1007r3 | P1007R3: std::assume_aligned ]] / http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1007r2.pdf says:
```
We propose to add this functionality via a library function instead of a core language attribute.
...
If the pointer passed in is not aligned to at least N bytes, calling assume_aligned results in undefined behaviour.
```

This differential teaches clang to sanitize all the various variants of this assume-aligned attribute.

Requires D54588 for LLVM IRBuilder changes.
The compiler-rt part is D54590.

Reviewers: ABataev, craig.topper, vsk, rsmith, rnk, #sanitizers, erichkeane, filcab, rjmccall

Reviewed By: rjmccall

Subscribers: chandlerc, ldionne, EricWF, mclow.lists, cfe-commits, bkramer

Tags: #sanitizers

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

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

5 years ago[analyzer] [PR39792] false positive on strcpy targeting struct members
George Karpenkov [Mon, 14 Jan 2019 18:54:48 +0000 (18:54 +0000)]
[analyzer] [PR39792] false positive on strcpy targeting struct members

Patch by Pierre van Houtryve.

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

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

5 years ago[analyzer] [NFC] Remove unused undefined method.
George Karpenkov [Mon, 14 Jan 2019 18:54:35 +0000 (18:54 +0000)]
[analyzer] [NFC] Remove unused undefined method.

Wow, at no point the linker or compiler complaints about that!

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

5 years ago[WebAssembly] Remove old builtins
Dan Gohman [Mon, 14 Jan 2019 18:28:10 +0000 (18:28 +0000)]
[WebAssembly] Remove old builtins

This removes the old grow_memory and mem.grow-style builtins, leaving just
the memory.grow-style builtins.

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

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

5 years ago[Sema] Expose a control flag for integer to pointer ext warning
Kristina Brooks [Mon, 14 Jan 2019 18:16:51 +0000 (18:16 +0000)]
[Sema] Expose a control flag for integer to pointer ext warning

While building openJDK11u, it seems that some of the code in the
native core libraries make liberal use of integer to pointer
comparisons. We currently have no flag to disabled this warning.
This add such a flag.

Patch by Kader (abdoul-kader keita)

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

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

5 years ago[AST] Fix double-traversal of code in top-level lambdas in RAV(implicit = yes).
Sam McCall [Mon, 14 Jan 2019 17:16:00 +0000 (17:16 +0000)]
[AST] Fix double-traversal of code in top-level lambdas in RAV(implicit = yes).

Summary:
Prior to r351069, lambda classes were traversed or not depending on the
{Function, Class, Namespace, TU} DeclContext containing them.
If it was a function (common case) they were not traversed.
If it was a namespace or TU (top-level lambda) they were traversed as part of
that DeclContext traversal.

r351069 "fixed" RAV to traverse these as part of the LambdaExpr, which is the
right place. But top-level lambdas are now traversed twice.
We fix that as blocks and block captures were apparently fixed in the past.

Maybe it would be nicer to avoid adding the lambda classes to the DeclContext
in the first place, but I can't work out the implications of that.

Reviewers: bkramer, klimek

Subscribers: cfe-commits

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

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

5 years agoclang-cl: Fix help text for /O<flags>: '/O2y-' means '/O2 /Oy-', not '/O2 /y-'
Nico Weber [Mon, 14 Jan 2019 12:42:35 +0000 (12:42 +0000)]
clang-cl: Fix help text for /O<flags>: '/O2y-' means '/O2 /Oy-', not '/O2 /y-'

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

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

5 years agoclang-cl: Align help texts for /O1 and O2
Nico Weber [Mon, 14 Jan 2019 12:41:13 +0000 (12:41 +0000)]
clang-cl: Align help texts for /O1 and O2

Makes it a bit easier to see what exactly the difference is.

Also use "same as" instead of "equivalent to", because that's faster to read.

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

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

5 years ago[OpenCL] Set generic addr space of 'this' in special class members.
Anastasia Stulova [Mon, 14 Jan 2019 11:44:22 +0000 (11:44 +0000)]
[OpenCL] Set generic addr space of 'this' in special class members.

Set address spaces of 'this' param correctly for implicit special
class members.

This also changes initialization conversion sequence to separate
address space conversion from other qualifiers in case of binding
reference to a temporary. In this case address space conversion
should happen after the binding (unlike for other quals). This is
needed to materialize it correctly in the alloca address space.

Initial patch by Mikael Nilssoni!

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

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

5 years ago[AST] RecursiveASTVisitor visits lambda classes when implicit visitation is on.
Sam McCall [Mon, 14 Jan 2019 10:31:42 +0000 (10:31 +0000)]
[AST] RecursiveASTVisitor visits lambda classes when implicit visitation is on.

Summary:
This fixes ASTContext's parent map for nodes in such classes (e.g. operator()).
https://bugs.llvm.org/show_bug.cgi?id=39949

This also changes the observed shape of the AST for implicit RAVs.
- this includes AST MatchFinder: cxxRecordDecl() now matches lambda classes,
functionDecl() matches the call operator, and the parent chain is body -> call
operator -> lambda class -> lambdaexpr rather than body -> lambdaexpr.
- this appears not to matter for the ASTImporterLookupTable builder
- this doesn't matter for the other RAVs in-tree.

In order to do this, we remove the TraverseLambdaBody hook. The problem is it's
hard/weird to ensure this hook is called when traversing via the implicit class.
There were just two users of this hook in-tree, who use it to skip bodies.
I replaced these with explicitly traversing the captures only. Another approach
would be recording the bodies when the lambda is visited, and then recognizing
them later.
I'd be open to suggestion on how to preserve this hook, instead.

Reviewers: aaron.ballman, JonasToth

Subscribers: cfe-commits, rsmith, jdennett

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

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

5 years ago[X86] Remove mask parameter from avx512 pmultishiftqb intrinsics. Use select in IR...
Craig Topper [Mon, 14 Jan 2019 08:46:51 +0000 (08:46 +0000)]
[X86] Remove mask parameter from avx512 pmultishiftqb intrinsics. Use select in IR instead.

Fixes PR40259

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

5 years ago[X86] Remove mask parameter from vpshufbitqmb intrinsics. Change result to a vXi1...
Craig Topper [Mon, 14 Jan 2019 00:03:55 +0000 (00:03 +0000)]
[X86] Remove mask parameter from vpshufbitqmb intrinsics. Change result to a vXi1 vector.

We'll do the scalar<->vXi1 conversions with bitcasts in IR.

Fixes PR40258

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

5 years agoNFC: Make utility private
Stephen Kelly [Sat, 12 Jan 2019 17:07:05 +0000 (17:07 +0000)]
NFC: Make utility private

No callers are external to the class anymore.

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

5 years ago[ASTDump] NFC: Move dump of individual Stmts to TextNodeDumper
Stephen Kelly [Sat, 12 Jan 2019 16:53:27 +0000 (16:53 +0000)]
[ASTDump] NFC: Move dump of individual Stmts to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoImplement TemplateArgument dumping in terms of Visitor
Stephen Kelly [Sat, 12 Jan 2019 16:35:37 +0000 (16:35 +0000)]
Implement TemplateArgument dumping in terms of Visitor

Summary: Split the output streaming from the traversal to other AST nodes.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[ASTDump] Change parameter to StringRef
Stephen Kelly [Sat, 12 Jan 2019 15:45:05 +0000 (15:45 +0000)]
[ASTDump] Change parameter to StringRef

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

5 years ago[analyzer] Fix unused variable warnings in Release builds
Benjamin Kramer [Sat, 12 Jan 2019 12:43:53 +0000 (12:43 +0000)]
[analyzer] Fix unused variable warnings in Release builds

This was just an inlined version of isa<CXXConstructExpr>. NFC.

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

5 years ago[NetBSD] Enable additional sanitizer types
Michal Gorny [Sat, 12 Jan 2019 11:18:35 +0000 (11:18 +0000)]
[NetBSD] Enable additional sanitizer types

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

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

5 years agoNFC: Port loop to cxx_range_for
Stephen Kelly [Sat, 12 Jan 2019 00:42:59 +0000 (00:42 +0000)]
NFC: Port loop to cxx_range_for

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

5 years ago[analyzer] Support for OSObjects out parameters in RetainCountChecker
George Karpenkov [Fri, 11 Jan 2019 23:35:17 +0000 (23:35 +0000)]
[analyzer] Support for OSObjects out parameters in RetainCountChecker

rdar://46357478
rdar://47121327

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

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

5 years ago[analyzer] Introduce a convenience method for getting a CallEvent from an arbitrary...
George Karpenkov [Fri, 11 Jan 2019 23:35:04 +0000 (23:35 +0000)]
[analyzer] Introduce a convenience method for getting a CallEvent from an arbitrary Stmt

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

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

5 years ago[Darwin][Driver] Don't pass a file as object_path_lto during ThinLTO
Steven Wu [Fri, 11 Jan 2019 21:16:04 +0000 (21:16 +0000)]
[Darwin][Driver] Don't pass a file as object_path_lto during ThinLTO

Summary:
After r327851, Driver::GetTemporaryPath will create the file rather than
just create a potientially unqine filename. If clang driver pass the
file as parameter as -object_path_lto, ld64 will pass it back to libLTO
as GeneratedObjectsDirectory, which is going to cause a LLVM ERROR if it
is not a directory.
Now during thinLTO, pass a temp directory path to linker instread.

rdar://problem/47194182

Reviewers: arphaman, dexonsmith

Reviewed By: arphaman

Subscribers: mehdi_amini, inglorion, jkorous, cfe-commits

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

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

5 years agoImplement Attr dumping in terms of visitors
Stephen Kelly [Fri, 11 Jan 2019 19:16:01 +0000 (19:16 +0000)]
Implement Attr dumping in terms of visitors

Remove now-vestigial dumpType and dumpBareDeclRef methods. The old
tablegen generated code used to expect them to be present, but the new
generated code has no such requirement.

Reviewers: aaron.ballman

Subscribers: mgorny, cfe-commits

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

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

5 years ago[ASTDump] Add utility for dumping a label with child nodes
Stephen Kelly [Fri, 11 Jan 2019 19:11:17 +0000 (19:11 +0000)]
[ASTDump] Add utility for dumping a label with child nodes

Summary:
Use it to add optional label nodes to Stmt dumps.  This preserves
behavior of InitExprList dump:

// CHECK-NEXT: `-InitListExpr {{.+}} <col:13, col:15> 'U [3]'
// CHECK-NEXT:   |-array_filler: InitListExpr {{.+}} <col:15> 'U' field Field {{.+}} 'i' 'int'
// CHECK-NEXT:   `-InitListExpr {{.+}} <col:14> 'U' field Field {{.+}} 'i' 'int'
// CHECK-NEXT:     `-IntegerLiteral {{.+}} <col:14> 'int' 1

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py
Serge Guelton [Fri, 11 Jan 2019 19:04:48 +0000 (19:04 +0000)]
[Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

Current clang fail to bootstrap in PGO mode when only python3 is available,
because perf-helper.py is not compatible with python3.

Commited on behalf of  Romain Geissler.

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

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

5 years ago[test] Update support for Exynos M4 (NFC)
Evandro Menezes [Fri, 11 Jan 2019 18:54:41 +0000 (18:54 +0000)]
[test] Update support for Exynos M4 (NFC)

Update test cases for Exynos M4.

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

5 years ago[MergeFunc] Update clang test for r350939
Vedant Kumar [Fri, 11 Jan 2019 18:51:02 +0000 (18:51 +0000)]
[MergeFunc] Update clang test for r350939

In r350939, the MergeFunc pass learned to erase duplicate functions
which are discardable if unused.

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

5 years ago[LTO] Add option to enable LTOUnit splitting, and disable unless needed
Teresa Johnson [Fri, 11 Jan 2019 18:32:07 +0000 (18:32 +0000)]
[LTO] Add option to enable LTOUnit splitting, and disable unless needed

Summary:
Adds a new -f[no]split-lto-unit flag that is disabled by default to
control module splitting during ThinLTO. It is automatically enabled
for -fsanitize=cfi and -fwhole-program-vtables.

The new EnableSplitLTOUnit codegen flag is passed down to llvm
via a new module flag of the same name.

Depends on D53890.

Reviewers: pcc

Subscribers: ormris, mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, cfe-commits, llvm-commits

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

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

5 years ago[analyzer] [NFC] Fix the FIXME in tests
George Karpenkov [Fri, 11 Jan 2019 18:12:49 +0000 (18:12 +0000)]
[analyzer] [NFC] Fix the FIXME in tests

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

5 years ago[attributes] Extend os_returns_(not_?)_retained attributes to parameters
George Karpenkov [Fri, 11 Jan 2019 18:02:08 +0000 (18:02 +0000)]
[attributes] Extend os_returns_(not_?)_retained attributes to parameters

When applied to out-parameters, the attributes specify the expected lifetime of the written-into object.

Additionally, introduce OSReturnsRetainedOn(Non)Zero attributes, which
specify that an ownership transfer happens depending on a return code.

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

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

5 years agoFix a pair of Wfallthrough warnings in ScanfFormatString.
Erich Keane [Fri, 11 Jan 2019 18:01:40 +0000 (18:01 +0000)]
Fix a pair of Wfallthrough warnings in ScanfFormatString.

Change-Id: Ia73a34fdd93fc974224583505f9e6432493cb0da

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

5 years agoImplementation Feature Test Macros for P0722R3
Chris Kennelly [Fri, 11 Jan 2019 17:09:22 +0000 (17:09 +0000)]
Implementation Feature Test Macros for P0722R3

Summary:
P1353R0, adopted in San Diego, specified an implementation feature test macro for destroying delete (P0722R3).

The implementation of the feature (https://reviews.llvm.org/rL315662) is not guarded behind a flag, so the macro is not conditional on language version.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

5 years agoSilence -Wsign-compare in unittests
Bjorn Pettersson [Fri, 11 Jan 2019 16:53:45 +0000 (16:53 +0000)]
Silence -Wsign-compare in unittests

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

5 years ago[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed
Akira Hatanaka [Fri, 11 Jan 2019 07:06:38 +0000 (07:06 +0000)]
[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed
to it is a trivial_abi class.

A class that has all of its copy and move constructors deleted can still
be passed or returned in registers if the class is annotated with
trivial_abi.

This fixes PR39683.

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

5 years ago[Sema] If CheckPlaceholderExpr rewrites the initializer of an auto
Akira Hatanaka [Fri, 11 Jan 2019 04:57:34 +0000 (04:57 +0000)]
[Sema] If CheckPlaceholderExpr rewrites the initializer of an auto
variable during auto type deduction, use the rewritten initializer when
performing initialization of the variable.

This silences spurious -Warc-repeated-use-of-weak warnings that are
issued when the initializer uses a weak ObjC pointer.

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

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

5 years agoRemember to instantiate explicit template argument lists in a friend
Richard Smith [Fri, 11 Jan 2019 01:59:33 +0000 (01:59 +0000)]
Remember to instantiate explicit template argument lists in a friend
function declaration.

We'd previously often just drop these on the floor, and friend
redeclaration matching would usually (but not always) figure out the
right redeclaration anyway.

Also, don't try to match a dependent friend function template
specialization to a template until instantiation, and don't forget to
reject qualified friend declarations in dependent contexts that don't
name an already-declared entity.

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

5 years ago[AST] Remove ASTContext from getThisType (NFC)
Brian Gesiak [Fri, 11 Jan 2019 01:54:53 +0000 (01:54 +0000)]
[AST] Remove ASTContext from getThisType (NFC)

Summary:
https://reviews.llvm.org/D54862 removed the usages of `ASTContext&` from
within the `CXXMethodDecl::getThisType` method. Remove the parameter
altogether, as well as all usages of it. This does not result in any
functional change because the parameter was unused since
https://reviews.llvm.org/D54862.

Test Plan: check-clang

Reviewers: akyrtzi, mikael

Reviewed By: mikael

Subscribers: mehdi_amini, dexonsmith, cfe-commits

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

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

5 years agoFix header issues.
Richard Trieu [Fri, 11 Jan 2019 01:32:35 +0000 (01:32 +0000)]
Fix header issues.

Several headers would fail to compile if other headers were not previously
included.  The usual issue is that a class is forward declared, but the
full definition is needed.  The requirement for the definition is use of
isa/dyn_cast or calling functions of pointer-packed data types such as
DenseMap or PointerIntPair.  Add missing includes to these headers.

SVals.h required an out-of-line method definition in the .cpp file to avoid
circular inclusion of headers with BasicValueFactory.h

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

5 years agoAdd an explicit initializer to silence a -Wmissing-field-initializers diagnostic...
Aaron Ballman [Fri, 11 Jan 2019 00:13:57 +0000 (00:13 +0000)]
Add an explicit initializer to silence a -Wmissing-field-initializers diagnostic; NFC.

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

5 years ago[WebAssembly] Add unimplemented-simd128 feature, gate builtins
Thomas Lively [Thu, 10 Jan 2019 23:49:00 +0000 (23:49 +0000)]
[WebAssembly] Add unimplemented-simd128 feature, gate builtins

Summary: Depends on D56501. Also adds a macro define
`__wasm_unimplemented_simd128__` for feature detection of
unimplemented SIMD builtins.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits, rrwinterton

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

5 years ago[analyzer] pr38838, pr39976: Fix crash on diagnosing before implicit destructor.
Artem Dergachev [Thu, 10 Jan 2019 23:44:44 +0000 (23:44 +0000)]
[analyzer] pr38838, pr39976: Fix crash on diagnosing before implicit destructor.

We need to be able to emit the diagnostic at PreImplicitCall,
and the patch implements this functionality.

However, for now the need for emitting such diagnostics is not all that great:
it is only necessary to not crash when emitting a false positive due to an
unrelated issue of having dead symbol collection not working properly.

Coming up with a non-false-positive test seems impossible with the current
set of checkers, though it is likely to be needed for good things as well
in the future.

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

rdar://problem/46911462

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

5 years agoProperly support -shared-libgcc.
Sterling Augustine [Thu, 10 Jan 2019 22:25:58 +0000 (22:25 +0000)]
Properly support -shared-libgcc.
This revision was revied in D55016.

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

5 years agoCorrect the source range returned from preprocessor callbacks.
Aaron Ballman [Thu, 10 Jan 2019 21:22:13 +0000 (21:22 +0000)]
Correct the source range returned from preprocessor callbacks.

This adjusts the source range passed in to the preprocessor callbacks to only include the condition range itself, rather than all of the conditionally skipped tokens.

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

5 years agoNFC: Change case of identifiers
Stephen Kelly [Thu, 10 Jan 2019 20:58:21 +0000 (20:58 +0000)]
NFC: Change case of identifiers

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

5 years ago[Sema] Call CheckPlaceholderExpr to resolve typeof or decltype
Akira Hatanaka [Thu, 10 Jan 2019 20:12:16 +0000 (20:12 +0000)]
[Sema] Call CheckPlaceholderExpr to resolve typeof or decltype
placeholder expressions while an unevaluated context is still on the
expression evaluation context stack.

This prevents recordUseOfWeek from being called when a weak variable is
used as an operand of a decltype or a typeof expression and fixes
spurious -Warc-repeated-use-of-weak warnings.

rdar://problem/45742525

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

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

5 years ago[HIP] Use nul instead of /dev/null when running on windows
Yaxun Liu [Thu, 10 Jan 2019 20:09:52 +0000 (20:09 +0000)]
[HIP] Use nul instead of /dev/null when running on windows

When clang is running on windows, /dev/null is not available. Use nul as empty input file instead.

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

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

5 years agofixup: sphinx warning
Nick Desaulniers [Thu, 10 Jan 2019 19:26:35 +0000 (19:26 +0000)]
fixup: sphinx warning

Fixes the sphinx warning:
tools/clang/docs/DiagnosticsReference.rst:7889: WARNING: Title underline
too short.

That I just introduced in r350877.

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

5 years ago[SemaCXX] add -Woverride-init alias to -Winitializer-overrides
Nick Desaulniers [Thu, 10 Jan 2019 19:12:39 +0000 (19:12 +0000)]
[SemaCXX] add -Woverride-init alias to -Winitializer-overrides

Summary:
https://bugs.llvm.org/show_bug.cgi?id=40251
https://github.com/ClangBuiltLinux/linux/issues/307

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, nathanchance, srhines

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

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

5 years agoFix false positive unsequenced access and modification warning in array subscript...
Nicolas Lesser [Thu, 10 Jan 2019 19:03:33 +0000 (19:03 +0000)]
Fix false positive unsequenced access and modification warning in array subscript expression.

Summary: In the [expr.sub] p1, we can read that for a given E1[E2], E1 is sequenced before E2.

Patch by Mateusz Janek.

Reviewers: rsmith, Rakete1111

Reviewed By: rsmith, Rakete1111

Subscribers: riccibruno, lebedev.ri, Rakete1111, hiraditya, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] [hotfix] Fix the tests
George Karpenkov [Thu, 10 Jan 2019 18:28:10 +0000 (18:28 +0000)]
[analyzer] [hotfix] Fix the tests

The error must have crept during the cherry-pick.

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

5 years ago[analyzer] Update the category name for RetainCountChecker reports
George Karpenkov [Thu, 10 Jan 2019 18:16:25 +0000 (18:16 +0000)]
[analyzer] Update the category name for RetainCountChecker reports

..now that it includes OSObjects

rdar://46509986

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

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

5 years ago[analyzer] [NFC] [RetainCountChecker] Remove dead unused map
George Karpenkov [Thu, 10 Jan 2019 18:16:10 +0000 (18:16 +0000)]
[analyzer] [NFC] [RetainCountChecker] Remove dead unused map

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

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

5 years ago[analyzer] Quote the type of the leaked/problematic object in diagnostics for readability
George Karpenkov [Thu, 10 Jan 2019 18:15:57 +0000 (18:15 +0000)]
[analyzer] Quote the type of the leaked/problematic object in diagnostics for readability

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

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

5 years ago[analyzer] [NFC] Reverse the argument order for "diff" in tests
George Karpenkov [Thu, 10 Jan 2019 18:15:44 +0000 (18:15 +0000)]
[analyzer] [NFC] Reverse the argument order for "diff" in tests

The current argument order has "expected" and "actual" the wrong way around,
so that the diff shows the change from expected to actual, not from actual to expected.

Namely, if the expected diagnostics contains the string "foo", but the analyzer emits "bar",
we really want to see:

```
- foo
+ bar
```

not

```
- bar
+ foo
```

since adapting to most changes would require applying that diff to the expected output.

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

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

5 years ago[analyzer] [NFC] Reduce redundancy in RetainSummaryManager by using a function
George Karpenkov [Thu, 10 Jan 2019 18:15:30 +0000 (18:15 +0000)]
[analyzer] [NFC] Reduce redundancy in RetainSummaryManager by using a function

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

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

5 years ago[analyzer] [RetainCountChecker] [NFC] Remove SummaryLog
George Karpenkov [Thu, 10 Jan 2019 18:15:17 +0000 (18:15 +0000)]
[analyzer] [RetainCountChecker] [NFC] Remove SummaryLog

The complicated machinery for passing the summary log around is actually
only used for one thing! To figure out whether the "dealloc" message was
sent.

Since I have tried to extend it for other uses and failed (it's actually
very hard to use), I think it's much better to simply use a tag and
remove the summary log altogether.

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

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

5 years ago[analyzer] [RetainCountChecker] [NFC] Another minor cleanup
George Karpenkov [Thu, 10 Jan 2019 18:15:04 +0000 (18:15 +0000)]
[analyzer] [RetainCountChecker] [NFC] Another minor cleanup

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

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

5 years ago[analyzer] [RetainCountChecker] [NFC] Refactor the way attributes are handled
George Karpenkov [Thu, 10 Jan 2019 18:14:51 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] [NFC] Refactor the way attributes are handled

Make sure all checks for attributes go through a centralized function,
which checks whether attribute handling is enabled, and performs
validation.  The type of the attribute is returned.

Sadly, metaprogramming is required as attributes have no sensible static
getters.

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

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

5 years ago[analyzer] [RetainCountChecker] Remove redundant enum UnarySummaryKind
George Karpenkov [Thu, 10 Jan 2019 18:14:38 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] Remove redundant enum UnarySummaryKind

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

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

5 years ago[analyzer] [RetainCountChecker] Remove obsolete "MakeCollectable" enum value
George Karpenkov [Thu, 10 Jan 2019 18:14:25 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] Remove obsolete "MakeCollectable" enum value

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

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

5 years ago[analyzer] [RetainCountChecker] [NFC] Remove redundant enum items *Msg, as the object...
George Karpenkov [Thu, 10 Jan 2019 18:14:12 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] [NFC] Remove redundant enum items *Msg, as the object type is already communicated by a separate field

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

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

5 years ago[analyzer] [NFC] Track object type with ArgEffect in RetainCountChecker.
George Karpenkov [Thu, 10 Jan 2019 18:13:59 +0000 (18:13 +0000)]
[analyzer] [NFC] Track object type with ArgEffect in RetainCountChecker.

This would be needed in the future.

https://reviews.llvm.org/D56040

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

5 years ago[analyzer] [NFC] Move ObjKind into a separate top-level enum in RetainSummaryManager.
George Karpenkov [Thu, 10 Jan 2019 18:13:46 +0000 (18:13 +0000)]
[analyzer] [NFC] Move ObjKind into a separate top-level enum in RetainSummaryManager.

Allows using it in future outside of RetEffect.

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

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

5 years agoSplit -Wdelete-non-virtual-dtor into two groups
Erik Pilkington [Thu, 10 Jan 2019 18:03:07 +0000 (18:03 +0000)]
Split -Wdelete-non-virtual-dtor into two groups

This group controls two diagnostics: deleting an abstract class with
a non-virtual dtor, which is a guaranteed crash, and deleting a
non-abstract polymorphic class with a non-virtual dtor, which is just
suspicious.

rdar://40380564

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

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

5 years ago[analyzer][CrossTU][NFC] Generalize to external definitions instead of external functions
Rafael Stahl [Thu, 10 Jan 2019 17:44:04 +0000 (17:44 +0000)]
[analyzer][CrossTU][NFC] Generalize to external definitions instead of external functions

Summary: This is just changing naming and documentation to be general about external definitions that can be imported for cross translation unit analysis. There is at least a plan to add VarDecls: D46421

Reviewers: NoQ, xazax.hun, martong, a.sidorin, george.karpenkov, serge-sans-paille

Reviewed By: xazax.hun, martong

Subscribers: mgorny, whisperity, baloghadamsoftware, szepet, rnkovacs, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

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

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

5 years agoCorrect the spelling of helpURI to helpUri.
Aaron Ballman [Thu, 10 Jan 2019 13:19:48 +0000 (13:19 +0000)]
Correct the spelling of helpURI to helpUri.

JSON is case sensitive and the SARIF spec uses the corrected spelling.

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

5 years ago[libclang] Fix clang_Cursor_isAnonymous
Ivan Donchevskii [Thu, 10 Jan 2019 09:34:44 +0000 (09:34 +0000)]
[libclang] Fix clang_Cursor_isAnonymous

Use the same logic as in TypePrinter::printTag to determine that the tag is anonymous and the separate check for namespaces.

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

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

5 years ago[AMDGPU] Separate feature dot-insts
Stanislav Mekhanoshin [Thu, 10 Jan 2019 03:25:47 +0000 (03:25 +0000)]
[AMDGPU] Separate feature dot-insts

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

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

5 years agoRefactor declarations of ASTContext allocate functions into its own header.
Richard Trieu [Thu, 10 Jan 2019 03:23:25 +0000 (03:23 +0000)]
Refactor declarations of ASTContext allocate functions into its own header.

Forward declarations of the allocate functions combine with the forward
declaration of the ASTContext class is enough information for some headers
without pulling in ASTContext.h in its entirety.  Pull the existing
declarations from AttrIterator.h into a new header.  Also place the default
alignment size into this header.  Previously, new had its default in
AttrIterator.h while new[] had its default in ASTContext.h.  Add new header
includes where it is needed.  Specifically to ASTVector.h to make it a
standalone header, unlike previously which it was standalone as long as
none of its functions were called.

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

5 years ago[X86] Really make the pointer arguments to avx512 gather/scatter intrinsics 'void...
Craig Topper [Thu, 10 Jan 2019 00:47:25 +0000 (00:47 +0000)]
[X86] Really make the pointer arguments to avx512 gather/scatter intrinsics 'void*' to match gcc and Intel's documentation.

The avx2 gather intrinsics are documented to use 'int', 'long long', 'float', or 'double' *. So I'm leaving those. This matches gcc.

I tried to do this in r350696, but I only updated the header not the builtin definition.

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

5 years agoIn nothrow new-expressions, null-check the result if we're going to
Richard Smith [Thu, 10 Jan 2019 00:03:29 +0000 (00:03 +0000)]
In nothrow new-expressions, null-check the result if we're going to
apply sanitizers to it.

This avoids a sanitizer false positive that we are initializing a null
pointer.

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

5 years ago[Sema] Mark target of __attribute__((alias("target"))) used for C
Nick Desaulniers [Wed, 9 Jan 2019 23:54:55 +0000 (23:54 +0000)]
[Sema] Mark target of __attribute__((alias("target"))) used for C

Summary:
Prevents -Wunneeded-internal-delcaration warnings when the target has no
other references. This occurs frequently in device drivers in the Linux
kernel.

Sema would need to invoke the demangler on the target, since in C++ the
target name is mangled:

int f() { return 42; }
int g() __attribute__((alias("_Z1fv")));

Sema does not have the ability to demangle names at this time.

https://bugs.llvm.org/show_bug.cgi?id=39088
https://github.com/ClangBuiltLinux/linux/issues/232

Reviewers: rsmith, rjmccall

Reviewed By: rsmith

Subscribers: erik.pilkington, cfe-commits, pirama, srhines

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

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

5 years ago[ObjC] Allow the use of implemented unavailable methods from within
Alex Lorenz [Wed, 9 Jan 2019 22:31:37 +0000 (22:31 +0000)]
[ObjC] Allow the use of implemented unavailable methods from within
the @implementation context

In Objective-C, it's common for some frameworks to mark some methods like init
as unavailable in the @interface to prohibit their usage. However, these
frameworks then often implemented said method and refer to it in another method
that acts as a factory for that object. The recent change to how messages to
self are type checked in clang (r349841) introduced a regression which started
to prohibit this pattern with an X is unavailable error. This commit addresses
the aforementioned regression.

rdar://47134898

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

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

5 years ago[OpenMP] Avoid remainder operations for loop index values on a collapsed loop nest.
Gheorghe-Teodor Bercea [Wed, 9 Jan 2019 20:45:26 +0000 (20:45 +0000)]
[OpenMP] Avoid remainder operations for loop index values on a collapsed loop nest.

Summary: Change the strategy for computing loop index variables after collapsing a loop nest via the collapse clause by replacing the expensive remainder operation with multiplications and additions.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, arphaman, cfe-commits

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

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

5 years ago[OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter
Gheorghe-Teodor Bercea [Wed, 9 Jan 2019 20:38:35 +0000 (20:38 +0000)]
[OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

Summary: Introduce a compiler flag for cases when the user knows that the collapsed loop counter can be safely represented using at most 32 bits. This will prevent the emission of expensive mathematical operations (such as the div operation) on the iteration variable using 64 bits where 32 bit operations are sufficient.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: hfinkel, kkwli0, guansong, cfe-commits

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

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

5 years ago[OPENMP][DOCS]Release notes/OpenMP support updates, NFC.
Alexey Bataev [Wed, 9 Jan 2019 20:32:56 +0000 (20:32 +0000)]
[OPENMP][DOCS]Release notes/OpenMP support updates, NFC.

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

5 years agoRemoving an include that was not necessary; NFC.
Aaron Ballman [Wed, 9 Jan 2019 20:15:10 +0000 (20:15 +0000)]
Removing an include that was not necessary; NFC.

The include also had a using namespace llvm in it, so this adds qualifiers where needed as well.

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

5 years ago[CodeGen] Clarify comment about COFF common symbol alignment
Shoaib Meenai [Wed, 9 Jan 2019 20:05:16 +0000 (20:05 +0000)]
[CodeGen] Clarify comment about COFF common symbol alignment

After a discussion on the commit thread, it seems the 32 byte alignment
limitation is an MSVC toolchain artifact, not an inherent COFF
restriction. Clarify the comment accordingly, since saying COFF in the
comment but using isKnownWindowsMSVCEnvironment in the conditional is
confusing. Also add a newline before the comment, which is consistent
with the local style.

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

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

5 years ago[AST] Move back BasePathSize to the bit-fields of CastExpr
Bruno Ricci [Wed, 9 Jan 2019 16:41:33 +0000 (16:41 +0000)]
[AST] Move back BasePathSize to the bit-fields of CastExpr

The number of trailing CXXBaseSpecifiers in CastExpr was moved from
CastExprBitfields to a trailing object in r338489 (D50050). At this time these
bit-fields classes were only 32 bits wide. However later r345459 widened these
bit-field classes to 64 bits.

The reason for this change was that on 64 bit archs alignment requirements
caused 4 bytes of padding after the Stmt sub-object in nearly all expression
classes. Reusing this padding yielded an >10% reduction in the size used by all
statement/expressions when parsing all of Boost (on a 64 bit arch). This
increased the size of statement/expressions for 32 bits archs, but this can be
mitigated by moving more data to the bit-fields of Stmt (and moreover most
people now care about 64 bits archs as a host).

Therefore move back the number of CXXBaseSpecifiers in CastExpr to the
bit-fields of Stmt. This in effect mostly revert r338489 while keeping the
added test.

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

Reviewed By: lebedev.ri

Reviewers: lebedev.ri, rjmccall

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

5 years agoIncorrect implicit data-sharing for nested tasks
Alexey Bataev [Wed, 9 Jan 2019 15:58:05 +0000 (15:58 +0000)]
Incorrect implicit data-sharing for nested tasks

Summary:
There is a minor issue in how the implicit data-sharings for nested tasks are computed.

For the following example:
```
int x;
#pragma omp task shared(x)
#pragma omp task
x++;
```
We compute an implicit data-sharing of shared for `x` in the second task although I think that it should be firstprivate. Below you can find the part of the OpenMP spec that covers this example:
- // In a task generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above and that in the enclosing context is determined to be shared by all implicit tasks bound to the current team is shared.//
- //In a task generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above is firstprivate.//

Since each implicit-task has its own copy of `x`, we shouldn't apply the first rule.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: cfe-commits, rogfer01

Tags: #openmp

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

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

5 years ago[AST] Store the results in OverloadExpr in a trailing array
Bruno Ricci [Wed, 9 Jan 2019 15:43:19 +0000 (15:43 +0000)]
[AST] Store the results in OverloadExpr in a trailing array

Use the newly available space in the bit-fields of Stmt to pack
OverloadExpr, UnresolvedLookupExpr and UnresolvedMemberExpr.

Additionally store the results in the overload set in a trailing array.
This saves 1 pointer + 8 bytes per UnresolvedLookupExpr and
UnresolvedMemberExpr.

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

Reviewed By: rjmccall

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

5 years agoRemove dependency-related arguments in clang-check.
Alexander Kornienko [Wed, 9 Jan 2019 15:00:06 +0000 (15:00 +0000)]
Remove dependency-related arguments in clang-check.

This is the default behavior of clang tools, but clang-check overrides default
argument adjusters for some reason.

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