]> granicus.if.org Git - clang/log
clang
6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 years agoPR33924: Merge block-scope anonymous declarations if there are multiple definitions...
Richard Smith [Thu, 5 Oct 2017 00:47:24 +0000 (00:47 +0000)]
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@314956 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove PendingBody mechanism for function and ObjC method deserialization.
Richard Smith [Thu, 5 Oct 2017 00:43:38 +0000 (00:43 +0000)]
Remove PendingBody mechanism for function and ObjC method deserialization.

In its place, track on the canonical function declaration whether there is a
declaration with a body (and if so, which one). This brings function definition
handling in line with what we do in all other contexts, and is necessary to
allow us to merge declarations within multiple definitions of the same function
(eg, PR33924).

No functionality change intended.

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

6 years agoFix 'section' warning behavior with tentatively-defined values
Erich Keane [Wed, 4 Oct 2017 22:16:24 +0000 (22:16 +0000)]
Fix 'section' warning behavior with tentatively-defined values

As reported on cfe-commits, r314262 resulted in tentatively-defined
variables not being excluded for the warning.

Patch By: Elizabeth Andrews

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

6 years ago[OpenCL] Clean up and add missing fields for block struct
Yaxun Liu [Wed, 4 Oct 2017 20:32:17 +0000 (20:32 +0000)]
[OpenCL] Clean up and add missing fields for block struct

Currently block is translated to a structure equivalent to

struct Block {
  void *isa;
  int flags;
  int reserved;
  void *invoke;
  void *descriptor;
};
Except invoke, which is the pointer to the block invoke function,
all other fields are useless for OpenCL, which clutter the IR and
also waste memory since the block struct is passed to the block
invoke function as argument.

On the other hand, the size and alignment of the block struct is
not stored in the struct, which causes difficulty to implement
__enqueue_kernel as library function, since the library function
needs to know the size and alignment of the argument which needs
to be passed to the kernel.

This patch removes the useless fields from the block struct and adds
size and align fields. The equivalent block struct will become

struct Block {
  int size;
  int align;
  generic void *invoke;
 /* custom fields */
};
It also changes the pointer to the invoke function to be
a generic pointer since the address space of a function
may not be private on certain targets.

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

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

6 years ago[Hexagon] Move getHexagonTargetFeatures to Hexagon.cpp (NFC)
Sumanth Gundapaneni [Wed, 4 Oct 2017 19:09:29 +0000 (19:09 +0000)]
[Hexagon] Move getHexagonTargetFeatures to Hexagon.cpp (NFC)

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

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

6 years ago[analyzer] Fix autodetection of binding types.
Artem Dergachev [Wed, 4 Oct 2017 15:59:40 +0000 (15:59 +0000)]
[analyzer] Fix autodetection of binding types.

In ProgramState::getSVal(Location, Type) API which dereferences a pointer value,
when the optional Type parameter is not supplied and the Location is not typed,
type should have been guessed on a best-effort basis by inspecting the Location
more deeply. However, this never worked; the auto-detected type was instead
a pointer type to the correct type.

Fixed the issue and added various test cases to demonstrate which parts of the
analyzer were affected (uninitialized pointer argument checker, C++ trivial copy
modeling, Google test API modeling checker).

Additionally, autodetected void types are automatically replaced with char,
in order to simplify checker APIs. Which means that if the location is a void
pointer, getSVal() would read the first byte through this pointer
and return its symbolic value.

Fixes pr34305.

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

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

6 years ago[OpenMP] Initial implementation of teams distribute code generation
Carlo Bertolli [Wed, 4 Oct 2017 14:12:09 +0000 (14:12 +0000)]
[OpenMP] Initial implementation of teams distribute code generation

https://reviews.llvm.org/D38371

This patch implements codegen for the combined 'teams distribute" OpenMP pragma and adds regression tests for all its clauses.

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

6 years ago[test] Pass in fixed triple for openmp-offload.c
Jonas Hahnfeld [Wed, 4 Oct 2017 13:54:09 +0000 (13:54 +0000)]
[test] Pass in fixed triple for openmp-offload.c

This should fix the test on other architectures.

Related to: https://reviews.llvm.org/D38372

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

6 years ago[OpenMP] Fix passing of -m arguments correctly
Jonas Hahnfeld [Wed, 4 Oct 2017 13:32:59 +0000 (13:32 +0000)]
[OpenMP] Fix passing of -m arguments correctly

The recent fix in D38258 was wrong: getAuxTriple() only returns
non-null values for the CUDA toolchain. That is why the now added
test for PPC and X86 failed.

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

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

6 years agoFix assertion failure in thread safety analysis (PR34800).
Alexander Kornienko [Wed, 4 Oct 2017 10:24:36 +0000 (10:24 +0000)]
Fix assertion failure in thread safety analysis (PR34800).

Summary:
Fix an assertion failure (http://llvm.org/PR34800) and clean up unused code relevant to the fixed logic.

A bit of context: when `SExprBuilder::translateMemberExpr` is called on a member expression that involves a conversion operator, for example, `til::Project` constructor can't just call `getName()` on it, since the name is not a simple identifier. In order to handle this case I've introduced an optional string to print the member name to. I discovered that the other two `til::Project` constructors are not used, so it was better to delete them instead of ensuring they work correctly with the new logic.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years agoMove verbosity check for opt remarks to the diag handler.
Adam Nemet [Wed, 4 Oct 2017 04:25:31 +0000 (04:25 +0000)]
Move verbosity check for opt remarks to the diag handler.

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

6 years agoWe allow implicit function declarations as an extension in all C dialects. Remove...
Richard Smith [Wed, 4 Oct 2017 01:58:22 +0000 (01:58 +0000)]
We allow implicit function declarations as an extension in all C dialects. Remove OpenCL special case.

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

6 years agoPR34822: Fix a collection of related bugs with our handling of C89 implicit function...
Richard Smith [Wed, 4 Oct 2017 01:49:22 +0000 (01:49 +0000)]
PR34822: Fix a collection of related bugs with our handling of C89 implicit function declarations.

We were injecting the function into the wrong semantic context, resulting in it
failing to be registered as a global for redeclaration lookup. As a
consequence, we accepted invalid code since r310616.

Fixing that resulted in the "out-of-scope declaration" diagnostic firing a lot
more often. It turned out that warning codepath was non-conforming, because it
did not cause us to inject the implicitly-declared function into the enclosing
block scope. We now only warn if the type of the out-of-scope declaration
doesn't match the type of an implicitly-declared function; in all other cases,
we produce the normal warning for an implicitly-declared function.

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

6 years ago[ExprConstant] Allow constexpr ctor to modify non static data members
Erik Pilkington [Wed, 4 Oct 2017 00:18:55 +0000 (00:18 +0000)]
[ExprConstant] Allow constexpr ctor to modify non static data members

Fixes PR19741.

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

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

6 years ago[Analyzer] Re-apply r314820 with a fix for StringRef lifetime.
George Karpenkov [Tue, 3 Oct 2017 23:15:35 +0000 (23:15 +0000)]
[Analyzer] Re-apply r314820 with a fix for StringRef lifetime.

Fixes the test failure: temporary is now bound to std::string, tests
fully pass on Linux.

This reverts commit b36ee0924038e1d95ea74230c62d46e05f80587e.

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

6 years ago[CMake] Minor updates to Apple CMake caches
Chris Bieneman [Tue, 3 Oct 2017 21:59:53 +0000 (21:59 +0000)]
[CMake] Minor updates to Apple CMake caches

* Turn off embedded compiler-rt builds in stage1
* Support generating Xcode toolchains from Stage2 build configurations

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

6 years agoSuppress -Wmissing-braces warning when aggregate-initializing a struct with a single...
Richard Smith [Tue, 3 Oct 2017 20:36:00 +0000 (20:36 +0000)]
Suppress -Wmissing-braces warning when aggregate-initializing a struct with a single field that is itself an aggregate.

In C++, such initialization of std::array<T, N> types is guaranteed to work by
the standard, is completely idiomatic, and the "suggested" alternative from
Clang was technically invalid.

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

6 years ago[OPENMP] Allow use of declare target directive inside struct
Alexey Bataev [Tue, 3 Oct 2017 20:00:00 +0000 (20:00 +0000)]
[OPENMP] Allow use of declare target directive inside struct
declaration.

Patch allows using of the `#pragma omp declare target`| `#pragma omp end
declare target` directives inside the structures if we need to mark as
declare target only some static members.

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

6 years agoRevert r314820 "[Analyzer] More granular special casing in RetainCountChecker"
Tim Shen [Tue, 3 Oct 2017 19:39:02 +0000 (19:39 +0000)]
Revert r314820 "[Analyzer] More granular special casing in RetainCountChecker"

The test retain-release.m fails with this patch.

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

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