]> granicus.if.org Git - clang/log
clang
7 years agoUpdate cc1as_main for MCCodeEmitter ownership change in r315531.
Lang Hames [Wed, 11 Oct 2017 23:35:27 +0000 (23:35 +0000)]
Update cc1as_main for MCCodeEmitter ownership change in r315531.

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

7 years ago[ADT] Make Twine's copy constructor private.
Zachary Turner [Wed, 11 Oct 2017 23:33:06 +0000 (23:33 +0000)]
[ADT] Make Twine's copy constructor private.

There's a lot of misuse of Twine scattered around LLVM.  This
ranges in severity from benign (returning a Twine from a function
by value that is just a string literal) to pretty sketchy (storing
a Twine by value in a class).  While there are some uses for
copying Twines, most of the very compelling ones are confined
to the Twine class implementation itself, and other uses are
either dubious or easily worked around.

This patch makes Twine's copy constructor private, and fixes up
all callsites.

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

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

7 years ago[Driver] Export symbols needed to use profile runtime
Vedant Kumar [Wed, 11 Oct 2017 21:54:09 +0000 (21:54 +0000)]
[Driver] Export symbols needed to use profile runtime

Apple's API verification tool (tapi) checks that the symbols exported
from a program match a whitelist. When the program uses the profile
runtime, some additional symbols which are typically not part of the
regular whitelist must be exported.

If we're using symbol export directives along with the profile runtime
on Darwin, the driver needs to export the additional symbols to avoid
verification failures.

rdar://problem/30067753

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

7 years ago[X86] Add support for 'amdfam17h' to __builtin_cpu_is to match gcc.
Craig Topper [Wed, 11 Oct 2017 21:42:02 +0000 (21:42 +0000)]
[X86] Add support for 'amdfam17h' to __builtin_cpu_is to match gcc.

The compiler-rt implementation already supported it, it just wasn't exposed.

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

7 years ago[Analyzer] Support bodyfarming libstdc++ implementation of std::call_once.
George Karpenkov [Wed, 11 Oct 2017 20:53:01 +0000 (20:53 +0000)]
[Analyzer] Support bodyfarming libstdc++ implementation of std::call_once.

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

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

7 years ago[clang-fuzzer] Build with newer protobuf-mutator.
Matt Morehouse [Wed, 11 Oct 2017 20:45:10 +0000 (20:45 +0000)]
[clang-fuzzer] Build with newer protobuf-mutator.

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

7 years ago[Analyzer] Fix introduced regression: properly check for nullable attribute.
George Karpenkov [Wed, 11 Oct 2017 19:13:15 +0000 (19:13 +0000)]
[Analyzer] Fix introduced regression: properly check for nullable attribute.

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

7 years ago[Analyzer] Remove dead code from testing scripts
George Karpenkov [Wed, 11 Oct 2017 18:42:39 +0000 (18:42 +0000)]
[Analyzer] Remove dead code from testing scripts

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

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

7 years ago[Analyzer] Assume that string-like const globals are non-nil.
George Karpenkov [Wed, 11 Oct 2017 18:39:40 +0000 (18:39 +0000)]
[Analyzer] Assume that string-like const globals are non-nil.

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

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

7 years ago[clang-fuzzer] Allow linking with any fuzzing engine.
Matt Morehouse [Wed, 11 Oct 2017 18:29:24 +0000 (18:29 +0000)]
[clang-fuzzer] Allow linking with any fuzzing engine.

Summary:
Makes clang-[proto-]fuzzer compatible with flags specified by OSS-Fuzz.

https://llvm.org/pr34314

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: cfe-commits, mgorny

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

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

7 years ago[X86] Correct type for argument to clflushopt intrinsic.
Craig Topper [Wed, 11 Oct 2017 16:06:08 +0000 (16:06 +0000)]
[X86] Correct type for argument to clflushopt intrinsic.

Summary: According to Intel docs this should take void const *. We had char*. The lack of const is the main issue.

Reviewers: RKSimon, zvi, igorb

Reviewed By: igorb

Subscribers: llvm-commits

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

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

7 years ago[OPENMP] Remove extra if, NFC.
Alexey Bataev [Wed, 11 Oct 2017 15:56:38 +0000 (15:56 +0000)]
[OPENMP] Remove extra if, NFC.

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

7 years agoReland "[clang-fuzzer] Allow building without coverage instrumentation."
Matt Morehouse [Wed, 11 Oct 2017 15:51:12 +0000 (15:51 +0000)]
Reland "[clang-fuzzer] Allow building without coverage instrumentation."

This relands r315336 after fixing bot breakage.

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

7 years ago[OPENMP] Fix PR34916: Crash on mixing taskloop|tasks directives.
Alexey Bataev [Wed, 11 Oct 2017 15:29:40 +0000 (15:29 +0000)]
[OPENMP] Fix PR34916: Crash on mixing taskloop|tasks directives.

If both taskloop and task directives are used at the same time in one
program, we may ran into the situation when the particular type for task
directive is reused for taskloop directives. Patch fixes this problem.

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

7 years ago[clang-fuzzer] Fix shared library dependencies.
Matt Morehouse [Wed, 11 Oct 2017 15:13:53 +0000 (15:13 +0000)]
[clang-fuzzer] Fix shared library dependencies.

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

7 years ago[Analyzer] Clarify error messages for undefined result
Daniel Marjamaki [Wed, 11 Oct 2017 14:49:35 +0000 (14:49 +0000)]
[Analyzer] Clarify error messages for undefined result

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

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

7 years ago[clang-rename] Add more unittest.
Haojian Wu [Wed, 11 Oct 2017 14:00:42 +0000 (14:00 +0000)]
[clang-rename] Add more unittest.

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

7 years ago[OpenCL] Allow function declaration with empty argument list.
Alexey Bader [Wed, 11 Oct 2017 11:16:31 +0000 (11:16 +0000)]
[OpenCL] Allow function declaration with empty argument list.

Treat 'f()' as 'f(void)' rather than a function w/o a prototype.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia, yaxunl

Subscribers: cfe-commits, echuraev, chapuni

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

Re-apply revision 306653.

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

7 years ago[clang-rename] Don't add prefix qualifiers to the declaration and definition of the...
Haojian Wu [Wed, 11 Oct 2017 11:15:48 +0000 (11:15 +0000)]
[clang-rename] Don't add prefix qualifiers to the declaration and definition of the renamed symbol.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, arphaman

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

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

7 years agoRevert r314955: "Remove PendingBody mechanism for function and ObjC method deserializ...
Daniel Jasper [Wed, 11 Oct 2017 07:47:54 +0000 (07:47 +0000)]
Revert r314955: "Remove PendingBody mechanism for function and ObjC method deserialization."

This is breaking a build of https://github.com/abseil/abseil-cpp and so
likely not really NFC. Also reverted subsequent r314956/7.

I'll forward reproduction instructions to Richard.

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

7 years agoReorder.
NAKAMURA Takumi [Wed, 11 Oct 2017 04:54:05 +0000 (04:54 +0000)]
Reorder.

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

7 years agoClangCodeGenTests: Update libdeps in rL315392, +clangAST.
NAKAMURA Takumi [Wed, 11 Oct 2017 04:20:19 +0000 (04:20 +0000)]
ClangCodeGenTests: Update libdeps in rL315392, +clangAST.

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

7 years agoUpdate cc1as_main for MCAsmBackend ownership change in r315410.
Lang Hames [Wed, 11 Oct 2017 01:58:08 +0000 (01:58 +0000)]
Update cc1as_main for MCAsmBackend ownership change in r315410.

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

7 years ago[modules] Fix visibility checking for using declarations via ADL.
Richard Smith [Wed, 11 Oct 2017 01:49:57 +0000 (01:49 +0000)]
[modules] Fix visibility checking for using declarations via ADL.

We want to check whether the using (shadow) declaration itself is visible, not
whether its target is visible.

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

7 years ago[modules] Only take visible using-directives into account during name lookup.
Richard Smith [Wed, 11 Oct 2017 01:19:11 +0000 (01:19 +0000)]
[modules] Only take visible using-directives into account during name lookup.

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

7 years agoA '<' with a trigraph '#' is not a valid editor placeholder
Alex Lorenz [Wed, 11 Oct 2017 00:41:20 +0000 (00:41 +0000)]
A '<' with a trigraph '#' is not a valid editor placeholder

Credit to OSS-Fuzz for discovery:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3137#c5

rdar://34923985

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

7 years ago[Modules TS] Diagnose missing/duplicate module-declaration.
Richard Smith [Wed, 11 Oct 2017 00:36:56 +0000 (00:36 +0000)]
[Modules TS] Diagnose missing/duplicate module-declaration.

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

7 years agoInclude getting generated struct offsets in CodegenABITypes
Adrian Prantl [Tue, 10 Oct 2017 23:54:21 +0000 (23:54 +0000)]
Include getting generated struct offsets in CodegenABITypes

This change adds a new function, CodeGen::getFieldNumber, that
enables a user of clang's code generation to get the field number
in a generated LLVM IR struct that corresponds to a particular field
in a C struct.

It is important to expose this information in Clang's code generation
interface because there is no reasonable way for users of Clang's code
generation to get this information. In particular:

LLVM struct types do not include field names.
Clang adds a non-trivial amount of logic to the code generation of LLVM IR types for structs, in particular to handle padding and bit fields.

Patch by Michael Ferguson!

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

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

7 years ago[Modules TS] Diagnose attempts to enter module implementation units without the modul...
Richard Smith [Tue, 10 Oct 2017 22:35:27 +0000 (22:35 +0000)]
[Modules TS] Diagnose attempts to enter module implementation units without the module interface being available.

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

7 years ago[Modules TS] Module ownership semantics for redeclarations.
Richard Smith [Tue, 10 Oct 2017 22:33:17 +0000 (22:33 +0000)]
[Modules TS] Module ownership semantics for redeclarations.

When declaring an entity in the "purview" of a module, it's never a
redeclaration of an entity in the purview of a default module or in no module
("in the global module"). Don't consider those other declarations as possible
redeclaration targets if they're not visible, and reject any cases where we
pick a prior visible declaration that violates this rule.

This reinstates r315251 and r315256, reverted in r315309 and r315308
respectively, tweaked to avoid triggering a linkage calculation when declaring
implicit special members (this exposed our pre-existing issue with typedef
names for linkage changing the linkage of types whose linkage has already been
computed and cached in more cases). A testcase for that regression has been
added in r315366.

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

7 years agoSupport: Have directory_iterator::status() return FindFirstFileEx/FindNextFile result...
Peter Collingbourne [Tue, 10 Oct 2017 22:19:46 +0000 (22:19 +0000)]
Support: Have directory_iterator::status() return FindFirstFileEx/FindNextFile results on Windows.

This allows clients to avoid an unnecessary fs::status() call on each
directory entry. Because the information returned by FindFirstFileEx
is a subset of the information returned by a regular status() call,
I needed to extract a base class from file_status that contains only
that information.

On my machine, this reduces the time required to enumerate a ThinLTO
cache directory containing 520k files from almost 4 minutes to less
than 2 seconds.

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

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

7 years agoFix indexer crash for default template template parameter value
Jan Korous [Tue, 10 Oct 2017 21:09:49 +0000 (21:09 +0000)]
Fix indexer crash for default template template parameter value

rdar://33058798

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

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

7 years agoAdd test for regression caused by reverted patch r315251.
Richard Smith [Tue, 10 Oct 2017 21:07:44 +0000 (21:07 +0000)]
Add test for regression caused by reverted patch r315251.

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

7 years ago[CGExprScalar] In EmitCompare trunc the result if it has different type as E->getType()
Guozhi Wei [Tue, 10 Oct 2017 20:31:27 +0000 (20:31 +0000)]
[CGExprScalar] In EmitCompare trunc the result if it has different type as E->getType()

Usually compare expression should return i1 type, so EmitScalarConversion is called before return

return EmitScalarConversion(Result, CGF.getContext().BoolTy, E->getType(), E->getExprLoc());

But when ppc intrinsic is called to compare vectors, the ppc intrinsic can return i32 even E->getType() is BoolTy, in this case EmitScalarConversion does nothing, an i32 type result is returned and causes crash later.

This patch detects this case and truncates the result before return.

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

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

7 years agoRevert "[clang-fuzzer] Allow building without coverage instrumentation."
Matt Morehouse [Tue, 10 Oct 2017 20:13:13 +0000 (20:13 +0000)]
Revert "[clang-fuzzer] Allow building without coverage instrumentation."

This reverts r315336 due to build breakage with gcc.
http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/2173

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

7 years ago[clang-fuzzer] Build proto-to-cxx with fuzzer-no-link.
Matt Morehouse [Tue, 10 Oct 2017 17:59:37 +0000 (17:59 +0000)]
[clang-fuzzer] Build proto-to-cxx with fuzzer-no-link.

Makes it possible to build with any sanitizer or none at all.

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

7 years ago[lit] Add host_cxx to lit config
Francis Ricci [Tue, 10 Oct 2017 17:53:45 +0000 (17:53 +0000)]
[lit] Add host_cxx to lit config

Summary: This is required to get the clang version for sanitized builds.

Reviewers: zturner

Subscribers: llvm-commits

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

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

7 years ago[clang-fuzzer] Allow building without coverage instrumentation.
Matt Morehouse [Tue, 10 Oct 2017 17:41:43 +0000 (17:41 +0000)]
[clang-fuzzer] Allow building without coverage instrumentation.

Summary:
Compile with DummyClangFuzzer.cpp as entry point rather than
libFuzzer's main when coverage instrumentation is missing.

https://llvm.org/pr34314

Reviewers: kcc, bogner, vitalybuka

Reviewed By: vitalybuka

Subscribers: cfe-commits, mgorny

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

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

7 years agoFor dllexport class templates, export specializations of member functions (PR34849...
Hans Wennborg [Tue, 10 Oct 2017 16:53:25 +0000 (16:53 +0000)]
For dllexport class templates, export specializations of member functions (PR34849) (take 2)

This is a re-commit of r315025, but making sure to only apply this to
specializations of class template member functions; i.e. not when the function
itself is a template.

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

7 years ago[OPENMP] Add default codegen|tests for 'target parallel for[ simd]'
Alexey Bataev [Tue, 10 Oct 2017 14:14:43 +0000 (14:14 +0000)]
[OPENMP] Add default codegen|tests for 'target parallel for[ simd]'
constructs.

Added default codegen for 'target parallel for' construct + tests for
default codegen of 'target parallel for[ simd]' constructs.

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

7 years agoFix a (slightly weird) 'comma operator within array index expression' warning on...
Simon Pilgrim [Tue, 10 Oct 2017 13:56:17 +0000 (13:56 +0000)]
Fix a (slightly weird) 'comma operator within array index expression' warning on VS builds. NFCI.

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

7 years agoRevert "[Modules TS] Module ownership semantics for redeclarations."
Eric Liu [Tue, 10 Oct 2017 13:09:40 +0000 (13:09 +0000)]
Revert "[Modules TS] Module ownership semantics for redeclarations."

This reverts commit r315251. See the original commit thread for reason.

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

7 years agoRevert "[Modules TS] Avoid computing the linkage of the enclosing DeclContext for...
Eric Liu [Tue, 10 Oct 2017 13:00:18 +0000 (13:00 +0000)]
Revert "[Modules TS] Avoid computing the linkage of the enclosing DeclContext for a declaration in the global module."

This reverts commit r315256. See the original commit thread for reason.

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

7 years ago[analyzer] MisusedMovedObject: Fix state-resetting a base-class sub-object.
Artem Dergachev [Tue, 10 Oct 2017 11:55:56 +0000 (11:55 +0000)]
[analyzer] MisusedMovedObject: Fix state-resetting a base-class sub-object.

If a method is resetting the state of an object that was moved from, it should
be safe to use this object again. However if the method was defined in a parent
class, but used in a child class, the reset didn't happen from the checker's
perspective.

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

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

7 years ago[analyzer] MisusedMovedObject: Add printState() method for self-debugging.
Artem Dergachev [Tue, 10 Oct 2017 11:50:45 +0000 (11:50 +0000)]
[analyzer] MisusedMovedObject: Add printState() method for self-debugging.

This method injects additional information into program state dumps,
describing which objects have been moved from.

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

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

7 years ago[analyzer] PthreadLockChecker: Add printState() method for self-debugging.
Artem Dergachev [Tue, 10 Oct 2017 11:49:09 +0000 (11:49 +0000)]
[analyzer] PthreadLockChecker: Add printState() method for self-debugging.

This method injects additional information into program state dumps,
describing states of mutexes tracked by the checker.

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

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

7 years ago[analyzer] Implement pointer arithmetic on constants
Gabor Horvath [Tue, 10 Oct 2017 11:01:49 +0000 (11:01 +0000)]
[analyzer] Implement pointer arithmetic on constants

Patch by: Rafael Stahl!

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

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

7 years ago[clang-refactor] Fix clang-tidy misc-move-const-arg warning.
Haojian Wu [Tue, 10 Oct 2017 09:48:38 +0000 (09:48 +0000)]
[clang-refactor] Fix clang-tidy misc-move-const-arg warning.

NFC

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

7 years ago[CodeGen] Do not construct complete LValue base info in trivial cases
Ivan A. Kosarev [Tue, 10 Oct 2017 09:39:32 +0000 (09:39 +0000)]
[CodeGen] Do not construct complete LValue base info in trivial cases

Besides obvious code simplification, avoiding explicit creation
of LValueBaseInfo objects makes it easier to make TBAA
information to be part of such objects.

This is part of D38126 reworked to be a separate patch to
simplify review.

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

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

7 years agoFix small nits in clang-refactor doc.
Haojian Wu [Tue, 10 Oct 2017 09:00:56 +0000 (09:00 +0000)]
Fix small nits in clang-refactor doc.

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

7 years ago[ASTMatchers] Don't create a copy of a std::set when iterating over it.
Benjamin Kramer [Tue, 10 Oct 2017 07:21:34 +0000 (07:21 +0000)]
[ASTMatchers] Don't create a copy of a std::set when iterating over it.

This is a bit awkward because lookup returns a copy instead of a
reference. No functionality change intended.

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

7 years ago[Sema][ObjC] Preserve syntactic sugar when removing
Akira Hatanaka [Tue, 10 Oct 2017 01:24:33 +0000 (01:24 +0000)]
[Sema][ObjC] Preserve syntactic sugar when removing
ARCReclaimReturnedObject cast.

This is a follow-up to r314370.

Rather than throwing away the enclosing parentheses, this commit walks
down the expression until an ARCReclaimReturnedObject cast is found and
removes just the cast, preserving the syntactic sugar expressions
(parens and casts) that were visited up to that point.

rdar://problem/34705720

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

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

7 years ago[Modules TS] Avoid computing the linkage of the enclosing DeclContext for a declarati...
Richard Smith [Tue, 10 Oct 2017 00:49:38 +0000 (00:49 +0000)]
[Modules TS] Avoid computing the linkage of the enclosing DeclContext for a declaration in the global module.

This works around a language issue where adding a typedef name for linkage
purposes changes the linkage of an already-defined class after it becomes
complete.

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

7 years agoR13575: Fix USR mangling for function pointer types
Jan Korous [Tue, 10 Oct 2017 00:35:16 +0000 (00:35 +0000)]
R13575: Fix USR mangling for function pointer types

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

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

7 years agoFix typos in documentation
Jan Korous [Mon, 9 Oct 2017 23:45:20 +0000 (23:45 +0000)]
Fix typos in documentation

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

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

7 years ago[Modules TS] Module ownership semantics for redeclarations.
Richard Smith [Mon, 9 Oct 2017 23:42:09 +0000 (23:42 +0000)]
[Modules TS] Module ownership semantics for redeclarations.

When declaring an entity in the "purview" of a module, it's never a
redeclaration of an entity in the purview of a default module or in no module
("in the global module"). Don't consider those other declarations as possible
redeclaration targets if they're not visible, and reject any cases where we
pick a prior visible declaration that violates this rule.

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

7 years ago[Analyzer] Do not segfault on unexpected call_once implementation
George Karpenkov [Mon, 9 Oct 2017 23:20:46 +0000 (23:20 +0000)]
[Analyzer] Do not segfault on unexpected call_once implementation

Fixes https://bugs.llvm.org/show_bug.cgi?id=34869

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

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

7 years agoPR13575: Fix test
Jan Korous [Mon, 9 Oct 2017 20:17:28 +0000 (20:17 +0000)]
PR13575: Fix test

Ignore OS-specific mangled name.

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

7 years agoAMDGPU: Add read_exec_lo/hi builtins
Matt Arsenault [Mon, 9 Oct 2017 20:06:37 +0000 (20:06 +0000)]
AMDGPU: Add read_exec_lo/hi builtins

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

7 years agoPR13575: Fix USR mangling for fixed-size arrays
Jan Korous [Mon, 9 Oct 2017 19:51:33 +0000 (19:51 +0000)]
PR13575: Fix USR mangling for fixed-size arrays

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

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

7 years agoTesting commit access.
Hamza Sood [Mon, 9 Oct 2017 19:07:09 +0000 (19:07 +0000)]
Testing commit access.

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

7 years agoAMDGPU: Fix missing declaration for __builtin_amdgcn_dispatch_ptr
Matt Arsenault [Mon, 9 Oct 2017 17:44:18 +0000 (17:44 +0000)]
AMDGPU: Fix missing declaration for __builtin_amdgcn_dispatch_ptr

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

7 years agoSet PreprocessorOpts.GeneratePreamble=true in PrecompiledPreamble.
Ilya Biryukov [Mon, 9 Oct 2017 16:52:12 +0000 (16:52 +0000)]
Set PreprocessorOpts.GeneratePreamble=true in PrecompiledPreamble.

Summary:
It was previsouly set only in ASTUnit, but it should be set for all client of
PrecompiledPreamble.

Reviewers: erikjv, bkramer, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

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

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

7 years agoCertain versions of clang require an explicit initialization for literal const members.
Benjamin Kramer [Sun, 8 Oct 2017 21:28:47 +0000 (21:28 +0000)]
Certain versions of clang require an explicit initialization for literal const members.

include/clang/Lex/PreprocessorLexer.h:79:3: error: constructor for
'clang::PreprocessorLexer' must explicitly initialize the const member
'FID'

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

7 years agoRemove unused variables. No functionality change.
Benjamin Kramer [Sun, 8 Oct 2017 21:23:02 +0000 (21:23 +0000)]
Remove unused variables. No functionality change.

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

7 years agoMake SourceLocation, QualType and friends have constexpr constructors.
Benjamin Kramer [Sun, 8 Oct 2017 20:53:36 +0000 (20:53 +0000)]
Make SourceLocation, QualType and friends have constexpr constructors.

No functionality change intended.

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

7 years agoRemove unused variables. No functionality change.
Benjamin Kramer [Sun, 8 Oct 2017 19:11:02 +0000 (19:11 +0000)]
Remove unused variables. No functionality change.

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

7 years ago[Driver] Fix -static-libsan / -shared-libsan on Darwin
Vedant Kumar [Sat, 7 Oct 2017 01:42:09 +0000 (01:42 +0000)]
[Driver] Fix -static-libsan / -shared-libsan on Darwin

Don't ignore these flags on Darwin. The old behavior of using the
dynamic runtime when neither flag is passed is preserved.

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

7 years agoDriver: hoist the `wchar_t` handling to the driver
Saleem Abdulrasool [Fri, 6 Oct 2017 23:09:55 +0000 (23:09 +0000)]
Driver: hoist the `wchar_t` handling to the driver

Move the logic for determining the `wchar_t` type information into the
driver.  Rather than passing the single bit of information of
`-fshort-wchar` indicate to the frontend the desired type of `wchar_t`
through a new `-cc1` option of `-fwchar-type` and indicate the
signedness through `-f{,no-}signed-wchar`.  This replicates the current
logic which was spread throughout Basic into the
`RenderCharacterOptions`.

Most of the changes to the tests are to ensure that the frontend uses
the correct type.  Add a new test set under `test/Driver/wchar_t.c` to
ensure that we calculate the proper types for the various cases.

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

7 years agoRevert "For dllexport class templates, export specializations of member functions...
Reid Kleckner [Fri, 6 Oct 2017 21:28:21 +0000 (21:28 +0000)]
Revert "For dllexport class templates, export specializations of member functions (PR34849)"

This reverts r315025, it caused http://crbug.com/772461

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

7 years ago[MS] Raise the default value of _MSC_VER to 1911, which is VS 2017
Reid Kleckner [Fri, 6 Oct 2017 21:02:28 +0000 (21:02 +0000)]
[MS] Raise the default value of _MSC_VER to 1911, which is VS 2017

Summary:
This raises our default past 1900, which controls whether char16_t is a
builtin type or not.

Implements PR34243

Reviewers: hans

Subscribers: STL_MSFT, rsmith, cfe-commits

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

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

7 years ago-Wdocumentation should allow '...' params in variadic function type aliases
Alex Lorenz [Fri, 6 Oct 2017 20:51:04 +0000 (20:51 +0000)]
-Wdocumentation should allow '...' params in variadic function type aliases

rdar://34811344

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

7 years agoRevert r315087
Alex Lorenz [Fri, 6 Oct 2017 19:49:29 +0000 (19:49 +0000)]
Revert r315087

clang-refactor crashes on some bots after this commit

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

7 years agoOpenCL: Assume functions are convergent
Matt Arsenault [Fri, 6 Oct 2017 19:34:40 +0000 (19:34 +0000)]
OpenCL: Assume functions are convergent

This was done for CUDA functions in r261779, and for the same
reason this also needs to be done for OpenCL. An arbitrary
function could have a barrier() call in it, which in turn
requires the calling function to be convergent.

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

7 years ago[ObjC] Don't warn on readwrite properties with custom setters that
Alex Lorenz [Fri, 6 Oct 2017 19:24:26 +0000 (19:24 +0000)]
[ObjC] Don't warn on readwrite properties with custom setters that
override readonly properties from protocols

rdar://34192541

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

7 years ago[refactor] add support for refactoring options
Alex Lorenz [Fri, 6 Oct 2017 18:12:29 +0000 (18:12 +0000)]
[refactor] add support for refactoring options

This commit adds initial support for refactoring options. One can now use
optional and required std::string options.

This commit also adds a NewNameOption for the local-rename refactoring action to
allow rename to work with custom names.

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

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

7 years ago[lit] Improve tool substitution in lit.
Zachary Turner [Fri, 6 Oct 2017 17:54:46 +0000 (17:54 +0000)]
[lit] Improve tool substitution in lit.

This addresses two sources of inconsistency in test configuration
files.

1. Substitution boundaries.  Previously you would specify a
   substitution, such as 'lli', and then additionally a set
   of characters that should fail to match before and after
   the tool.  This was used, for example, so that matches that
   are parts of full paths would not be replaced.  But not all
   tools did this, and those that did would often re-invent
   the set of characters themselves, leading to inconsistency.
   Now, every tool substitution defaults to using a sane set
   of reasonable defaults and you have to explicitly opt out
   of it.  This actually fixed a few latent bugs that were
   never being surfaced, but only on accident.

2. There was no standard way for the system to decide how to
   locate a tool.  Sometimes you have an explicit path, sometimes
   we would search for it and build up a path ourselves, and
   sometimes we would build up a full command line.  Furthermore,
   there was no standardized way to handle missing tools.  Do we
   warn, fail, ignore, etc?  All of this is now encapsulated in
   the ToolSubst class.  You either specify an exact command to
   run, or an instance of FindTool('<tool-name>') and everything
   else just works.  Furthermore, you can specify an action to
   take if the tool cannot be resolved.

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

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

7 years agoRun pyformat on lit code.
Zachary Turner [Fri, 6 Oct 2017 17:54:27 +0000 (17:54 +0000)]
Run pyformat on lit code.

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

7 years agoFor Windows, allow .exe extension in a test.
Paul Robinson [Fri, 6 Oct 2017 17:12:28 +0000 (17:12 +0000)]
For Windows, allow .exe extension in a test.

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

7 years ago[OPENMP] Do not capture local static variables.
Alexey Bataev [Fri, 6 Oct 2017 17:00:28 +0000 (17:00 +0000)]
[OPENMP] Do not capture local static variables.

Previously we may erroneously try to capture locally declared static
variables, which will lead to crash for target-based constructs.
Patch fixes this problem.

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

7 years agoSplit X86::BI__builtin_cpu_init handling into own function[NFC]
Erich Keane [Fri, 6 Oct 2017 16:40:45 +0000 (16:40 +0000)]
Split X86::BI__builtin_cpu_init handling into own function[NFC]

The Cpu Init functionality is required for the target
attribute, so this patch simply splits it out into its own
function, exactly like CpuIs and CpuSupports.

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

7 years ago[OPENMP] Capture references to global variables.
Alexey Bataev [Fri, 6 Oct 2017 16:17:25 +0000 (16:17 +0000)]
[OPENMP] Capture references to global variables.

In C++11 variable to global variables are considered as constant
expressions and these variables are not captured in the outlined
regions. Patch allows capturing of such variables in the OpenMP regions.

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

7 years agoFix one more check string after r315045.
Akira Hatanaka [Fri, 6 Oct 2017 08:19:31 +0000 (08:19 +0000)]
Fix one more check string after r315045.

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

7 years agoRefine generation of TBAA information in clang
Ivan A. Kosarev [Fri, 6 Oct 2017 08:17:48 +0000 (08:17 +0000)]
Refine generation of TBAA information in clang

This patch is an attempt to clarify and simplify generation and
propagation of TBAA information. The idea is to pack all values
that describe a memory access, namely, base type, access type and
offset, into a single structure. This is supposed to make further
changes, such as adding support for unions and array members,
easier to prepare and review.

DecorateInstructionWithTBAA() is no more responsible for
converting types to tags. These implicit conversions not only
complicate reading the code, but also suggest assigning scalar
access tags while we generally prefer full-size struct-path tags.

TBAAPathTag is replaced with TBAAAccessInfo; the latter is now
the type of the keys of the cache map that translates access
descriptors to metadata nodes.

Fixed a bug with writing to a wrong map in
getTBAABaseTypeMetadata() (former getTBAAStructTypeInfo()).

We now check for valid base access types every time we
dereference a field. The original code only checks the top-level
base type. See isValidBaseType() / isTBAAPathStruct() calls.

Some entities have been renamed to sound more adequate and less
confusing/misleading in presence of path-aware TBAA information.

Now we do not lookup twice for the same cache entry in
getAccessTagInfo().

Refined relevant comments and descriptions.

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

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

7 years agoFix one more check string after r315045.
Akira Hatanaka [Fri, 6 Oct 2017 08:05:34 +0000 (08:05 +0000)]
Fix one more check string after r315045.

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

7 years agoFix check strings in test case and use llvm::to_string instead of
Akira Hatanaka [Fri, 6 Oct 2017 07:47:47 +0000 (07:47 +0000)]
Fix check strings in test case and use llvm::to_string instead of
std::to_string.

These changes were needed to fix bots that started failing after
r315045.

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

7 years ago[CodeGen] Emit a helper function for __builtin_os_log_format to reduce
Akira Hatanaka [Fri, 6 Oct 2017 07:12:46 +0000 (07:12 +0000)]
[CodeGen] Emit a helper function for __builtin_os_log_format to reduce
code size.

Currently clang expands a call to __builtin_os_log_format into a long
sequence of instructions at the call site, causing code size to
increase in some cases.

This commit attempts to reduce code size by emitting a helper function
that can be shared by calls to __builtin_os_log_format with similar
formats and arguments. The helper function has linkonce_odr linkage to
enable the linker to merge identical functions across translation units.
Attribute 'noinline' is attached to the helper function at -Oz so that
the inliner doesn't inline functions that can potentially be merged.

This commit also fixes a bug where the generated IR writes past the end
of the buffer when "%m" is the last specifier appearing in the format
string passed to __builtin_os_log_format.

Original patch by Duncan Exon Smith.

rdar://problem/34065973
rdar://problem/34196543

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

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

7 years ago[CMake] Add install-distribution-toolchain to stage2 target list
Chris Bieneman [Thu, 5 Oct 2017 22:48:34 +0000 (22:48 +0000)]
[CMake] Add install-distribution-toolchain to stage2 target list

This allows generating toolchains with just the distribution components instead of toolchains with everything.

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

7 years agoFor dllexport class templates, export specializations of member functions (PR34849)
Hans Wennborg [Thu, 5 Oct 2017 21:45:27 +0000 (21:45 +0000)]
For dllexport class templates, export specializations of member functions (PR34849)

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

7 years agoCleanup and generalize -shared-libasan.
Evgeniy Stepanov [Thu, 5 Oct 2017 20:14:00 +0000 (20:14 +0000)]
Cleanup and generalize -shared-libasan.

Summary:
* Rename -shared-libasan to -shared-libsan, keeping the old name as alias.
* Add -static-libsan for targets that default to shared.
* Remove an Android special case. It is now possible (but untested) to use static compiler-rt libraries there.
* Support libclang_rt.ubsan_standalone as a shared library.

Unlike GCC, this change applies -shared-libsan / -static-libsan to all sanitizers.
I don't see a point in multiple flags like -shared-libubsan, considering that most sanitizers
are not compatible with each other, and each link has basically a single shared/static choice.

Reviewers: vitalybuka, kcc, rsmith

Subscribers: srhines, cfe-commits

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

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

7 years agoFix two-phase name lookup for non-dependent overloaded operators.
Richard Smith [Thu, 5 Oct 2017 19:35:51 +0000 (19:35 +0000)]
Fix two-phase name lookup for non-dependent overloaded operators.

If we resolve an overloaded operator call to a specific function during
template definition, don't perform ADL during template instantiation.
Doing so finds overloads that we're not supposed to find.

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

7 years ago[OPENMP] Fix mapping|privatization of implicitly captured variables.
Alexey Bataev [Thu, 5 Oct 2017 17:51:39 +0000 (17:51 +0000)]
[OPENMP] Fix mapping|privatization of implicitly captured variables.

If the `defaultmap(tofrom:scalar)` clause is specified, the scalars must
be mapped with 'tofrom' modifiers, otherwise they must be captured as
firstprivates.

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

7 years ago[Analyzer Tests] Run static analyzer integration tests until the end,
George Karpenkov [Thu, 5 Oct 2017 17:32:06 +0000 (17:32 +0000)]
[Analyzer Tests] Run static analyzer integration tests until the end,

Do not stop at the first failure.

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

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

7 years ago[CodeGen] Unify generation of scalar and struct-path TBAA tags
Ivan A. Kosarev [Thu, 5 Oct 2017 11:08:17 +0000 (11:08 +0000)]
[CodeGen] Unify generation of scalar and struct-path TBAA tags

This patch makes it possible to produce access tags in a uniform
manner regardless whether the resulting tag will be a scalar or a
struct-path one. getAccessTagInfo() now takes care of the actual
translation of access descriptors to tags and can handle all
kinds of accesses. Facilities that specific to scalar accesses
are eliminated.

Some more details:
* DecorateInstructionWithTBAA() is not responsible for conversion
  of types to access tags anymore. Instead, it takes an access
  descriptor (TBAAAccessInfo) and generates corresponding access
  tag from it.
* getTBAAInfoForVTablePtr() reworked to
  getTBAAVTablePtrAccessInfo() that now returns the
  virtual-pointer access descriptor and not the virtual-point
  type metadata.
* Added function getTBAAMayAliasAccessInfo() that returns the
  descriptor for may-alias accesses.
* getTBAAStructTagInfo() renamed to getTBAAAccessTagInfo() as now
  it is the only way to generate access tag by a given access
  descriptor. It is capable of producing both scalar and
  struct-path tags, depending on options and availability of the
  base access type. getTBAAScalarTagInfo() and its cache
  ScalarTagMetadataCache are eliminated.
* Now that we do not need to care about whether the resulting
  access tag should be a scalar or struct-path one,
  getTBAAStructTypeInfo() is renamed to getBaseTypeInfo().
* Added function getTBAAAccessInfo() that constructs access
  descriptor by a given QualType access type.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

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

7 years agoRevert r314977 "[CodeGen] Unify generation of scalar and struct-path TBAA tags"
Ivan A. Kosarev [Thu, 5 Oct 2017 11:05:43 +0000 (11:05 +0000)]
Revert r314977 "[CodeGen] Unify generation of scalar and struct-path TBAA tags"

D37826 has been mistakenly committed where it should be the patch from D38503.

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

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

7 years ago[CodeGen] Unify generation of scalar and struct-path TBAA tags
Ivan A. Kosarev [Thu, 5 Oct 2017 10:47:51 +0000 (10:47 +0000)]
[CodeGen] Unify generation of scalar and struct-path TBAA tags

This patch makes it possible to produce access tags in a uniform
manner regardless whether the resulting tag will be a scalar or a
struct-path one. getAccessTagInfo() now takes care of the actual
translation of access descriptors to tags and can handle all
kinds of accesses. Facilities that specific to scalar accesses
are eliminated.

Some more details:
* DecorateInstructionWithTBAA() is not responsible for conversion
  of types to access tags anymore. Instead, it takes an access
  descriptor (TBAAAccessInfo) and generates corresponding access
  tag from it.
* getTBAAInfoForVTablePtr() reworked to
  getTBAAVTablePtrAccessInfo() that now returns the
  virtual-pointer access descriptor and not the virtual-point
  type metadata.
* Added function getTBAAMayAliasAccessInfo() that returns the
  descriptor for may-alias accesses.
* getTBAAStructTagInfo() renamed to getTBAAAccessTagInfo() as now
  it is the only way to generate access tag by a given access
  descriptor. It is capable of producing both scalar and
  struct-path tags, depending on options and availability of the
  base access type. getTBAAScalarTagInfo() and its cache
  ScalarTagMetadataCache are eliminated.
* Now that we do not need to care about whether the resulting
  access tag should be a scalar or struct-path one,
  getTBAAStructTypeInfo() is renamed to getBaseTypeInfo().
* Added function getTBAAAccessInfo() that constructs access
  descriptor by a given QualType access type.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

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

7 years ago[analyzer] Fix leak false positives on stuff put in C++/ObjC initializer lists.
Artem Dergachev [Thu, 5 Oct 2017 08:43:32 +0000 (08:43 +0000)]
[analyzer] Fix leak false positives on stuff put in C++/ObjC initializer lists.

The analyzer now realizes that C++ std::initializer_list objects and
Objective-C boxed structure/array/dictionary expressions can potentially
maintain a reference to the objects that were put into them. This avoids
false memory leak posivites and a few other issues.

This is a conservative behavior; for now, we do not model what actually happens
to the objects after being passed into such initializer lists.

rdar://problem/32918288
Differential Revision: https://reviews.llvm.org/D35216

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

7 years agoEnabling new pass manager in LTO (and thinLTO) link step.
Sean Fertile [Thu, 5 Oct 2017 01:50:48 +0000 (01:50 +0000)]
Enabling new pass manager in LTO (and thinLTO) link step.

Passes 'new-pass-manager' option to the linker plugin when the new pass
manager is enabled.

Patch by Graham Yiu.

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

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

7 years ago[Analyzer Tests] Fix misc bugs in analyzer reference results updater.
George Karpenkov [Thu, 5 Oct 2017 01:02:20 +0000 (01:02 +0000)]
[Analyzer Tests] Fix misc bugs in analyzer reference results updater.

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

7 years agoAdd testcase for r314956:
Richard Smith [Thu, 5 Oct 2017 00:48:18 +0000 (00:48 +0000)]
Add testcase for r314956:

PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.

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