Commit Graph

76384 Commits

Author SHA1 Message Date
Adrian Prantl 03872dd6c8 Make testcase more robust for bots actually building in /var
llvm-svn: 348618
2018-12-07 17:57:44 +00:00
Gabor Marton 30388d6485 [CTU] test/Analysis/ctu-main.cpp Attempt to fix failing windows bot
llvm-svn: 348614
2018-12-07 17:36:44 +00:00
Aaron Ballman 535575dec9 Adding an AST dump test for statement expressions; NFC.
llvm-svn: 348613
2018-12-07 17:06:40 +00:00
Adrian Prantl 677b72f701 Make testcase more robust for completely-out-of-tree builds.
Thats to Dave Zarzycki for reprorting this!

llvm-svn: 348612
2018-12-07 17:04:26 +00:00
Gabor Marton 32aff2eb79 [CTU] Add triple/lang mismatch handling
Summary:
We introduce a strict policy for C++ CTU. It can work across TUs only if
the C++ dialects are the same. We neither allow C vs C++ CTU.  We do this
because the same constructs might be represented with different properties in
the corresponding AST nodes or even the nodes might be completely different (a
struct will be RecordDecl in C, but it will be a CXXRectordDecl in C++, thus it
may cause certain assertions during cast operations).

Reviewers: xazax.hun, a_sidorin

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

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

llvm-svn: 348610
2018-12-07 16:32:43 +00:00
Gabor Marton ce28f5782d [CTU] test/Analysis/ctu-main.cpp Attempt to fix failing windows bot
llvm-svn: 348609
2018-12-07 16:27:31 +00:00
Gabor Marton b87251d0bb [CTU] Add more lit tests and better error handling
Summary:
Adding some more CTU list tests. E.g. to check if a construct is unsupported.
We also slightly modify the handling of the return value of the `Import`
function from ASTImporter.

Reviewers: xazax.hun, balazske, a_sidorin

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

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

llvm-svn: 348605
2018-12-07 16:05:58 +00:00
Hamza Sood 2d9d026c00 [unittests] Add C++17 and C++2a support to the tooling tests
llvm-svn: 348603
2018-12-07 15:46:29 +00:00
Erich Keane 248ed07419 Make CPUDispatch resolver emit dependent functions.
Inline cpu_specific versions referenced before the cpu_dispatch function
weren't properly emitted, since they hadn't been referred to.  This
patch ensures that during resolver generation that all appropriate
versions are emitted.

Change-Id: I94c3766aaf9c75ca07a0ad8258efdbb834654ff8
llvm-svn: 348600
2018-12-07 15:31:23 +00:00
Aaron Ballman 08e565c6f9 Add an explicit triple to this test to prevent failures due to size_t differences.
llvm-svn: 348599
2018-12-07 15:13:51 +00:00
Erich Keane 05131ddfec Fix spelling of WINDOWS in a test
Change-Id: I232515655359f14308e1c5509c4b7db96d1fafcb
llvm-svn: 348598
2018-12-07 15:06:43 +00:00
Aaron Ballman 373ca178e1 Adding tests for -ast-dump; NFC.
This adds tests for various statements in C++ that are not covered by C.

llvm-svn: 348596
2018-12-07 14:57:07 +00:00
Erich Keane c6d5631cd5 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.

llvm-svn: 348595
2018-12-07 14:56:50 +00:00
Gabor Marton 9419eb42c4 [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

llvm-svn: 348594
2018-12-07 14:56:02 +00:00
Ilya Biryukov 143a9e0b12 [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

llvm-svn: 348590
2018-12-07 13:17:52 +00:00
Hamza Sood 779d81f8d2 [unittests] Merge the PrintedStmtCXX..Matches functions (NFC)
This was reviewed as part of https://reviews.llvm.org/D36527

llvm-svn: 348589
2018-12-07 12:55:01 +00:00
Aaron Ballman d52292fe1c Adding tests for -ast-dump; NFC.
This adds tests for various statements in C.

llvm-svn: 348588
2018-12-07 12:35:15 +00:00
Gabor Marton 681bcb6dff [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

llvm-svn: 348587
2018-12-07 12:29:02 +00:00
Gabor Marton b7f30dda39 [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

llvm-svn: 348586
2018-12-07 12:21:43 +00:00
Gabor Marton 700a29a153 [CTU] Add statistics
Reviewers: xazax.hun, a_sidorin

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

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

llvm-svn: 348584
2018-12-07 11:55:22 +00:00
David Green fba276f3fb Add a AArch64 triple to tiny codemodel test.
Most other targets do not support the tiny code model.

llvm-svn: 348582
2018-12-07 11:16:03 +00:00
Kang Zhang 9606d58a5f [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

llvm-svn: 348572
2018-12-07 08:58:12 +00:00
Hans Wennborg 86aba5eeee 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

llvm-svn: 348569
2018-12-07 08:17:26 +00:00
Stephen Kelly 8609e12b37 Add test for InitListExpr
llvm-svn: 348553
2018-12-07 00:08:14 +00:00
Stephen Kelly 50e82875bc 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

llvm-svn: 348546
2018-12-06 23:33:33 +00:00
Stephen Kelly b9d6a5eb4f 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

llvm-svn: 348545
2018-12-06 23:33:27 +00:00
Stephen Kelly a22e34fd15 Add more expected content to match in test
llvm-svn: 348543
2018-12-06 23:23:10 +00:00
Stephen Kelly f36d78d3cf Use relative line offsets in test
llvm-svn: 348541
2018-12-06 22:51:51 +00:00
Alex Lorenz 2e7ab55e65 [frontend][darwin] warn_stdlibcxx_not_found: supress warning for preprocessed input
Addresses second post-commit feedback for r335081 from Nico

llvm-svn: 348540
2018-12-06 22:45:58 +00:00
George Karpenkov b0b61955a1 [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

llvm-svn: 348533
2018-12-06 22:07:12 +00:00
George Karpenkov da2c77f92b [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

llvm-svn: 348532
2018-12-06 22:06:59 +00:00
George Karpenkov a71ec6c00a [analyzer] Fix an infinite recursion bug while checking parent methods in RetainCountChecker
Differential Revision: https://reviews.llvm.org/D55351

llvm-svn: 348531
2018-12-06 22:06:44 +00:00
Nico Weber 4c9fa4a0a1 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

llvm-svn: 348515
2018-12-06 18:50:39 +00:00
Adrian Prantl 212c104ea3 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

llvm-svn: 348513
2018-12-06 18:44:50 +00:00
Joel E. Denny 6dd34dc3dd [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

llvm-svn: 348504
2018-12-06 17:46:17 +00:00
Alexey Bataev 6393eb7ec6 [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.

llvm-svn: 348492
2018-12-06 15:35:13 +00:00
Serge Pavlov acfcd78aec 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

llvm-svn: 348473
2018-12-06 09:35:04 +00:00
Stephen Kelly fe8231ecca Add test for ObjC generics
llvm-svn: 348471
2018-12-06 09:23:59 +00:00
Stephen Kelly d6518a89e0 Extend OMP test
llvm-svn: 348470
2018-12-06 09:23:53 +00:00
Stephen Kelly 59c4ada8ab Make test resistant to line numbers changing
llvm-svn: 348469
2018-12-06 09:22:12 +00:00
Richard Trieu 587c1cb9f7 Remove unnecessary include.
llvm-svn: 348459
2018-12-06 06:32:40 +00:00
Richard Trieu 5337c74825 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.

llvm-svn: 348458
2018-12-06 06:12:20 +00:00
Saleem Abdulrasool f587857c88 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.

llvm-svn: 348454
2018-12-06 03:28:37 +00:00
Alex Lorenz 1ae9cd7e6a [darwin] remove version number check when enabling -fobjc-subscripting-legacy-runtime
This subscripting feature actually works on older OS versions anyway.

rdar://36287065

llvm-svn: 348448
2018-12-06 02:44:23 +00:00
Douglas Yung 6d7706fcd8 Reapply fix from r348062 to fix test on Windows.
llvm-svn: 348447
2018-12-06 02:13:09 +00:00
George Karpenkov 0cd6b9b9f7 [attributes] Add more tests for os_returns_retained
llvm-svn: 348443
2018-12-06 01:21:38 +00:00
Leonard Chan ad7ac964e5 [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

llvm-svn: 348442
2018-12-06 01:05:54 +00:00
Leonard Chan bf5fe2dbba [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

llvm-svn: 348434
2018-12-06 00:10:36 +00:00
Pete Cooper 324ccd5908 Fix title underlines being too short after r348429
llvm-svn: 348431
2018-12-06 00:01:44 +00:00
Pete Cooper 8adc72d176 Update ARC docs as objc_storeStrong returns void not id
llvm-svn: 348429
2018-12-05 23:49:52 +00:00