]> granicus.if.org Git - clang/log
clang
5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Fri, 7 Dec 2018 14:57:07 +0000 (14:57 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for various statements in C++ that are not covered by C.

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

5 years agoRevert "Multiversioning- Ensure all MV functions are emitted."
Erich Keane [Fri, 7 Dec 2018 14:56:50 +0000 (14:56 +0000)]
Revert "Multiversioning- Ensure all MV functions are emitted."

This reverts commit 65df29f9318ac13a633c0ce13b2b0bccf06e79ca.

AS suggested by @rsmith here: https://reviews.llvm.org/rL345839
I'm reverting this and solving the initial problem in a different way.

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

5 years ago[CTU] Add DisplayCTUProgress analyzer switch
Gabor Marton [Fri, 7 Dec 2018 14:56:02 +0000 (14:56 +0000)]
[CTU] Add DisplayCTUProgress analyzer switch

Summary:
With a new switch we may be able to print to stderr if a new TU is being loaded
during CTU.  This is very important for higher level scripts (like CodeChecker)
to be able to parse this output so they can create e.g. a zip file in case of
a Clang crash which contains all the related TU files.

Reviewers: xazax.hun, Szelethus, a_sidorin, george.karpenkov

Subscribers: whisperity, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp,

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

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

5 years ago[CodeComplete] Fix assertion failure
Ilya Biryukov [Fri, 7 Dec 2018 13:17:52 +0000 (13:17 +0000)]
[CodeComplete] Fix assertion failure

Summary:
...that fires when running completion inside an argument of
UnresolvedMemberExpr (see the added test).

The assertion that fires is from Sema::TryObjectArgumentInitialization:

    assert(FromClassification.isLValue());

This happens because Sema::AddFunctionCandidates does not account for
object types which are pointers. It ends up classifying them incorrectly.
All usages of the function outside code completion are used to run
overload resolution for operators. In those cases the object type being
passed is always a non-pointer type, so it's not surprising the function
did not expect a pointer in the object argument.

However, code completion reuses the same function and calls it with the
object argument coming from UnresolvedMemberExpr, which can be a pointer
if the member expr is an arrow ('->') access.

Extending AddFunctionCandidates to allow pointer object types does not
seem too crazy since all the functions down the call chain can properly
handle pointer object types if we properly classify the object argument
as an l-value, i.e. the classification of the implicitly dereferenced
pointer.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

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

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

5 years ago[unittests] Merge the PrintedStmtCXX..Matches functions (NFC)
Hamza Sood [Fri, 7 Dec 2018 12:55:01 +0000 (12:55 +0000)]
[unittests] Merge the PrintedStmtCXX..Matches functions (NFC)

This was reviewed as part of https://reviews.llvm.org/D36527

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Fri, 7 Dec 2018 12:35:15 +0000 (12:35 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for various statements in C.

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

5 years ago[CTU] Eliminate race condition in CTU lit tests
Gabor Marton [Fri, 7 Dec 2018 12:29:02 +0000 (12:29 +0000)]
[CTU] Eliminate race condition in CTU lit tests

Summary:
We plan to introduce additional CTU related lit test. Since lit may run the
tests in parallel, it is not safe to use the same directory (%T) for these
tests. It is safe to use however test case specific directories (%t).

Reviewers: xazax.hun, a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

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

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

5 years ago[CTU] Add asserts to protect invariants
Gabor Marton [Fri, 7 Dec 2018 12:21:43 +0000 (12:21 +0000)]
[CTU] Add asserts to protect invariants

Reviewers: xazax.hun, a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

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

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

5 years ago[CTU] Add statistics
Gabor Marton [Fri, 7 Dec 2018 11:55:22 +0000 (11:55 +0000)]
[CTU] Add statistics

Reviewers: xazax.hun, a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

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

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

5 years agoAdd a AArch64 triple to tiny codemodel test.
David Green [Fri, 7 Dec 2018 11:16:03 +0000 (11:16 +0000)]
Add a AArch64 triple to tiny codemodel test.

Most other targets do not support the tiny code model.

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

5 years ago[PowerPC] VSX register support for inline assembly
Kang Zhang [Fri, 7 Dec 2018 08:58:12 +0000 (08:58 +0000)]
[PowerPC] VSX register support for inline assembly

Summary:
The patch is to add the VSX register support for inline assembly. After this
patch, we can use VSX register in inline assembly clobber list without error.

Reviewed By: jsji,  nemanjai

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

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

5 years agoFix thunks returning memptrs via sret by emitting also scalar return values directly...
Hans Wennborg [Fri, 7 Dec 2018 08:17:26 +0000 (08:17 +0000)]
Fix thunks returning memptrs via sret by emitting also scalar return values directly in sret slot (PR39901)

Thunks that return member pointers via sret are broken due to using temporary
storage for the return value on the stack and then passing that pointer to a
tail call, violating the rule that a tail call can't access allocas in the
caller (see bug).

Since r90526, we put aggregate return values directly in the sret slot, but
this doesn't apply to member pointers which are considered scalar.

Unless I'm missing something subtle, we should be able to always use the sret
slot directly for indirect return values.

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

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

5 years agoAdd test for InitListExpr
Stephen Kelly [Fri, 7 Dec 2018 00:08:14 +0000 (00:08 +0000)]
Add test for InitListExpr

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

5 years agoNFC: Move VisitExpr code to dumpStmt
Stephen Kelly [Thu, 6 Dec 2018 23:33:33 +0000 (23:33 +0000)]
NFC: Move VisitExpr code to dumpStmt

Summary:
The call is duplicated in the handlers of all Expr subclasses.

This change makes it easy to split statement handling out to
TextNodeDumper.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoNFC: Move VisitStmt code to dumpStmt
Stephen Kelly [Thu, 6 Dec 2018 23:33:27 +0000 (23:33 +0000)]
NFC: Move VisitStmt code to dumpStmt

Summary: This call is duplicated in Visits of all direct subclasses of Stmt.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoAdd more expected content to match in test
Stephen Kelly [Thu, 6 Dec 2018 23:23:10 +0000 (23:23 +0000)]
Add more expected content to match in test

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

5 years agoUse relative line offsets in test
Stephen Kelly [Thu, 6 Dec 2018 22:51:51 +0000 (22:51 +0000)]
Use relative line offsets in test

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

5 years ago[frontend][darwin] warn_stdlibcxx_not_found: supress warning for preprocessed input
Alex Lorenz [Thu, 6 Dec 2018 22:45:58 +0000 (22:45 +0000)]
[frontend][darwin] warn_stdlibcxx_not_found: supress warning for preprocessed input

Addresses second post-commit feedback for r335081 from Nico

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

5 years ago[analyzer] Rely on os_consumes_this attribute to signify that the method call consume...
George Karpenkov [Thu, 6 Dec 2018 22:07:12 +0000 (22:07 +0000)]
[analyzer] Rely on os_consumes_this attribute to signify that the method call consumes a reference for "this"

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

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

5 years ago[attributes] Add an attribute os_consumes_this, with similar semantics to ns_consumes...
George Karpenkov [Thu, 6 Dec 2018 22:06:59 +0000 (22:06 +0000)]
[attributes] Add an attribute os_consumes_this, with similar semantics to ns_consumes_self

The attribute specifies that the call of the C++ method consumes a
reference to "this".

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

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

5 years ago[analyzer] Fix an infinite recursion bug while checking parent methods in RetainCount...
George Karpenkov [Thu, 6 Dec 2018 22:06:44 +0000 (22:06 +0000)]
[analyzer] Fix an infinite recursion bug while checking parent methods in RetainCountChecker

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

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

5 years agoAllow forwarding -fdebug-compilation-dir to cc1as
Nico Weber [Thu, 6 Dec 2018 18:50:39 +0000 (18:50 +0000)]
Allow forwarding -fdebug-compilation-dir to cc1as

The flag -fdebug-compilation-dir is useful to make generated .o files
independent of the path of the build directory, without making the compile
command-line dependent on the path of the build directory, like
-fdebug-prefix-map requires. This change makes it so that the driver can
forward the flag to -cc1as, like it already can for -cc1. We might want to
consider making -fdebug-compilation-dir a driver flag in a follow-up.

(Since -fdebug-compilation-dir defaults to PWD, it's already possible to get
this effect by setting PWD, but explicit compiler flags are better than env
vars, because e.g. ninja tracks command lines and reruns commands that change.)

Somewhat related to PR14625.

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

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

5 years agoReapply "Avoid emitting redundant or unusable directories in DIFile metadata entries.""
Adrian Prantl [Thu, 6 Dec 2018 18:44:50 +0000 (18:44 +0000)]
Reapply "Avoid emitting redundant or unusable directories in DIFile metadata entries.""

This reverts commit r348280 and reapplies D55085 without modifications.

Original commit message:

    Avoid emitting redundant or unusable directories in DIFile metadata entries.

    As discussed on llvm-dev recently, Clang currently emits redundant
    directories in DIFile entries, such as

      .file      1 "/Volumes/Data/llvm" "/Volumes/Data/llvm/tools/clang/test/CodeGen/debug-info-abspath.c"

    This patch looks at any common prefix between the compilation
    directory and the (absolute) file path and strips the redundant
    part. More importantly it leaves the compilation directory empty if
    the two paths have no common prefix.

    After this patch the above entry is (assuming a compilation dir of "/Volumes/Data/llvm/_build"):

      .file 1 "/Volumes/Data/llvm" "tools/clang/test/CodeGen/debug-info-abspath.c"

    When building the FileCheck binary with debug info, this patch makes
    the build artifacts ~1kb smaller.

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

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

5 years ago[CUDA] Fix nvidia-cuda-toolkit detection on Ubuntu
Joel E. Denny [Thu, 6 Dec 2018 17:46:17 +0000 (17:46 +0000)]
[CUDA] Fix nvidia-cuda-toolkit detection on Ubuntu

This just extends D40453 (r319317) to Ubuntu.

Reviewed By: Hahnfeld, tra

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

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

5 years ago[OPENMP][NVPTX] Fix globalization of the mapped array sections.
Alexey Bataev [Thu, 6 Dec 2018 15:35:13 +0000 (15:35 +0000)]
[OPENMP][NVPTX] Fix globalization of the mapped array sections.

If the array section is based on pointer and this sections is mapped in
target region + then it is used in the inner parallel region, it also
must be globalized as the pointer itself is passed by value, not by
reference.

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

5 years agoDiagnose friend function template redefinitions.
Serge Pavlov [Thu, 6 Dec 2018 09:35:04 +0000 (09:35 +0000)]
Diagnose friend function template redefinitions.

Friend function template defined in a class template becomes available if
the enclosing class template is instantiated. Until the function template
is used, it does not have a body, but still is considered a definition for
the purpose of redeclaration checks.

This change modifies redefinition check so that it can find the friend
function template definitions in instantiated classes.

Differential Revision: http://reviews.llvm.org/D21508

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

5 years agoAdd test for ObjC generics
Stephen Kelly [Thu, 6 Dec 2018 09:23:59 +0000 (09:23 +0000)]
Add test for ObjC generics

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

5 years agoExtend OMP test
Stephen Kelly [Thu, 6 Dec 2018 09:23:53 +0000 (09:23 +0000)]
Extend OMP test

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

5 years agoMake test resistant to line numbers changing
Stephen Kelly [Thu, 6 Dec 2018 09:22:12 +0000 (09:22 +0000)]
Make test resistant to line numbers changing

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

5 years agoRemove unnecessary include.
Richard Trieu [Thu, 6 Dec 2018 06:32:40 +0000 (06:32 +0000)]
Remove unnecessary include.

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

5 years agoRemove CodeGen dependencies on Sema.
Richard Trieu [Thu, 6 Dec 2018 06:12:20 +0000 (06:12 +0000)]
Remove CodeGen dependencies on Sema.

Move diagnostics from Sema to Frontend (or Common) so that CodeGen no longer
needs to include the Sema diagnostic IDs.

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

5 years agoARM, AArch64: support `__attribute__((__swiftcall__))`
Saleem Abdulrasool [Thu, 6 Dec 2018 03:28:37 +0000 (03:28 +0000)]
ARM, AArch64: support `__attribute__((__swiftcall__))`

Support the Swift calling convention on Windows ARM and AArch64.  Both
of these conform to the AAPCS, AAPCS64 calling convention, and LLVM has
been adjusted to account for the register usage.  Ensure that the
frontend passes this into the backend.  This allows the swift runtime to
be built for Windows.

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

5 years ago[darwin] remove version number check when enabling -fobjc-subscripting-legacy-runtime
Alex Lorenz [Thu, 6 Dec 2018 02:44:23 +0000 (02:44 +0000)]
[darwin] remove version number check when enabling -fobjc-subscripting-legacy-runtime

This subscripting feature actually works on older OS versions anyway.

rdar://36287065

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

5 years agoReapply fix from r348062 to fix test on Windows.
Douglas Yung [Thu, 6 Dec 2018 02:13:09 +0000 (02:13 +0000)]
Reapply fix from r348062 to fix test on Windows.

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

5 years ago[attributes] Add more tests for os_returns_retained
George Karpenkov [Thu, 6 Dec 2018 01:21:38 +0000 (01:21 +0000)]
[attributes] Add more tests for os_returns_retained

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

5 years ago[Sema/Attribute] Check for noderef attribute
Leonard Chan [Thu, 6 Dec 2018 01:05:54 +0000 (01:05 +0000)]
[Sema/Attribute] Check for noderef attribute

This patch adds the noderef attribute in clang and checks for dereferences of
types that have this attribute. This attribute is currently used by sparse and
would like to be ported to clang.

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

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

5 years ago[Sema] Push and Pop Expression Evaluation Context Records at the start and end of...
Leonard Chan [Thu, 6 Dec 2018 00:10:36 +0000 (00:10 +0000)]
[Sema] Push and Pop Expression Evaluation Context Records at the start and end of function definitions

This patch creates a new context for every function definition we enter.
Currently we do not push and pop on these, usually working off of the global
context record added in the Sema constructor, which never gets popped.

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

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

5 years agoFix title underlines being too short after r348429
Pete Cooper [Thu, 6 Dec 2018 00:01:44 +0000 (00:01 +0000)]
Fix title underlines being too short after r348429

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

5 years agoUpdate ARC docs as objc_storeStrong returns void not id
Pete Cooper [Wed, 5 Dec 2018 23:49:52 +0000 (23:49 +0000)]
Update ARC docs as objc_storeStrong returns void not id

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

5 years agoFix test change from r348365 to deal with Windows paths correctly.
Douglas Yung [Wed, 5 Dec 2018 23:10:14 +0000 (23:10 +0000)]
Fix test change from r348365 to deal with Windows paths correctly.

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

5 years ago[Hexagon] Add intrinsics for Hexagon V66
Krzysztof Parzyszek [Wed, 5 Dec 2018 22:03:04 +0000 (22:03 +0000)]
[Hexagon] Add intrinsics for Hexagon V66

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

5 years ago[Hexagon] Add support for Hexagon V66
Krzysztof Parzyszek [Wed, 5 Dec 2018 21:38:35 +0000 (21:38 +0000)]
[Hexagon] Add support for Hexagon V66

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

5 years agoNFC: Extract TextNodeDumper class
Stephen Kelly [Wed, 5 Dec 2018 21:12:39 +0000 (21:12 +0000)]
NFC: Extract TextNodeDumper class

Summary:
Start by moving some utilities to it. It will eventually house dumping
of individual nodes (after indentation etc has already been accounted
for).

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoNFC: Extract TextTreeStructure class
Stephen Kelly [Wed, 5 Dec 2018 20:53:14 +0000 (20:53 +0000)]
NFC: Extract TextTreeStructure class

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoNFC: Inline handling of DependentSizedArrayType
Stephen Kelly [Wed, 5 Dec 2018 20:34:07 +0000 (20:34 +0000)]
NFC: Inline handling of DependentSizedArrayType

Summary:
Re-order handling of getElementType and getBracketsRange. It is
necessary to perform all printing before any traversal to child nodes.

This causes no change in the output of ast-dump-array.cpp due to the way
child nodes are printed with a delay.  This new order of the code is
also the order that produces the expected output anyway.

Subscribers: cfe-commits

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

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

5 years agoAdd dump tests for inherited default template parameters
Stephen Kelly [Wed, 5 Dec 2018 20:21:13 +0000 (20:21 +0000)]
Add dump tests for inherited default template parameters

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

5 years agoRevert "[RISCV] Mark unit tests as "requires: riscv-registered-target""
Mandeep Singh Grang [Wed, 5 Dec 2018 19:19:38 +0000 (19:19 +0000)]
Revert "[RISCV] Mark unit tests as "requires: riscv-registered-target""

This reverts commit 8908dd12e7bbfc74e264233e900206ad31e285f0.

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

5 years agoDo not check for parameters shadowing fields in function declarations.
Aaron Ballman [Wed, 5 Dec 2018 18:56:57 +0000 (18:56 +0000)]
Do not check for parameters shadowing fields in function declarations.

We would issue a false-positive diagnostic for parameters in function declarations shadowing fields; we now only issue the diagnostic on a function definition instead.

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Wed, 5 Dec 2018 18:53:57 +0000 (18:53 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for various function and class template declarations.

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

5 years agoHonor -fdebug-prefix-map when creating function names for the debug info.
Adrian Prantl [Wed, 5 Dec 2018 18:37:44 +0000 (18:37 +0000)]
Honor -fdebug-prefix-map when creating function names for the debug info.

This adds a callback to PrintingPolicy to allow CGDebugInfo to remap
file paths according to -fdebug-prefix-map. Otherwise the debug info
(particularly function names for C++ lambdas) may contain paths that
should have been remapped in the debug info.

<rdar://problem/46128056>

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

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

5 years ago[analyzer] Attribute for RetainCountChecker for OSObject should propagate with inheri...
George Karpenkov [Wed, 5 Dec 2018 18:34:54 +0000 (18:34 +0000)]
[analyzer] Attribute for RetainCountChecker for OSObject should propagate with inheritance

rdar://46388388

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

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

5 years agoMention changes to libc++ include dir lookup in release notes.
Ilya Biryukov [Wed, 5 Dec 2018 18:32:05 +0000 (18:32 +0000)]
Mention changes to libc++ include dir lookup in release notes.

Summary: The change itself landed as r348365, see the comment for more details.

Reviewers: arphaman, EricWF

Reviewed By: arphaman

Subscribers: cfe-commits

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

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

5 years agoAddress a post-commit review comment on r348325.
Erik Pilkington [Wed, 5 Dec 2018 17:43:26 +0000 (17:43 +0000)]
Address a post-commit review comment on r348325.

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

5 years ago[CodeComplete] Fix a crash in access checks of inner classes
Ilya Biryukov [Wed, 5 Dec 2018 17:38:39 +0000 (17:38 +0000)]
[CodeComplete] Fix a crash in access checks of inner classes

Summary: The crash was introduced in r348135.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

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

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

5 years ago[Basic] Cleanups in IdentifierInfo following the removal of PTH
Bruno Ricci [Wed, 5 Dec 2018 17:16:55 +0000 (17:16 +0000)]
[Basic] Cleanups in IdentifierInfo following the removal of PTH

The Entry pointer in IdentifierInfo was only null for IdentifierInfo
created from a PTH. Now that PTH support has been removed we can remove
some PTH specific code in IdentifierInfo::getLength and
IdentifierInfo::getNameStart.

Also make the constructor of IdentifierInfo private to make sure that
they are only created by IdentifierTable, and move it to the header so
that it can be inlined in IdentifierTable::get and IdentifierTable::getOwn.

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

Reviewed By: erichkeane

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

5 years ago[OpenCL] Diagnose conflicting address spaces in templates.
Anastasia Stulova [Wed, 5 Dec 2018 17:02:22 +0000 (17:02 +0000)]
[OpenCL] Diagnose conflicting address spaces in templates.

Added new diagnostic when templates are instantiated with
different address space from the one provided in its definition.

This also prevents deducing generic address space in pointer
type of templates to allow giving them concrete address space
during instantiation.

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

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

5 years ago[NFC] Use clang-format on PrintingPolicy::PrintingPolicy() after fd5c386f743
Jan Korous [Wed, 5 Dec 2018 16:19:49 +0000 (16:19 +0000)]
[NFC] Use clang-format on PrintingPolicy::PrintingPolicy() after fd5c386f743

The white-space change was causing conflicts downstream.

rdar://problem/46486841

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

5 years ago[Haiku] Support __float128 for x86 and x86_64
Kristina Brooks [Wed, 5 Dec 2018 15:05:06 +0000 (15:05 +0000)]
[Haiku] Support __float128 for x86 and x86_64

This patch addresses a compilation error with clang when
running in Haiku being unable to compile code using
float128 (throws compilation error such as 'float128 is
not supported on this target').

Patch by kallisti5 (Alexander von Gluck IV)

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

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

5 years agoMove detection of libc++ include dirs to Driver on MacOS
Ilya Biryukov [Wed, 5 Dec 2018 14:24:14 +0000 (14:24 +0000)]
Move detection of libc++ include dirs to Driver on MacOS

Summary:
The intention is to make the tools replaying compilations from 'compile_commands.json'
(clang-tidy, clangd, etc.) find the same standard library as the original compiler
specified in 'compile_commands.json'.

Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied
on the value of resource dir as an approximation of the compiler install dir. The new logic
uses the actual compiler install dir and is performed in the driver. This is consistent with
the C++ standard library detection on other platforms and allows to override the resource dir
in the tools using the compile_commands.json without altering the
standard library detection mechanism. The tools have to override the resource dir to make sure
they use a consistent version of the builtin headers.

There is still logic in InitHeaderSearch that attemps to add the absolute includes for the
the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend
via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too,
but it could potentially break the library detection on other systems, so we don't tackle it in this
patch to keep its scope manageable.

This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675.
The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the
driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke
the libc++ detection in clang itself, which caused LLDB tests to break.

The LLDB tests pass with new fix.

Reviewers: JDevlieghere, arphaman, EricWF

Reviewed By: arphaman

Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits

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

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

5 years agoRevert: Honor -fdebug-prefix-map when creating function names for the debug info.
Renato Golin [Wed, 5 Dec 2018 13:56:26 +0000 (13:56 +0000)]
Revert: Honor -fdebug-prefix-map when creating function names for the debug info.

This commit reverts r348060 and r348062 due to it breaking the AArch64 Full
buildbot: https://bugs.llvm.org/show_bug.cgi?id=39892

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

5 years ago[test] Disable Modules/prune.m on NetBSD as it requires 'touch -a'
Michal Gorny [Wed, 5 Dec 2018 11:17:50 +0000 (11:17 +0000)]
[test] Disable Modules/prune.m on NetBSD as it requires 'touch -a'

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

5 years ago[clang] - Simplify tools::SplitDebugName.
George Rimar [Wed, 5 Dec 2018 11:09:10 +0000 (11:09 +0000)]
[clang] - Simplify tools::SplitDebugName.

This is an updated version of the D54576, which was reverted.

Problem was that SplitDebugName calls the InputInfo::getFilename
which asserts if InputInfo given is not of type Filename:

const char *getFilename() const {
  assert(isFilename() && "Invalid accessor.");
  return Data.Filename;
}
At the same time at that point, it can be of type Nothing and
we need to use getBaseInput(), like original code did.

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

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

5 years ago[asan] Add clang flag -fsanitize-address-use-odr-indicator
Vitaly Buka [Wed, 5 Dec 2018 01:44:31 +0000 (01:44 +0000)]
[asan] Add clang flag -fsanitize-address-use-odr-indicator

Reviewers: eugenis, m.ostapenko, ygribov

Subscribers: hiraditya, llvm-commits

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

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

5 years ago[Sema] Remove some conditions of a failing assert
Erik Pilkington [Wed, 5 Dec 2018 00:43:11 +0000 (00:43 +0000)]
[Sema] Remove some conditions of a failing assert

We should have been checking that this state is consistent, but its
possible for it to be filled later, so it isn't really sound to check
it here anyways.

Fixes llvm.org/PR39742

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

5 years agoFix crash if an in-class explicit function specialization has explicit
Richard Smith [Tue, 4 Dec 2018 22:26:32 +0000 (22:26 +0000)]
Fix crash if an in-class explicit function specialization has explicit
template arguments referring to template paramaeters.

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Tue, 4 Dec 2018 21:50:08 +0000 (21:50 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for the definition data of C++ record objects as well as special member functions.

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

5 years agoAdd tests for dumping base classes; NFC.
Aaron Ballman [Tue, 4 Dec 2018 21:49:24 +0000 (21:49 +0000)]
Add tests for dumping base classes; NFC.

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

5 years ago[PowerPC] Make no-PIC default to match GCC - CLANG
Stefan Pintilie [Tue, 4 Dec 2018 20:15:37 +0000 (20:15 +0000)]
[PowerPC] Make no-PIC default to match GCC - CLANG

Make -fno-PIC default on PowerPC LE.

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

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

5 years ago[AST] Assert that no type class is polymorphic
Bruno Ricci [Tue, 4 Dec 2018 16:36:28 +0000 (16:36 +0000)]
[AST] Assert that no type class is polymorphic

Add a static_assert checking that no type class is polymorphic.
People should use LLVM style RTTI instead.

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

Reviewed By: aaron.ballman

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

5 years agoRevert "Avoid emitting redundant or unusable directories in DIFile metadata entries."
Ilya Biryukov [Tue, 4 Dec 2018 16:30:45 +0000 (16:30 +0000)]
Revert "Avoid emitting redundant or unusable directories in DIFile metadata entries."

This reverts commit r348154 and follow-up commits r348211 and r3248213.
Reason: the original commit broke compiler-rt tests and a follow-up fix
(r348203) broke our integrate and was reverted.

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

5 years ago[AST] Assert that no statement/expression class is polymorphic
Bruno Ricci [Tue, 4 Dec 2018 16:04:19 +0000 (16:04 +0000)]
[AST] Assert that no statement/expression class is polymorphic

Add a static_assert checking that no statement/expression class
is polymorphic. People should use LLVM style RTTI instead.

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

Reviewed By: aaron.ballman

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

5 years ago[AST][NFC] Make ArrayTypeTraitExpr non polymorphic
Bruno Ricci [Tue, 4 Dec 2018 16:01:24 +0000 (16:01 +0000)]
[AST][NFC] Make ArrayTypeTraitExpr non polymorphic

ArrayTypeTraitExpr is the only expression class which is polymorphic.
As far as I can tell this is completely pointless.

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

Reviewed By: aaron.ballman

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

5 years ago[Hexagon] Update builtin definitions
Krzysztof Parzyszek [Tue, 4 Dec 2018 15:47:07 +0000 (15:47 +0000)]
[Hexagon] Update builtin definitions

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

5 years ago[OPENMP][NVPTX]Fixed emission of the critical region.
Alexey Bataev [Tue, 4 Dec 2018 15:25:01 +0000 (15:25 +0000)]
[OPENMP][NVPTX]Fixed emission of the critical region.

Critical regions in NVPTX are the constructs, which, generally speaking,
are not supported by the NVPTX target. Instead we're using special
technique to handle the critical regions. Currently they are supported
only within the loop and all the threads in the loop must execute the
same critical region.
Inside of this special regions the regions still must be emitted as
critical, to avoid possible data races between the teams +
synchronization must use __kmpc_barrier functions.

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

5 years ago[OPENMP][NVPTX]Mark __kmpc_barrier functions as convergent.
Alexey Bataev [Tue, 4 Dec 2018 15:03:25 +0000 (15:03 +0000)]
[OPENMP][NVPTX]Mark __kmpc_barrier functions as convergent.

__kmpc_barrier runtime functions must be marked as convergent to prevent
some dangerous optimizations. Also, for NVPTX target all barriers must
be emitted as simple barriers.

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

5 years agoRemove reference to recently removed PTH Documentation.
Erich Keane [Tue, 4 Dec 2018 14:46:25 +0000 (14:46 +0000)]
Remove reference to recently removed PTH Documentation.

Removed in r348266

Change-Id: Icff0212f57c42ca84ec174ddd4366ae63a7923fa

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

5 years agoPTH-- Remove feature entirely-
Erich Keane [Tue, 4 Dec 2018 14:34:09 +0000 (14:34 +0000)]
PTH-- Remove feature entirely-

When debugging a boost build with a modified
version of Clang, I discovered that the PTH implementation
stores TokenKind in 8 bits. However, we currently have 368
TokenKinds.

The result is that the value gets truncated and the wrong token
gets picked up when including PTH files. It seems that this will
go wrong every time someone uses a token that uses the 9th bit.

Upon asking on IRC, it was brought up that this was a highly
experimental features that was considered a failure. I discovered
via googling that BoostBuild (mostly Boost.Math) is the only user of
this
feature, using the CC1 flag directly. I believe that this can be
transferred over to normal PCH with minimal effort:
https://github.com/boostorg/build/issues/367

Based on advice on IRC and research showing that this is a nearly
completely unused feature, this patch removes it entirely.

Note: I considered leaving the build-flags in place and making them
emit an error/warning, however since I've basically identified and
warned the only user, it seemed better to just remove them.

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

Change-Id: If32744275ef1f585357bd6c1c813d96973c4d8d9

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

5 years ago[SystemZ] Do not support __float128
Ulrich Weigand [Tue, 4 Dec 2018 10:51:36 +0000 (10:51 +0000)]
[SystemZ] Do not support __float128

As of rev. 268898, clang supports __float128 on SystemZ.  This seems to
have been in error.  GCC has never supported __float128 on SystemZ,
since the "long double" type on the platform is already IEEE-128. (GCC
only supports __float128 on platforms where "long double" is some other
data type.)

For compatibility reasons this patch removes __float128 on SystemZ
again.  The test case is updated accordingly.

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

5 years ago[Analyzer] Iterator Checker - Forbid decrements past the begin() and increments past...
Adam Balogh [Tue, 4 Dec 2018 10:27:27 +0000 (10:27 +0000)]
[Analyzer] Iterator Checker - Forbid decrements past the begin() and increments past the end() of containers

Previously, the iterator range checker only warned upon dereferencing of
iterators outside their valid range as well as increments and decrements of
out-of-range iterators where the result remains out-of-range. However, the C++
standard is more strict than this: decrementing begin() or incrementing end()
results in undefined behaviour even if the iterator is not dereferenced
afterwards. Coming back to the range once out-of-range is also undefined.

This patch corrects the behaviour of the iterator range checker: warnings are
given for any operation whose result is ahead of begin() or past the end()
(which is the past-end iterator itself, thus now we are speaking of past
past-the-end).

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

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

5 years ago[Analyzer] Iterator Checkers - Use the region of the topmost base class for iterators...
Adam Balogh [Tue, 4 Dec 2018 10:22:28 +0000 (10:22 +0000)]
[Analyzer] Iterator Checkers - Use the region of the topmost base class for iterators stored in a region

If an iterator is represented by a derived C++ class but its comparison operator
is for its base the iterator checkers cannot recognize the iterators compared.
This results in false positives in very straightforward cases (range error when
dereferencing an iterator after disclosing that it is equal to the past-the-end
iterator).

To overcome this problem we always use the region of the topmost base class for
iterators stored in a region. A new method called getMostDerivedObjectRegion()
was added to the MemRegion class to get this region.

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

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

5 years agoExtend test for DependentSizedArrayType
Stephen Kelly [Tue, 4 Dec 2018 09:53:36 +0000 (09:53 +0000)]
Extend test for DependentSizedArrayType

Use a using declaration to force the type to appear in the -ast-dump
output.

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

5 years ago[WIP][Sema] Improve static_assert diagnostics for type traits.
Clement Courbet [Tue, 4 Dec 2018 07:59:57 +0000 (07:59 +0000)]
[WIP][Sema] Improve static_assert diagnostics for type traits.

Summary:
In our codebase, `static_assert(std::some_type_trait<Ts...>::value, "msg")`
(where `some_type_trait` is an std type_trait and `Ts...` is the
appropriate template parameters) account for 11.2% of the `static_assert`s.

In these cases, the `Ts` are typically not spelled out explicitly, e.g.
`static_assert(std::is_same<SomeT::TypeT, typename SomeDependentT::value_type>::value, "message");`

The diagnostic when the assert fails is typically not very useful, e.g.
`static_assert failed due to requirement 'std::is_same<SomeT::TypeT, typename SomeDependentT::value_type>::value' "message"`

This change makes the diagnostic spell out the types explicitly , e.g.
`static_assert failed due to requirement 'std::is_same<int, float>::value' "message"`

See tests for more examples.

After this is submitted, I intend to handle
`static_assert(!std::some_type_trait<Ts...>::value, "msg")`,
which is another 6.6% of static_asserts.

Subscribers: cfe-commits

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

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

5 years agoRemove unnecessary include.
Richard Trieu [Tue, 4 Dec 2018 04:53:18 +0000 (04:53 +0000)]
Remove unnecessary include.

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

5 years ago[analyzer] MoveChecker: Add more common state resetting methods.
Artem Dergachev [Tue, 4 Dec 2018 03:38:08 +0000 (03:38 +0000)]
[analyzer] MoveChecker: Add more common state resetting methods.

Includes "resize" and "shrink" because they can reset the object to a known
state in certain circumstances.

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

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

5 years ago[Sema] Provide -fvisibility-global-new-delete-hidden option
Petr Hosek [Tue, 4 Dec 2018 03:25:25 +0000 (03:25 +0000)]
[Sema] Provide -fvisibility-global-new-delete-hidden option

When the global new and delete operators aren't declared, Clang
provides and implicit declaration, but this declaration currently
always uses the default visibility. This is a problem when the
C++ library itself is being built with non-default visibility because
the implicit declaration will force the new and delete operators to
have the default visibility unlike the rest of the library.

The existing workaround is to use assembly to enforce the visiblity:
https://fuchsia.googlesource.com/zircon/+/master/system/ulib/zxcpp/new.cpp#108
but that solution is not always available, e.g. in the case of of
libFuzzer which is using an internal version of libc++ that's also built
with -fvisibility=hidden where the existing behavior is causing issues.

This change introduces a new option -fvisibility-global-new-delete-hidden
which makes the implicit declaration of the global new and delete
operators hidden.

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

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

5 years agoFix -Wmismatched-tags to not warn on redeclarations of structs in system
Richard Smith [Tue, 4 Dec 2018 02:45:28 +0000 (02:45 +0000)]
Fix -Wmismatched-tags to not warn on redeclarations of structs in system
headers.

Previously, we would only check whether the new declaration is in a
system header, but that requires the user to be able to correctly guess
whether a declaration in a system header is declared as a struct or a
class when specializing standard library traits templates.

We now entirely ignore declarations for which the warning was disabled
when determining whether to warn on a tag mismatch.

Also extend the diagnostic message to clarify that
 a) code containing such a tag mismatch is in fact valid and correct,
    and
 b) the (non-coding-style) reason to emit such a warning is that the
    Microsoft C++ ABI is broken and includes the tag kind in decorated
    names,
as it seems a lot of users are confused by our diagnostic here (either
not understanding why we produce it, or believing that it represents an
actual language rule).

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

5 years ago[analyzer] MoveChecker: Improve warning and note messages.
Artem Dergachev [Tue, 4 Dec 2018 02:00:29 +0000 (02:00 +0000)]
[analyzer] MoveChecker: Improve warning and note messages.

The warning piece traditionally describes the bug itself, i.e.
"The bug is a _____", eg. "Attempt to delete released memory",
"Resource leak", "Method call on a moved-from object".

Event pieces produced by the visitor are usually in a present tense, i.e.
"At this moment _____": "Memory is released", "File is closed",
"Object is moved".

Additionally, type information is added into the event pieces for STL objects
(in order to highlight that it is in fact an STL object), and the respective
event piece now mentions that the object is left in an unspecified state
after it was moved, which is a vital piece of information to understand the bug.

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

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

5 years agoNFC: Make this test kinder on downstream forks
Erik Pilkington [Tue, 4 Dec 2018 00:31:31 +0000 (00:31 +0000)]
NFC: Make this test kinder on downstream forks

Downstream forks that have their own attributes often run into this
test failing when a new attribute is added to clang because the
number of supported attributes no longer match. This is redundant
information for this test, so we can get by without it.

rdar://46288577

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

5 years ago[Hexagon] Fix intrinsic test
Krzysztof Parzyszek [Mon, 3 Dec 2018 23:52:33 +0000 (23:52 +0000)]
[Hexagon] Fix intrinsic test

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

5 years agoRelax test even more for Windows
Adrian Prantl [Mon, 3 Dec 2018 23:40:51 +0000 (23:40 +0000)]
Relax test even more for Windows

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

5 years agoRelax tests to also work on Windows
Adrian Prantl [Mon, 3 Dec 2018 23:11:19 +0000 (23:11 +0000)]
Relax tests to also work on Windows

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

5 years ago[analyzer] MoveChecker: Restrict to locals and std:: objects.
Artem Dergachev [Mon, 3 Dec 2018 23:06:07 +0000 (23:06 +0000)]
[analyzer] MoveChecker: Restrict to locals and std:: objects.

In general case there use-after-move is not a bug. It depends on how the
move-constructor or move-assignment is implemented.

In STL, the convention that applies to most classes is that the move-constructor
(-assignment) leaves an object in a "valid but unspecified" state. Using such
object without resetting it to a known state first is likely a bug. Objects

Local value-type variables are special because due to their automatic lifetime
there is no intention to reuse space. If you want a fresh object, you might
as well make a new variable, no need to move from a variable and than re-use it.
Therefore, it is not always a bug, but it is obviously easy to suppress when it
isn't, and in most cases it indeed is - as there's no valid intention behind
the intentional use of a local after move.

This applies not only to local variables but also to parameter variables,
not only of value type but also of rvalue reference type (but not to lvalue
references).

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

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

5 years agoNFC: Add .vscode to .gitignore
Gor Nishanov [Mon, 3 Dec 2018 22:51:07 +0000 (22:51 +0000)]
NFC: Add .vscode to .gitignore

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

5 years ago[analyzer] MoveChecker: NFC: Remove the workaround for the "zombie symbols" bug.
Artem Dergachev [Mon, 3 Dec 2018 22:44:16 +0000 (22:44 +0000)]
[analyzer] MoveChecker: NFC: Remove the workaround for the "zombie symbols" bug.

The checker had extra code to clean up memory regions that were sticking around
in the checker without ever being cleaned up due to the bug that was fixed in
r347953. Because of that, if a region was moved from, then became dead,
and then reincarnated, there were false positives.

Why regions are even allowed to reincarnate is a separate story. Luckily, this
only happens for local regions that don't produce symbols when loaded from.

No functional change intended. The newly added test demonstrates that even
though no cleanup is necessary upon destructor calls, the early return
cannot be removed. It was not failing before the patch.

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

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

5 years ago[analyzer] Rename MisusedMovedObjectChecker to MoveChecker
Artem Dergachev [Mon, 3 Dec 2018 22:32:32 +0000 (22:32 +0000)]
[analyzer] Rename MisusedMovedObjectChecker to MoveChecker

This follows the Static Analyzer's tradition to name checkers after
things in which they find bugs, not after bugs they find.

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

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

5 years ago[analyzer] Dump stable identifiers for objects under construction.
Artem Dergachev [Mon, 3 Dec 2018 22:23:21 +0000 (22:23 +0000)]
[analyzer] Dump stable identifiers for objects under construction.

This continues the work that was started in r342313, which now gets applied to
object-under-construction tracking in C++. Makes it possible to debug
temporaries by dumping exploded graphs again.

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

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

5 years ago[AST] [analyzer] NFC: Reuse code in stable ID dumping methods.
Artem Dergachev [Mon, 3 Dec 2018 22:19:05 +0000 (22:19 +0000)]
[AST] [analyzer] NFC: Reuse code in stable ID dumping methods.

Use the new fancy method introduced in r348197 to simplify some code.

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

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

5 years ago[AST] Generate unique identifiers for CXXCtorInitializer objects.
Artem Dergachev [Mon, 3 Dec 2018 22:15:34 +0000 (22:15 +0000)]
[AST] Generate unique identifiers for CXXCtorInitializer objects.

This continues the work started in r342309 and r342315 to provide identifiers
to AST objects that are shorter and easier to read and remember than pointers.

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

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

5 years agoTypo correction; NFC.
Aaron Ballman [Mon, 3 Dec 2018 21:27:15 +0000 (21:27 +0000)]
Typo correction; NFC.

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

5 years agoNFC: Simplify dumpStmt child handling
Stephen Kelly [Mon, 3 Dec 2018 21:05:52 +0000 (21:05 +0000)]
NFC: Simplify dumpStmt child handling

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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