]> granicus.if.org Git - clang/log
clang
5 years agoImplement the TreeStructure interface through the TextNodeDumper
Stephen Kelly [Tue, 8 Jan 2019 22:32:48 +0000 (22:32 +0000)]
Implement the TreeStructure interface through the TextNodeDumper

Summary:
This way, when the generic ASTTraverser is extracted from ASTDumper,
there can't be any problem related to ordering of class members, a
concern that was raised in https://reviews.llvm.org/D55337.

This will also preserve the property that the generic traverser does not
enforce any coupling between the NodeDumper and the TreeStructure.

 https://godbolt.org/z/PEtT1_

Reviewers: aaron.ballman, erichkeane

Subscribers: cfe-commits

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

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

5 years agoAndroid is not GNU, so don't claim that it is.
Dan Albert [Tue, 8 Jan 2019 22:31:19 +0000 (22:31 +0000)]
Android is not GNU, so don't claim that it is.

Reviewers: pirama, srhines

Reviewed By: srhines

Subscribers: kristina, cfe-commits

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

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

5 years ago[Sema] Teach Clang that aligned allocation is not supported with macosx10.13
Louis Dionne [Tue, 8 Jan 2019 20:26:56 +0000 (20:26 +0000)]
[Sema] Teach Clang that aligned allocation is not supported with macosx10.13

Summary:
r306722 added diagnostics when aligned allocation is used with deployment
targets that do not support it, but the first macosx supporting aligned
allocation was incorrectly set to 10.13. In reality, the dylib shipped
with macosx10.13 does not support aligned allocation, but the dylib
shipped with macosx10.14 does.

Reviewers: ahatanak

Subscribers: christof, jkorous, dexonsmith, cfe-commits

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

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

5 years agoFix clang for r350647: Missed a function rename
Philip Pfaffe [Tue, 8 Jan 2019 20:00:55 +0000 (20:00 +0000)]
Fix clang for r350647: Missed a function rename

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

5 years agoFix opencl test broken on windows by r350643.
Erich Keane [Tue, 8 Jan 2019 19:10:43 +0000 (19:10 +0000)]
Fix opencl test broken on windows by r350643.

Windows doesn't allow common with alignment >32 bits, so these tests
were broken in windows mode.  This patch makes 'common' optional in
these cases.

Change-Id: I4d5fdd07ecdafc3570ef9b09cd816c2e5e4ed15e

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

5 years ago[NFC] Don't over-eagerly check block alignment
JF Bastien [Tue, 8 Jan 2019 18:51:38 +0000 (18:51 +0000)]
[NFC] Don't over-eagerly check block alignment

Alignment of __block isn't relevant to this test, remove its checking.

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

5 years agoLimit COFF 'common' emission to <=32 alignment types.
Erich Keane [Tue, 8 Jan 2019 18:44:22 +0000 (18:44 +0000)]
Limit COFF 'common' emission to <=32 alignment types.

As reported in PR33035, LLVM crashes if given a common object with an
alignment of greater than 32 bits. This is because the COFF file format
does not support these alignments, so emitting them is broken anyway.

This patch changes any global definitions greater than 32 bit alignment
to no longer be in 'common'.

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

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

Change-Id: I48609289753b7f3b58c5e2bc1712756750fbd45a

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

5 years ago__has_feature(pragma_clang_attribute_namespaces) should be __has_extension
Erik Pilkington [Tue, 8 Jan 2019 18:24:39 +0000 (18:24 +0000)]
__has_feature(pragma_clang_attribute_namespaces) should be __has_extension

Thanks to Richard Smith for pointing this out.

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

5 years agoRename DIFlagFixedEnum to DIFlagEnumClass. NFC
Paul Robinson [Tue, 8 Jan 2019 17:52:29 +0000 (17:52 +0000)]
Rename DIFlagFixedEnum to DIFlagEnumClass. NFC

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

5 years agoRevert "Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor"
Erik Pilkington [Tue, 8 Jan 2019 17:04:38 +0000 (17:04 +0000)]
Revert "Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor"

This reverts commit r350585. There was some late post-commit review
on phab.

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

5 years agoFix use-after-free bug in Tooling.
Alexander Kornienko [Tue, 8 Jan 2019 16:55:13 +0000 (16:55 +0000)]
Fix use-after-free bug in Tooling.

Summary:
`buildASTFromCodeWithArgs()` was creating a memory buffer referencing a
stack-allocated string.  This diff changes the implementation to copy the code
string into the memory buffer so that said buffer owns the memory.

Patch by Yitzhak Mandelbaum.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, EricWF

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

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

5 years agoDon't emit DW_AT_enum_class unless it's actually an 'enum class'.
Paul Robinson [Tue, 8 Jan 2019 16:28:11 +0000 (16:28 +0000)]
Don't emit DW_AT_enum_class unless it's actually an 'enum class'.

Finishes off the functional part of PR36168.

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

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

5 years ago[AST][NFC] Pack CXXScalarValueInitExpr
Bruno Ricci [Tue, 8 Jan 2019 16:08:54 +0000 (16:08 +0000)]
[AST][NFC] Pack CXXScalarValueInitExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXScalarValueInitExpr. NFC.

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

5 years ago[OPENMP]Fix PR40191: Do not allow orphaned cancellation constructs.
Alexey Bataev [Tue, 8 Jan 2019 15:53:42 +0000 (15:53 +0000)]
[OPENMP]Fix PR40191: Do not allow orphaned cancellation constructs.

Prohibited use of the orphaned cancellation directives.

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

5 years ago[AST][NFC] Pack CXXNoexceptExpr and SubstNonTypeTemplateParmExpr
Bruno Ricci [Tue, 8 Jan 2019 14:44:34 +0000 (14:44 +0000)]
[AST][NFC] Pack CXXNoexceptExpr and SubstNonTypeTemplateParmExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXNoexceptExpr/SubstNonTypeTemplateParmExpr.

Use this opportunity to run clang-format on these two classes and
fix some style issues. NFC overall.

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

5 years ago[AST] Pack CXXDependentScopeMemberExpr
Bruno Ricci [Tue, 8 Jan 2019 14:17:00 +0000 (14:17 +0000)]
[AST] Pack CXXDependentScopeMemberExpr

Use the newly available space in the bit-fields of Stmt. Additionally store
FirstQualifierFoundInScope as a trailing object since it is most of the time
null (non-null for 2 of the 35446 CXXDependentScopeMemberExpr when parsing
all of Boost).

It would be possible to move the data for the nested-name-specifier to a
trailing object too to save another 2 pointers, however doing so did actually
regress the time taken to parse all of Boost slightly.

This saves 8 bytes + 1 pointer per CXXDependentScopeMemberExpr in the vast
majority of cases.

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

Reviewed By: rjmccall

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

5 years ago[Sema] Diagnose array access preceding the array bounds even when the base type is...
Bruno Ricci [Tue, 8 Jan 2019 13:52:54 +0000 (13:52 +0000)]
[Sema] Diagnose array access preceding the array bounds even when the base type is incomplete.

When the type of the base expression after IgnoreParenCasts is incomplete,
it is still possible to diagnose an array access which precedes the array
bounds.

This is a follow-up on D55862 which added an early return when the type of
the base expression after IgnoreParenCasts was incomplete.

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

Reviewed By: efriedma

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

5 years ago[X86] Add shift-by-immediate tests for non-immediate/out-of-range values
Simon Pilgrim [Tue, 8 Jan 2019 12:59:15 +0000 (12:59 +0000)]
[X86] Add shift-by-immediate tests for non-immediate/out-of-range values

As noted on PR40203, for gcc compatibility we need to support non-immediate values in the 'slli/srli/srai' shift by immediate vector intrinsics.

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

5 years ago[ASTMatchers] Improve assert message for broken parent map.
Sam McCall [Tue, 8 Jan 2019 07:29:46 +0000 (07:29 +0000)]
[ASTMatchers] Improve assert message for broken parent map.

Summary:
This assert catches places where the AST (as seen by RecursiveASTVisitor)
becomes disconnected due to incomplete traversal.
Making it print the actual parent-less node is a lot more helpful - it's
possible to work out which part of the tree wasn't traversed.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

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

5 years agoSplit -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor
Erik Pilkington [Tue, 8 Jan 2019 00:21:05 +0000 (00:21 +0000)]
Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor

-Wdelete-non-virtual-dtor previously controlled two diagnostics: 1)
calling a non-virtual dtor from an abstract class, and 2) calling a
non-virtual dtor from a polymorphic class. 1) is a lot more severe
than 2), since 1) is a guaranteed crash, but 2) is just "code smell".
Previously, projects compiled with -Wall -Wno-delete-non-virtual-dtor,
which is somewhat reasonable, silently crashed on 1).

rdar://40380564

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

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

5 years agoNFC: Replace asserts with if() in SourceLocation accessors
Stephen Kelly [Mon, 7 Jan 2019 21:57:30 +0000 (21:57 +0000)]
NFC: Replace asserts with if() in SourceLocation accessors

Summary:
Nowhere else in the AST classes assert on these kinds of accessors.

This way, we can call the accessors and check the validity of the result
instead of externally duplicating the conditions.  This generality will
make it possible to introspect instances for source locations:

 http://ec2-18-191-7-3.us-east-2.compute.amazonaws.com:10240/z/iiaWhw

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoAdd a __has_feature check for namespaces on #pragma clang attribute.
Erik Pilkington [Mon, 7 Jan 2019 21:54:00 +0000 (21:54 +0000)]
Add a __has_feature check for namespaces on #pragma clang attribute.

Support for this was added in r349845.

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

5 years ago[OPENMP]Add call to __kmpc_push_target_tripcount() function.
Alexey Bataev [Mon, 7 Jan 2019 21:30:43 +0000 (21:30 +0000)]
[OPENMP]Add call to __kmpc_push_target_tripcount() function.

Each we create the target regions with the teams distribute inner
region, we can better estimate number of the teams required to execute
the target region. Function __kmpc_push_target_tripcount() is used for
purpose, which accepts device_id and the number of the iterations,
performed by the associated loop.

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

5 years agoRecommit r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."
Craig Topper [Mon, 7 Jan 2019 21:00:41 +0000 (21:00 +0000)]
Recommit r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."

The MSVC limit hit in AutoUpgrade.cpp has been worked around for now.

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

5 years agoRevert r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."
Craig Topper [Mon, 7 Jan 2019 19:39:25 +0000 (19:39 +0000)]
Revert r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."

Had to revert the LLVM patch this depends on to fix a MSVC compiler limit in AutoUpgrade.cpp

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

5 years ago[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins.
Craig Topper [Mon, 7 Jan 2019 19:10:22 +0000 (19:10 +0000)]
[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins.

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

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

5 years ago[OPENMP][NVPTX]Reduce number of barriers in reductions.
Alexey Bataev [Mon, 7 Jan 2019 15:45:09 +0000 (15:45 +0000)]
[OPENMP][NVPTX]Reduce number of barriers in reductions.

After the fix for the syncthreads we don't need to generate extra
barriers for the parallel reductions.

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

5 years ago[Sema] Fix unused variable warning in Release builds
Benjamin Kramer [Mon, 7 Jan 2019 15:22:08 +0000 (15:22 +0000)]
[Sema] Fix unused variable warning in Release builds

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

5 years ago[analyzer] Pass the correct loc Expr from VisitIncDecOp to evalStore
Rafael Stahl [Mon, 7 Jan 2019 15:07:01 +0000 (15:07 +0000)]
[analyzer] Pass the correct loc Expr from VisitIncDecOp to evalStore

Summary: The LocationE parameter of evalStore is documented as "The location expression that is stored to". When storing from an increment / decrement operator this was not satisfied. In user code this causes an inconsistency between the SVal and Stmt parameters of checkLocation.

Reviewers: NoQ, dcoughlin, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

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

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

5 years ago[AST] Store some data of CXXNewExpr as trailing objects
Bruno Ricci [Mon, 7 Jan 2019 15:04:45 +0000 (15:04 +0000)]
[AST] Store some data of CXXNewExpr as trailing objects

Store the optional array size expression, optional initialization expression
and optional placement new arguments in a trailing array. Additionally store
the range for the parenthesized type-id in a trailing object if needed since
in the vast majority of cases the type is not parenthesized (not a single new
expression in the translation unit of SemaDecl.cpp has a parenthesized type-id).

This saves 2 pointers per CXXNewExpr in all cases, and 2 pointers + 8 bytes
per CXXNewExpr in the common case where the type is not parenthesized.

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

Reviewed By: rjmccall

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

5 years ago[AST][NFC] Pack DependentScopeDeclRefExpr and CXXUnresolvedConstructExpr
Bruno Ricci [Mon, 7 Jan 2019 14:27:04 +0000 (14:27 +0000)]
[AST][NFC] Pack DependentScopeDeclRefExpr and CXXUnresolvedConstructExpr

Use the newly available space in the bit-fields of Stmt.
This saves 1 pointer per DependentScopeDeclRefExpr/CXXUnresolvedConstructExpr.

Additionally rename "TypeSourceInfo *Type;" to "TypeSourceInfo *TSI;"
as was done in D56022 (r350003) (but this is an internal detail anyway),
and clang-format both classes. NFC.

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

5 years ago[clang] Add AST matcher for initializer list members
Hyrum Wright [Mon, 7 Jan 2019 14:14:36 +0000 (14:14 +0000)]
[clang] Add AST matcher for initializer list members

Summary:
Much like hasArg for various call expressions, this allows LibTooling users to
match against a member of an initializer list.

This is currently being used as part of the abseil-duration-scale clang-tidy
check.

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

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

5 years ago[CTU] Make loadExternalAST return with non nullptr on success
Gabor Marton [Mon, 7 Jan 2019 14:05:19 +0000 (14:05 +0000)]
[CTU] Make loadExternalAST return with non nullptr on success

Summary:
In loadExternalAST we return with either an error or with a valid
ASTUnit pointer which should not be a nullptr.
This prevents in the call site any superfluous check for being a nullptr.

Reviewers: xazax.hun, a_sidorin, Szelethus, balazske

Subscribers: rnkovacs, dkrupp, gamesh411, cfe-commits

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

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

5 years ago[AST][NFC] Pack OpaqueValueExpr
Bruno Ricci [Mon, 7 Jan 2019 13:39:26 +0000 (13:39 +0000)]
[AST][NFC] Pack OpaqueValueExpr

Use the newly available space in the bit-fields of Stmt.
This saves 1 pointer per OpaqueValueExpr. NFC.

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

5 years agoclang-format: [JS] support goog.requireType.
Martin Probst [Mon, 7 Jan 2019 13:12:50 +0000 (13:12 +0000)]
clang-format: [JS] support goog.requireType.

Summary:
It's a new primitive for importing symbols, and should be treated like
the (previously handled) `goog.require` and `goog.forwardDeclare`.

Reviewers: krasimir

Subscribers: cfe-commits

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

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

5 years ago[X86] Update VBMI2 vshld/vshrd tests to use an immediate that doesn't require a modulo.
Craig Topper [Mon, 7 Jan 2019 06:01:58 +0000 (06:01 +0000)]
[X86] Update VBMI2 vshld/vshrd tests to use an immediate that doesn't require a modulo.

Planning to replace these with funnel shift intrinsics which would mask out the extra bits. This will help minimize test diffs.

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

5 years agoDR674, PR38883, PR40238: Qualified friend lookup should look for a
Richard Smith [Mon, 7 Jan 2019 06:00:46 +0000 (06:00 +0000)]
DR674, PR38883, PR40238: Qualified friend lookup should look for a
template specialization if there is no matching non-template function.

This exposed a couple of related bugs:
 - we would sometimes substitute into a friend template instead of a
   suitable non-friend declaration; this would now crash because we'd
   decide the specialization of the friend is a redeclaration of itself
 - ADL failed to properly handle the case where an invisible local
   extern declaration redeclares an invisible friend

Both are fixed herein: in particular, we now never make invisible
friends or local extern declarations visible to name lookup unless
they are the only declaration of the entity. (We already mostly did
this for local extern declarations.)

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

5 years ago[SemaCXX] Fix ICE for unexpanded parameter pack
Brian Gesiak [Mon, 7 Jan 2019 03:25:59 +0000 (03:25 +0000)]
[SemaCXX] Fix ICE for unexpanded parameter pack

Summary:
The documentation for RecursiveASTVisitor::TraverseDecl states that the
Decl being traversed may be null. In fact, this is the case when a
CXXCatchStmt with no exception decl is traversed. Because the visitor
for diagnosing unexpanded parameter packs does not check for null, it
ends up crashing when it attempts to call the Decl::isParameterPack
method on a null Decl pointer.

Add a null check to prevent an ICE, and a test case that would crash
otherwise. Also, because the test requires C++ exceptions and C++14,
change the test parameters for the entire test file. (Alternatively, I
thought about adding a new test file, but went with this approach for my
own convenience.)

Co-authored-by: Andreas Molzer <andreas.molzer@gmx.de>
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

5 years agoFix bug in test found by the diagnostic added in r350340.
Nico Weber [Sun, 6 Jan 2019 15:57:18 +0000 (15:57 +0000)]
Fix bug in test found by the diagnostic added in r350340.

I meant to commit this change in 350341 but failed to do so (since it's
in test/CodeGenCXX, not in test/Frontend).

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

5 years ago[CMake] Use hidden visibility for static libc++ in Fuchsia
Petr Hosek [Sun, 6 Jan 2019 08:23:56 +0000 (08:23 +0000)]
[CMake] Use hidden visibility for static libc++ in Fuchsia

This is enables the use of libc++ in contexts such as device drivers.

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

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

5 years agoHave MSVC Visualizer for DeducedTemplateSpecializationType show both the original...
Mike Spertus [Sun, 6 Jan 2019 04:58:48 +0000 (04:58 +0000)]
Have MSVC Visualizer for DeducedTemplateSpecializationType show both the original template and deduced specialization

Now appears in the Autos window something like

- MyType DeducedTemplateSpecializationType  {struct Y<int>}
|- Template template<typename T> struct Y;
|- Deduced As struct Y<int>
|- isDeduced true bool
|- TypeClass DeducedTemplateSpecialization (36)
|- Flags No TypeBits set beyond TypeClass
|- Canonical RecordType  {struct Y<int>}

Also changed QualType visualization to auto-expand the BaseType

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

5 years ago[CMake][Fuchsia] Enable build ID, relaxations for first stage
Petr Hosek [Sun, 6 Jan 2019 04:14:51 +0000 (04:14 +0000)]
[CMake][Fuchsia] Enable build ID, relaxations for first stage

We want these to be used for the second stage compiler as well.

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

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

5 years agoRevert "[CMake][Fuchsia] Enable experimental new pass manager by default"
Petr Hosek [Sat, 5 Jan 2019 23:45:31 +0000 (23:45 +0000)]
Revert "[CMake][Fuchsia] Enable experimental new pass manager by default"

This reverts commit r350461 as it causes many of the Clang tests to fail.

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

5 years agoFix MSVC Visualization for TemplateTypeParmType and TemplateTypeParmDecl
Mike Spertus [Sat, 5 Jan 2019 23:15:30 +0000 (23:15 +0000)]
Fix MSVC Visualization for TemplateTypeParmType and TemplateTypeParmDecl

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

5 years agoCodeGen: fix autolink emission on ELF
Saleem Abdulrasool [Sat, 5 Jan 2019 19:27:12 +0000 (19:27 +0000)]
CodeGen: fix autolink emission on ELF

The autolinking extension for ELF uses a slightly different format for
encoding the autolink information compared to COFF and MachO.  Account
for this in the CGM to ensure that we do not assert when emitting
assembly or an object file.

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

5 years agoCodeGen: switch iteration to range based for loop (NFC)
Saleem Abdulrasool [Sat, 5 Jan 2019 18:39:32 +0000 (18:39 +0000)]
CodeGen: switch iteration to range based for loop (NFC)

Change a loop to range based instead while working on cleaning up some
modules autolinking issues on Linux.  NFC.

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

5 years agoImprove MSVC type visualizations
Mike Spertus [Sat, 5 Jan 2019 17:01:34 +0000 (17:01 +0000)]
Improve MSVC type visualizations

Display TypeBits in a single line.
Fix bit rot in template visualizations
Rudimentary support for deduced types

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

5 years ago[python] Make the collections import future-proof
Serge Guelton [Sat, 5 Jan 2019 12:07:36 +0000 (12:07 +0000)]
[python] Make the collections import future-proof

On Python 3.7 the old code raises a warning:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
     class ArgumentsIterator(collections.Sequence):

On Python 3.8 it wouldn't work anymore.

Commited on behalf of Jakub Stasiak.

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

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

5 years ago[CMake][Fuchsia] Enable experimental new pass manager by default
Petr Hosek [Sat, 5 Jan 2019 07:57:53 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable experimental new pass manager by default

This change enableds experimental new pass manager.

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

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

5 years ago[CMake][Fuchsia] Enable x86 relaxation by default
Petr Hosek [Sat, 5 Jan 2019 07:57:46 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable x86 relaxation by default

This enables x86 relaxation by default. This depends on a linker new
enough to support the new reloc types but since we default to lld we
don't worry about host system linkers that might be too old to support
the new reloc types.

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

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

5 years ago[CMake][Fuchsia] Enable --build-id linker flag by default
Petr Hosek [Sat, 5 Jan 2019 07:57:38 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable --build-id linker flag by default

This enables passing --build-id to linker by default.

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

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

5 years agoLet new test from r350340 still pass even after r350451.
Nico Weber [Sat, 5 Jan 2019 01:19:14 +0000 (01:19 +0000)]
Let new test from r350340 still pass even after r350451.

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

5 years agoMove -add-plugin validation after -load was executed.
Nico Weber [Sat, 5 Jan 2019 01:10:20 +0000 (01:10 +0000)]
Move -add-plugin validation after -load was executed.

Moves the code added in r350340 around a bit, to hopefully make the existing
plugin tests pass when clang is built with examples enabled.

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

5 years ago[OpenMP] Refactor const restriction for linear
Joel E. Denny [Fri, 4 Jan 2019 22:12:13 +0000 (22:12 +0000)]
[OpenMP] Refactor const restriction for linear

As discussed in D56113, this patch refactors the implementation of the
const restriction for linear to reuse a function introduced by D56113.
A side effect is that, if a variable has mutable members, this
diagnostic is now skipped, and the diagnostic for the variable not
being an integer or pointer is reported instead.

Reviewed By: ABataev

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

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

5 years ago[OpenMP] Refactor const restriction for reductions
Joel E. Denny [Fri, 4 Jan 2019 22:11:56 +0000 (22:11 +0000)]
[OpenMP] Refactor const restriction for reductions

As discussed in D56113, this patch refactors the implementation of the
const restriction for reductions to reuse a function introduced by
D56113.  A side effect is that diagnostics sometimes now say
"variable" instead of "list item" when a list item is a variable.

Reviewed By: ABataev

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

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

5 years ago[OpenMP] Replace predetermined shared for const variable
Joel E. Denny [Fri, 4 Jan 2019 22:11:31 +0000 (22:11 +0000)]
[OpenMP] Replace predetermined shared for const variable

The following appears in OpenMP 3.1 sec. 2.9.1.1 as a predetermined
data-sharing attribute:

> Variables with const-qualified type having no mutable member are
> shared.

It does not appear in OpenmP 4.0, 4.5, or 5.0.  This patch removes the
implementation of that attribute when the requested OpenMP version is
greater than 3.1.

One effect of that removal is that `default(none)` affects const
variables without mutable members.

Also, without this patch, if a const variable without mutable members
was explicitly lastprivate or private, it was an error because it was
predetermined shared.  Now, clang instead complains that it's const
without mutable fields, which is a more intelligible diagnostic.  That
should be fine for all of the above versions because they all have
something like the following, which is quoted from OpenMP 5.0
sec. 2.19.3:

> A variable that is privatized must not have a const-qualified type
> unless it is of class type with a mutable member. This restriction does
> not apply to the firstprivate clause.

reduction and linear clauses already have separate checks for const
variables.  Future patches will merge the implementations.

Reviewed By: ABataev

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

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

5 years agoFix default-function-attr.c so that it works on Windows.
Peter Collingbourne [Fri, 4 Jan 2019 20:51:54 +0000 (20:51 +0000)]
Fix default-function-attr.c so that it works on Windows.

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

5 years agohwasan: Implement lazy thread initialization for the interceptor ABI.
Peter Collingbourne [Fri, 4 Jan 2019 19:27:04 +0000 (19:27 +0000)]
hwasan: Implement lazy thread initialization for the interceptor ABI.

The problem is similar to D55986 but for threads: a process with the
interceptor hwasan library loaded might have some threads started by
instrumented libraries and some by uninstrumented libraries, and we
need to be able to run instrumented code on the latter.

The solution is to perform per-thread initialization lazily. If a
function needs to access shadow memory or add itself to the per-thread
ring buffer its prologue checks to see whether the value in the
sanitizer TLS slot is null, and if so it calls __hwasan_thread_enter
and reloads from the TLS slot. The runtime does the same thing if it
needs to access this data structure.

This change means that the code generator needs to know whether we
are targeting the interceptor runtime, since we don't want to pay
the cost of lazy initialization when targeting a platform with native
hwasan support. A flag -fsanitize-hwaddress-abi={interceptor,platform}
has been introduced for selecting the runtime ABI to target. The
default ABI is set to interceptor since it's assumed that it will
be more common that users will be compiling application code than
platform code.

Because we can no longer assume that the TLS slot is initialized,
the pthread_create interceptor is no longer necessary, so it has
been removed.

Ideally, lazy initialization should only cost one instruction in the
hot path, but at present the call may cause us to spill arguments
to the stack, which means more instructions in the hot path (or
theoretically in the cold path if the spills are moved with shrink
wrapping). With an appropriately chosen calling convention for
the per-thread initialization function (TODO) the hot path should
always need just one instruction and the cold path should need two
instructions with no spilling required.

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

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

5 years ago[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types
Aaron Enye Shi [Fri, 4 Jan 2019 19:09:20 +0000 (19:09 +0000)]
[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types

The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files.

Reviewers: yaxunl

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

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

5 years ago[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types
Aaron Enye Shi [Fri, 4 Jan 2019 19:05:41 +0000 (19:05 +0000)]
[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types

The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files.

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

5 years ago[ThinLTO] Clang changes to utilize new pass to handle chains of aliases
Teresa Johnson [Fri, 4 Jan 2019 19:05:01 +0000 (19:05 +0000)]
[ThinLTO] Clang changes to utilize new pass to handle chains of aliases

Summary:
As with NameAnonGlobals, invoke the new CanonicalizeAliases via clang
when using the new PM.

Depends on D54507.

Reviewers: pcc, davidxl

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, cfe-commits

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

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

5 years ago[ObjCARC] Add an new attribute, objc_externally_retained
Erik Pilkington [Fri, 4 Jan 2019 18:33:06 +0000 (18:33 +0000)]
[ObjCARC] Add an new attribute, objc_externally_retained

This attribute, called "objc_externally_retained", exposes clang's
notion of pseudo-__strong variables in ARC. Pseudo-strong variables
"borrow" their initializer, meaning that they don't retain/release
it, instead assuming that someone else is keeping their value alive.

If a function is annotated with this attribute, implicitly strong
parameters of that function aren't implicitly retained/released in
the function body, and are implicitly const. This is useful to expose
for performance reasons, most functions don't need the extra safety
of the retain/release, so programmers can opt out as needed.

This attribute can also apply to declarations of local variables,
with similar effect.

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

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

5 years ago[OPENMP][NVPTX]Use new functions from the runtime library.
Alexey Bataev [Fri, 4 Jan 2019 17:25:09 +0000 (17:25 +0000)]
[OPENMP][NVPTX]Use new functions from the runtime library.

Updated codegen to use the new functions from the runtime library.

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

5 years agoAdd two new pragmas for controlling software pipelining optimizations.
Aaron Ballman [Fri, 4 Jan 2019 17:20:00 +0000 (17:20 +0000)]
Add two new pragmas for controlling software pipelining optimizations.

This patch adds #pragma clang loop pipeline and #pragma clang loop pipeline_initiation_interval for debugging or reducing compile time purposes. It is possible to disable SWP for concrete loops to save compilation time or to find bugs by not doing SWP to certain loops. It is possible to set value of initiation interval to concrete number to save compilation time by not doing extra pipeliner passes or to check created schedule for specific initiation interval.

Patch by Alexey Lapshin.

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

5 years agoRefactor the way we handle diagnosing unused expression results.
Aaron Ballman [Fri, 4 Jan 2019 16:58:14 +0000 (16:58 +0000)]
Refactor the way we handle diagnosing unused expression results.

Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement.

This patch fixes PR39837.

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

5 years agoPrevent unreachable when checking invalid multiversion decls.
Erich Keane [Fri, 4 Jan 2019 15:24:06 +0000 (15:24 +0000)]
Prevent unreachable when checking invalid multiversion decls.

CPUSpecifc/CPUDispatch call resolution assumed that all declarations
that would be passed are valid, however this was an invalid assumption.
This patch deals with those situations by making the valid version take
priority.  Note that the checked ordering is arbitrary, since both are
replaced by calls to the resolver later.

Change-Id: I7ff2ec88c55a721d51bc1f39ea1a1fe242b4e45f

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

5 years ago[Basic] Extend DiagnosticEngine to store and format Qualifiers.
Anastasia Stulova [Fri, 4 Jan 2019 11:50:36 +0000 (11:50 +0000)]
[Basic] Extend DiagnosticEngine to store and format Qualifiers.

Qualifiers can now be streamed into the DiagnosticEngine using
regular << operator. If Qualifiers are empty 'unqualified' will
be printed in the diagnostic otherwise regular qual syntax is
used.

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

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

5 years agoAdopt SwiftABIInfo for WebAssembly.
Daniel Dunbar [Thu, 3 Jan 2019 23:24:50 +0000 (23:24 +0000)]
Adopt SwiftABIInfo for WebAssembly.

Summary:
 - This adopts SwiftABIInfo as the base class for WebAssemblyABIInfo, which is in keeping with what is done for other targets for which Swift is supported.

 - This is a minimal patch to unblock exploration of WASM support for Swift (https://bugs.swift.org/browse/SR-9307)

Reviewers: rjmccall, sunfish

Reviewed By: rjmccall

Subscribers: ahti, dschuff, sbc100, jgravelle-google, aheejin, cfe-commits

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

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

5 years agoFix MSVC visualizations for ActionResult and OpaquePtr
Mike Spertus [Thu, 3 Jan 2019 23:24:39 +0000 (23:24 +0000)]
Fix MSVC visualizations for ActionResult and OpaquePtr

Mainly just fixing buggy code. Also removed unnecessary visualizers
for specializations of OpaquePtr

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

5 years agoFix check-hwasan with LLVM_BUILD_EXTERNAL_COMPILER_RT=ON
Evgeniy Stepanov [Thu, 3 Jan 2019 22:50:45 +0000 (22:50 +0000)]
Fix check-hwasan with LLVM_BUILD_EXTERNAL_COMPILER_RT=ON

Add a forwarding target for check-hwasan in clang.

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

5 years ago[cmake] Fix monorepo + LLVM_BUILD_EXTERNAL_COMPILER_RT=ON.
Evgeniy Stepanov [Thu, 3 Jan 2019 22:41:10 +0000 (22:41 +0000)]
[cmake] Fix monorepo + LLVM_BUILD_EXTERNAL_COMPILER_RT=ON.

In cmake 3.10.2, if (${VARIABLE_NAME}) seems to always be false no
matter what documentation says (or maybe I just failed at reading).

Anyway, if (VARIABLE_NAME) seems to do what this code intended.

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

5 years agoValidate -add-plugin arguments.
Nico Weber [Thu, 3 Jan 2019 18:26:06 +0000 (18:26 +0000)]
Validate -add-plugin arguments.

-plugin already prints an error if the name of an unknown plugin is passed.
-add-plugin used to silently ignore that, now it errors too.

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

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

5 years agoMake -Wstring-plus-int warns even if when the result is not out of bounds
Arnaud Bienner [Thu, 3 Jan 2019 17:45:28 +0000 (17:45 +0000)]
Make -Wstring-plus-int warns even if when the result is not out of bounds

Summary: Patch by Arnaud Bienner

Reviewers: sylvestre.ledru, thakis, serge-sans-paille

Reviewed By: thakis

Subscribers: arphaman, dyung, anemet, llvm-commits, cfe-commits

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

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

5 years ago[OPENMP][NVPTX]Use __kmpc_barrier_simple_spmd(nullptr, 0) instead of
Alexey Bataev [Thu, 3 Jan 2019 16:25:35 +0000 (16:25 +0000)]
[OPENMP][NVPTX]Use __kmpc_barrier_simple_spmd(nullptr, 0) instead of
nvvm_barrier0.

Use runtime functions instead of the direct call to the nvvm intrinsics.
It allows to prevent some dangerous LLVM optimizations, that breaks the
code for the NVPTX target.

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

5 years agoPortable Python script across Python version
Serge Guelton [Thu, 3 Jan 2019 14:27:05 +0000 (14:27 +0000)]
Portable Python script across Python version

Get rid of Python version specific shebang.

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

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

5 years agoPortable Python script across Python version
Serge Guelton [Thu, 3 Jan 2019 14:26:56 +0000 (14:26 +0000)]
Portable Python script across Python version

StringIO is obsoleted in Python3, replaced by io.BytesIO or io.StringIO depending on the use.

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

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

5 years agoDiagnose an unused result from a call through a function pointer whose return type...
Aaron Ballman [Thu, 3 Jan 2019 14:24:31 +0000 (14:24 +0000)]
Diagnose an unused result from a call through a function pointer whose return type is marked [[nodiscard]].

When a function returns a type and that type was declared [[nodiscard]], we diagnose any unused results from that call as though the function were marked nodiscard. The same behavior should apply to calls through a function pointer.

This addresses PR31526.

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

5 years ago[NewPM] Port Msan
Philip Pfaffe [Thu, 3 Jan 2019 13:42:44 +0000 (13:42 +0000)]
[NewPM] Port Msan

Summary:
Keeping msan a function pass requires replacing the module level initialization:
That means, don't define a ctor function which calls __msan_init, instead just
declare the init function at the first access, and add that to the global ctors
list.

Changes:
- Pull the actual sanitizer and the wrapper pass apart.
- Add a newpm msan pass. The function pass inserts calls to runtime
  library functions, for which it inserts declarations as necessary.
- Update tests.

Caveats:
- There is one test that I dropped, because it specifically tested the
  definition of the ctor.

Reviewers: chandlerc, fedor.sergeev, leonardchan, vitalybuka

Subscribers: sdardis, nemanjai, javed.absar, hiraditya, kbarton, bollu, atanasyan, jsji

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

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

5 years agoFix incorrect column numbers in test from r350282.
Alex Lorenz [Thu, 3 Jan 2019 01:30:50 +0000 (01:30 +0000)]
Fix incorrect column numbers in test from r350282.

After the test was reformatted using clang-format the numbers became invalid.

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

5 years ago[libclang] CoroutineBody/Coreturn statements are UnexposedStmts and not Exprs
Alex Lorenz [Thu, 3 Jan 2019 01:13:33 +0000 (01:13 +0000)]
[libclang] CoroutineBody/Coreturn statements are UnexposedStmts and not Exprs

This change ensures that the libclang CXCursor represents the CoroutineBody
and the Coreturn statement using the appropriate CXCursor_UnexposedStmt kind
instead of CXCursor_UnexposedExpr. The problem with CXCursor_UnexposedExpr is
that the consumer functions assumed that CoroutineBody/Coreturn statements
were valid expressions and performed an invalid downcast to Expr causing
assertion failures or other crashes.

rdar://40204290

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

5 years agoMake test/Driver/darwin-sdk-version.c pass if the host triple is 32-bit
Nico Weber [Thu, 3 Jan 2019 00:17:02 +0000 (00:17 +0000)]
Make test/Driver/darwin-sdk-version.c pass if the host triple is 32-bit

For some reason, the cmake build on my macbook has
LLVM_HOST_TRIPLE:STRING=i386-apple-darwin16.7.0 .
test/Driver/darwin-sdk-version.c assumed that the host triple is 64-bit, so
make it resilient against 32-bit host triples.

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

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

5 years ago[OpenMP] Added support for explicit mapping of classes using 'this' pointer. Differen...
Patrick Lyster [Wed, 2 Jan 2019 19:28:48 +0000 (19:28 +0000)]
[OpenMP] Added support for explicit mapping of classes using 'this' pointer. Differential revision: https://reviews.llvm.org/D55982

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

5 years agoOnly convert objc messages to alloc to objc_alloc if the receiver is a class.
Pete Cooper [Wed, 2 Jan 2019 17:25:30 +0000 (17:25 +0000)]
Only convert objc messages to alloc to objc_alloc if the receiver is a class.

r348687 converted [Foo alloc] to objc_alloc(Foo).  However the objc runtime method only takes a Class, not an arbitrary pointer.

This makes sure we are messaging a class before we convert these messages.

rdar://problem/46943703

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

5 years ago[CMake][Fuchsia] Include check-lld in the list of bootstrap targets
Petr Hosek [Wed, 2 Jan 2019 05:11:57 +0000 (05:11 +0000)]
[CMake][Fuchsia] Include check-lld in the list of bootstrap targets

This allows running lld tests when doing 2-stage toolchain build.

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

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

5 years agoFix some typos in the clang doc.
Sylvestre Ledru [Tue, 1 Jan 2019 12:51:14 +0000 (12:51 +0000)]
Fix some typos in the clang doc.
Fixed with:
$ codespell -w ClangFormatStyleOptions.rst Toolchain.rst LanguageExtensions.rst ClangCommandLineReference.rst

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

5 years agoclang-format-diff: add an example with hg
Sylvestre Ledru [Tue, 1 Jan 2019 12:32:08 +0000 (12:32 +0000)]
clang-format-diff: add an example with hg

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

5 years agoMake clearer which clang::type subclasses have visualizers
Mike Spertus [Mon, 31 Dec 2018 23:01:34 +0000 (23:01 +0000)]
Make clearer which clang::type subclasses have visualizers

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

5 years agoDeclAccessPair visualizer should be expandable
Mike Spertus [Sun, 30 Dec 2018 20:22:37 +0000 (20:22 +0000)]
DeclAccessPair visualizer should be expandable

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

5 years ago[CodeGen] Replace '@' characters in block descriptors' symbol names with
Akira Hatanaka [Sat, 29 Dec 2018 17:28:30 +0000 (17:28 +0000)]
[CodeGen] Replace '@' characters in block descriptors' symbol names with
'\1'.

'@' can't be used in block descriptors' symbol names since it is
reserved on ELF platforms as a separator between symbol names and symbol
versions.

See the discussion here: https://reviews.llvm.org/D50783.

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

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

5 years agoAdd vtable anchor to classes.
Richard Trieu [Sat, 29 Dec 2018 02:02:30 +0000 (02:02 +0000)]
Add vtable anchor to classes.

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

5 years ago[objc-gnustep2] Fix a bug in category generation.
David Chisnall [Fri, 28 Dec 2018 17:44:54 +0000 (17:44 +0000)]
[objc-gnustep2] Fix a bug in category generation.

We were not emitting a protocol definition while generating the category
method list.  This was fine in most cases, because something else in the
library typically referenced any given protocol, but it caused linker
failures if the category was the only reference to a given protocol.

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

5 years ago[OPENMP]Fix processing of the clauses on target combined directives.
Alexey Bataev [Fri, 28 Dec 2018 17:27:32 +0000 (17:27 +0000)]
[OPENMP]Fix processing of the clauses on target combined directives.

For constants with the predefined data-sharing clauses we may had
troubles with the target combined directives. It may cause compiler
crash in some corner cases.

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

5 years ago[objc-gnustep] Fix a copy-and-paste error.
David Chisnall [Thu, 27 Dec 2018 14:44:36 +0000 (14:44 +0000)]
[objc-gnustep] Fix a copy-and-paste error.

We were emitting the null class symbol in the wrong section, which meant
that programs that contained no Objective-C classes would fail to link.

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

5 years ago[clang-cl] Treat inputs as C++ with /E, like MSVC
Reid Kleckner [Wed, 26 Dec 2018 21:04:08 +0000 (21:04 +0000)]
[clang-cl] Treat inputs as C++ with /E, like MSVC

midl invokes the compiler on .idl files with /E. Before this change, we
would treat unrecognized inputs as object files. Now we pre-process to
stdout as expected. I checked that MSVC defines __cplusplus when invoked
this way, so treating the input as C++ seems like the right thing to do.

After this change, I was able to run midl like this with clang-cl:
$ midl -cpp_cmd clang-cl.exe foo.idl

Things worked for the example IDL file in the Microsoft documentation,
but beyond that, I don't know if this will work well.

Fixes PR40140

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

5 years ago[MS] Mangle return adjusting thunks with the public access specifier
Reid Kleckner [Wed, 26 Dec 2018 20:07:52 +0000 (20:07 +0000)]
[MS] Mangle return adjusting thunks with the public access specifier

MSVC does this, so we should too.

Fixes PR40138

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

5 years agoIgnore ConstantExpr in IgnoreParens
Reid Kleckner [Wed, 26 Dec 2018 17:44:40 +0000 (17:44 +0000)]
Ignore ConstantExpr in IgnoreParens

Summary:
This moves it up from IgnoreParenImpCasts to IgnoreParens, so that more
helpers ignore it. For most clients, this ensures that these helpers
behave the same with and without C++17 enabled, which is what appears to
introduce these new expression nodes.

Fixes PR39881

Reviewers: void, rsmith

Subscribers: cfe-commits

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

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

5 years agoPass a concrete triple for two OpenMP tests that depend on TLS
Nico Weber [Wed, 26 Dec 2018 16:06:26 +0000 (16:06 +0000)]
Pass a concrete triple for two OpenMP tests that depend on TLS

Not all %itanium_abi_triple values support TLS. Makes
OpenMP/declare_reduction_codegen.cpp, OpenMP/parallel_copyin_codegen.cpp for
%itanium_abi_triples without TLS support.

Alternatively we could pass -fnoopenmp-use-tls and tweak some of the CHECK
lines, but this seems a bit simpler.

Fixes PR40156.

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

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

5 years ago[analyzer] [NFC] Clean up the mess of constructing argument effects in RetainCountChecker
George Karpenkov [Mon, 24 Dec 2018 18:45:18 +0000 (18:45 +0000)]
[analyzer] [NFC] Clean up the mess of constructing argument effects in RetainCountChecker

Previously, argument effects were stored in a method variable, which was
effectively global.
The global state was reset at each (hopefully) entrance point to the
summary construction,
and every function could modify it.

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

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

5 years ago[Driver] Disable -faddrsig on Gentoo by default
Michal Gorny [Sun, 23 Dec 2018 15:07:26 +0000 (15:07 +0000)]
[Driver] Disable -faddrsig on Gentoo by default

Gentoo supports combining clang toolchain with GNU binutils, and many
users actually do that.  As -faddrsig is not supported by GNU strip,
this results in a lot of warnings.  Disable it by default and let users
enable it explicitly if they want it; with the intent of reevaluating
when the underlying feature becomes standarized.

See also: https://bugs.gentoo.org/667854

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

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

5 years ago[Distro] Support detecting Gentoo
Michal Gorny [Sun, 23 Dec 2018 15:07:19 +0000 (15:07 +0000)]
[Distro] Support detecting Gentoo

Add support for distinguishing plain Gentoo distribution, and a unit
test for it.  This is going to be used to introduce distro-specific
customizations in the driver code; most notably, it is going to be used
to disable -faddrsig.

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

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