]> granicus.if.org Git - clang/log
clang
5 years ago[analyzer] RunLoopAutoreleaseLeakChecker: Come up with a test for r348822.
Artem Dergachev [Thu, 13 Dec 2018 01:30:47 +0000 (01:30 +0000)]
[analyzer] RunLoopAutoreleaseLeakChecker: Come up with a test for r348822.

Statement memoization was removed in r348822 because it was noticed to cause
memory corruption. This was happening because a reference to an object
in a DenseMap was used after being invalidated by inserting a new key
into the map.

This test case crashes reliably under ASan (i.e., when Clang is built with
-DLLVM_USE_SANITIZER="Address") on at least some machines before r348822
and doesn't crash after it.

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

5 years agoEmit a proper diagnostic when attempting to forward inalloca arguments
Reid Kleckner [Wed, 12 Dec 2018 23:46:06 +0000 (23:46 +0000)]
Emit a proper diagnostic when attempting to forward inalloca arguments

The previous assertion was relatively easy to trigger, and likely will
be easy to trigger going forward. EmitDelegateCallArg is relatively
popular.

This cleanly diagnoses PR28299 while I work on a proper solution.

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

5 years agoRevert "Declares __cpu_model as dso local"
Haibo Huang [Wed, 12 Dec 2018 22:39:51 +0000 (22:39 +0000)]
Revert "Declares __cpu_model as dso local"

This reverts r348978

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

5 years agoDeclares __cpu_model as dso local
Haibo Huang [Wed, 12 Dec 2018 22:04:12 +0000 (22:04 +0000)]
Declares __cpu_model as dso local

__builtin_cpu_supports and __builtin_cpu_is use information in __cpu_model to decide cpu features. Before this change, __cpu_model was not declared as dso local. The generated code looks up the address in GOT when reading __cpu_model. This makes it impossible to use these functions in ifunc, because at that time GOT entries have not been relocated. This change makes it dso local.

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

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

5 years ago[AST] Store "UsesADL" information in CallExpr.
Eric Fiselier [Wed, 12 Dec 2018 21:50:55 +0000 (21:50 +0000)]
[AST] Store "UsesADL" information in CallExpr.

Summary:
Currently the Clang AST doesn't store information about how the callee of a CallExpr was found. Specifically if it was found using ADL.

However, this information is invaluable to tooling. Consider a tool which renames usages of a function. If the originally CallExpr was formed using ADL, then the tooling may need to additionally qualify the replacement.
Without information about how the callee was found, the tooling is left scratching it's head. Additionally, we want to be able to match ADL calls as quickly as possible, which means avoiding computing the answer on the fly.

This patch changes `CallExpr` to store whether it's callee was found using ADL. It does not change the size of any AST nodes.

Reviewers: fowles, rsmith, klimek, shafik

Reviewed By: rsmith

Subscribers: aaron.ballman, riccibruno, calabrese, titus, cfe-commits

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

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

5 years agoTeach __builtin_unpredictable to work through implicit casts.
Erich Keane [Wed, 12 Dec 2018 20:30:53 +0000 (20:30 +0000)]
Teach __builtin_unpredictable to work through implicit casts.

The __builtin_unpredictable implementation is confused by any implicit
casts, which happen in C++.  This patch strips those off so that
if/switch statements now work with it in C++.

Change-Id: I73c3bf4f1775cd906703880944f4fcdc29fffb0a

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

5 years agoChange CallGraph print to show the fully qualified name
Erich Keane [Wed, 12 Dec 2018 18:11:36 +0000 (18:11 +0000)]
Change CallGraph print to show the fully qualified name

CallGraph previously would just show the normal name of a function,
which gets really confusing when using it on large C++ projects.  This
patch switches the printName call to a printQualifiedName, so that the
namespaces are included.

Change-Id: Ie086d863f6b2251be92109ea1b0946825b28b49a

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

5 years ago[Unroll/UnrollAndJam/Vectorizer/Distribute] Add followup loop attributes.
Michael Kruse [Wed, 12 Dec 2018 17:32:52 +0000 (17:32 +0000)]
[Unroll/UnrollAndJam/Vectorizer/Distribute] Add followup loop attributes.

When multiple loop transformation are defined in a loop's metadata, their order of execution is defined by the order of their respective passes in the pass pipeline. For instance, e.g.

    #pragma clang loop unroll_and_jam(enable)
    #pragma clang loop distribute(enable)

is the same as

    #pragma clang loop distribute(enable)
    #pragma clang loop unroll_and_jam(enable)

and will try to loop-distribute before Unroll-And-Jam because the LoopDistribute pass is scheduled after UnrollAndJam pass. UnrollAndJamPass only supports one inner loop, i.e. it will necessarily fail after loop distribution. It is not possible to specify another execution order. Also,t the order of passes in the pipeline is subject to change between versions of LLVM, optimization options and which pass manager is used.

This patch adds 'followup' attributes to various loop transformation passes. These attributes define which attributes the resulting loop of a transformation should have. For instance,

    !0 = !{!0, !1, !2}
    !1 = !{!"llvm.loop.unroll_and_jam.enable"}
    !2 = !{!"llvm.loop.unroll_and_jam.followup_inner", !3}
    !3 = !{!"llvm.loop.distribute.enable"}

defines a loop ID (!0) to be unrolled-and-jammed (!1) and then the attribute !3 to be added to the jammed inner loop, which contains the instruction to distribute the inner loop.

Currently, in both pass managers, pass execution is in a fixed order and UnrollAndJamPass will not execute again after LoopDistribute. We hope to fix this in the future by allowing pass managers to run passes until a fixpoint is reached, use Polly to perform these transformations, or add a loop transformation pass which takes the order issue into account.

For mandatory/forced transformations (e.g. by having been declared by #pragma omp simd), the user must be notified when a transformation could not be performed. It is not possible that the responsible pass emits such a warning because the transformation might be 'hidden' in a followup attribute when it is executed, or it is not present in the pipeline at all. For this reason, this patche introduces a WarnMissedTransformations pass, to warn about orphaned transformations.

Since this changes the user-visible diagnostic message when a transformation is applied, two test cases in the clang repository need to be updated.

To ensure that no other transformation is executed before the intended one, the attribute `llvm.loop.disable_nonforced` can be added which should disable transformation heuristics before the intended transformation is applied. E.g. it would be surprising if a loop is distributed before a #pragma unroll_and_jam is applied.

With more supported code transformations (loop fusion, interchange, stripmining, offloading, etc.), transformations can be used as building blocks for more complex transformations (e.g. stripmining+stripmining+interchange -> tiling).

Reviewed By: hfinkel, dmgreen

Differential Revision: https://reviews.llvm.org/D49281
Differential Revision: https://reviews.llvm.org/D55288

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

5 years ago[Driver] Add support for -fembed-bitcode for assembly file
Steven Wu [Wed, 12 Dec 2018 17:30:16 +0000 (17:30 +0000)]
[Driver] Add support for -fembed-bitcode for assembly file

Summary:
Handle -fembed-bitcode for assembly inputs. When the input file is
assembly, write a marker as "__LLVM,__asm" section.

Fix llvm.org/pr39659

Reviewers: compnerd, dexonsmith

Reviewed By: compnerd

Subscribers: rjmccall, dblaikie, jkorous, cfe-commits

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

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

5 years agoMake clang::CallGraph look into template instantiations
Erich Keane [Wed, 12 Dec 2018 17:22:52 +0000 (17:22 +0000)]
Make clang::CallGraph look into template instantiations

Clang's CallGraph analysis doesn't use the RecursiveASTVisitor's setting
togo into template instantiations.  The result is that anything wanting
to do call graph analysis ends up missing any template function calls.

Change-Id: Ib4af44ed59f15d43f37af91622a203146a3c3189

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

5 years agoBasic: make `int_least64_t` and `int_fast64_t` match on Darwin
Saleem Abdulrasool [Wed, 12 Dec 2018 17:05:20 +0000 (17:05 +0000)]
Basic: make `int_least64_t` and `int_fast64_t` match on Darwin

The Darwin targets use `int64_t` and `uint64_t` to define the `int_least64_t`
and `int_fast64_t` types.  The underlying type is actually a `long long`.  Match
the types to allow the printf specifiers to work properly and have the compiler
vended macros match the implementation on the target.

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

5 years ago[ExprConstant] Improve memchr/memcmp for type mismatch and multibyte element types
Hubert Tong [Wed, 12 Dec 2018 16:53:43 +0000 (16:53 +0000)]
[ExprConstant] Improve memchr/memcmp for type mismatch and multibyte element types

Summary:
`memchr` and `memcmp` operate upon the character units of the object
representation; that is, the `size_t` parameter expresses the number of
character units. The constant folding implementation is updated in this
patch to account for multibyte element types in the arrays passed to
`memchr`/`memcmp` and, in the case of `memcmp`, to account for the
possibility that the arrays may have differing element types (even when
they are byte-sized).

Actual inspection of the object representation is not implemented.
Comparisons are done only between elements with the same object size;
that is, `memchr` will fail when inspecting at least one character unit
of a multibyte element. The integer types are assumed to have two's
complement representation with 0 for `false`, 1 for `true`, and no
padding bits.

`memcmp` on multibyte elements will only be able to fold in cases where
enough elements are equal for the answer to be 0.

Various tests are added to guard against incorrect folding for cases
that miscompile on some system or other prior to this patch. At the same
time, the unsigned 32-bit `wchar_t` testing in
`test/SemaCXX/constexpr-string.cpp` is restored.

Reviewers: rsmith, aaron.ballman, hfinkel

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

5 years ago[mips] Enable using of integrated assembler in all cases.
Simon Atanasyan [Wed, 12 Dec 2018 15:32:25 +0000 (15:32 +0000)]
[mips] Enable using of integrated assembler in all cases.

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

5 years agoRemove TODO leftover from my devleopment branch
Erich Keane [Wed, 12 Dec 2018 15:13:00 +0000 (15:13 +0000)]
Remove TODO leftover from my devleopment branch

Accidentially checked in a TODO line from r348899. This removes it.

Change-Id: I74b59c0ecfe147af8a08dd7fd10893a4ca351d6d

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

5 years agoRevert "[OpenCL] Add generic AS to 'this' pointer"
Mikael Nilsson [Wed, 12 Dec 2018 15:06:16 +0000 (15:06 +0000)]
Revert "[OpenCL] Add generic AS to 'this' pointer"

Reverting because the patch broke lldb.

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

5 years ago[CUDA][OPENMP][NVPTX]Improve logic of the debug info support.
Alexey Bataev [Wed, 12 Dec 2018 14:52:27 +0000 (14:52 +0000)]
[CUDA][OPENMP][NVPTX]Improve logic of the debug info support.

Summary:
Added support for the -gline-directives-only option + fixed logic of the
debug info for CUDA devices. If optimization level is O0, then options
--[no-]cuda-noopt-device-debug do not affect the debug info level. If
the optimization level is >O0, debug info options are used +
--no-cuda-noopt-device-debug is used or no --cuda-noopt-device-debug is
used, the optimization level for the device code is kept and the
emission of the debug directives is used.
If the opt level is > O0, debug info is requested +
--cuda-noopt-device-debug option is used, the optimization is disabled
for the device code + required debug info is emitted.

Reviewers: tra, echristo

Subscribers: aprantl, guansong, JDevlieghere, cfe-commits

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

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

5 years ago[clang-fuzzer] Add explicit dependency on clangSerialization for clangHandleCXX after...
Alex Bradbury [Wed, 12 Dec 2018 14:33:24 +0000 (14:33 +0000)]
[clang-fuzzer] Add explicit dependency on clangSerialization for clangHandleCXX after rC348907

This library was breaking my -DBUILD_SHARED_LIBS=1 build. rC348915 seemed to miss this case.

As this seems an "obvious" fix, I am committing without pre-commit review as
per the LLVM developer policy.

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

5 years ago[OpenCL] Add generic AS to 'this' pointer
Mikael Nilsson [Wed, 12 Dec 2018 14:11:59 +0000 (14:11 +0000)]
[OpenCL] Add generic AS to 'this' pointer

Address spaces are cast into generic before invoking the constructor.

Added support for a trailing Qualifiers object in FunctionProtoType.

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

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

5 years ago[ASTImporter] Remove import of definition from GetAlreadyImportedOrNull
Gabor Marton [Wed, 12 Dec 2018 11:22:55 +0000 (11:22 +0000)]
[ASTImporter] Remove import of definition from GetAlreadyImportedOrNull

Summary: a_sidorin

Reviewers: a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

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

5 years ago[OpenCL] Fix for TBAA information of pointer after addresspacecast
Andrew Savonichev [Wed, 12 Dec 2018 09:51:23 +0000 (09:51 +0000)]
[OpenCL] Fix for TBAA information of pointer after addresspacecast

Summary: When addresspacecast is generated resulting pointer should preserve TBAA information from original value.

Reviewers: rjmccall, yaxunl, Anastasia

Reviewed By: rjmccall

Subscribers: asavonic, kosarev, cfe-commits, llvm-commits

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

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

5 years agoAdd explicit dependency on clangSerialization for a bunch of components to fix -DBUIL...
Fangrui Song [Wed, 12 Dec 2018 08:02:18 +0000 (08:02 +0000)]
Add explicit dependency on clangSerialization for a bunch of components to fix -DBUILD_SHARED_LIBS=on build

This is a more thorough fix of rC348911.
The story about -DBUILD_SHARED_LIBS=on build after rC348907 (Move PCHContainerOperations from Frontend to Serialization) is:

1. libclangSerialization.so defines PCHContainerReader dtor, ...
2. clangFrontend and clangTooling define classes inheriting from PCHContainerReader, thus their DSOs have undefined references on PCHContainerReader dtor
3. Components depending on either clangFrontend or clangTooling cannot be linked unless they have explicit dependency on clangSerialization due to the default linker option -z defs. The explicit dependency could be avoided if libclang{Frontend,Tooling}.so had these undefined references.

This patch adds the explicit dependency on clangSerialization to make them build.

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

5 years ago[CodeGen] Fix -DBUILD_SHARED_LIBS=on build after rC348907
Fangrui Song [Wed, 12 Dec 2018 06:07:33 +0000 (06:07 +0000)]
[CodeGen] Fix -DBUILD_SHARED_LIBS=on build after rC348907

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

5 years agoMove PCHContainerOperations from Frontend to Serialization
Richard Trieu [Wed, 12 Dec 2018 02:53:59 +0000 (02:53 +0000)]
Move PCHContainerOperations from Frontend to Serialization

Fix a layering violation.  Frontend depends on Serialization, so anything used
by both should be in Serialization.

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

5 years agoReplace Const-Member checking with non-recursive version.
Erich Keane [Tue, 11 Dec 2018 21:54:52 +0000 (21:54 +0000)]
Replace Const-Member checking with non-recursive version.

As reported in PR39946, these two implementations cause stack overflows
to occur when a type recursively contains itself.  While this only
happens when an incomplete version of itself is used by membership (and
thus an otherwise invalid program), the crashes might be surprising.

The solution here is to replace the recursive implementation with one
that uses a std::vector as a queue.  Old values are kept around to
prevent re-checking already checked types.

Change-Id: I582bb27147104763d7daefcfee39d91f408b9fa8

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

5 years agoRevert r348889; it fails some tests.
Aaron Ballman [Tue, 11 Dec 2018 19:42:04 +0000 (19:42 +0000)]
Revert r348889; it fails some tests.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/40784

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

5 years agoStop stripping comments from AST matcher example code.
Aaron Ballman [Tue, 11 Dec 2018 19:30:49 +0000 (19:30 +0000)]
Stop stripping comments from AST matcher example code.

The AST matcher documentation dumping script was being a bit over-zealous about stripping comment markers, which ended up causing comments in example code to stop being comments. Fix that by only stripping comments at the start of a line, rather than removing any forward slash (which also impacts prose text).

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

5 years agoEmit -Wformat properly for bit-field promotions.
Aaron Ballman [Tue, 11 Dec 2018 19:18:01 +0000 (19:18 +0000)]
Emit -Wformat properly for bit-field promotions.

Only explicitly look through integer and floating-point promotion where the result type is actually a promotion, which is not always the case for bit-fields in C.

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

5 years ago[analyzer][CStringChecker] evaluate explicit_bzero
David Carlier [Tue, 11 Dec 2018 18:57:07 +0000 (18:57 +0000)]
[analyzer][CStringChecker] evaluate explicit_bzero

- explicit_bzero has limited scope/usage only for security/crypto purposes but is non-optimisable version of memset/0 and bzero.
- explicit_memset has similar signature and semantics as memset but is also a non-optimisable version.

Reviewers: NoQ

Reviewed By: NoQ

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

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

5 years agoRemove CGDebugInfo::getOrCreateFile() and use TheCU->getFile() directly.
Adrian Prantl [Tue, 11 Dec 2018 16:58:46 +0000 (16:58 +0000)]
Remove CGDebugInfo::getOrCreateFile() and use TheCU->getFile() directly.

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

5 years agoReuse code from CGDebugInfo::getOrCreateFile() when creating the file
Adrian Prantl [Tue, 11 Dec 2018 16:58:43 +0000 (16:58 +0000)]
Reuse code from CGDebugInfo::getOrCreateFile() when creating the file
for the DICompileUnit.

This addresses post-commit feedback for D55085. Without this patch, a
main source file with an absolute paths may appear in different
DIFiles, once with the absolute path and once with the common prefix
between the absolute path and the current working directory.

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

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

5 years agoPass PartialOverloading argument to the correct corresponding parameter
Eric Fiselier [Tue, 11 Dec 2018 16:53:25 +0000 (16:53 +0000)]
Pass PartialOverloading argument to the correct corresponding parameter

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

5 years ago[ASan] Minor documentation fix: clarify static linking limitation.
Max Moroz [Tue, 11 Dec 2018 16:47:12 +0000 (16:47 +0000)]
[ASan] Minor documentation fix: clarify static linking limitation.

Summary:
ASan does not support statically linked binaries, but ASan runtime itself can
be statically linked into a target binary executable.

Reviewers: eugenis, kcc

Reviewed By: eugenis

Subscribers: cfe-commits, llvm-commits

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

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Tue, 11 Dec 2018 16:34:59 +0000 (16:34 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for expressions in C++.

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

5 years agoRevert "[PowerPC] Make no-PIC default to match GCC - CLANG"
Stefan Pintilie [Tue, 11 Dec 2018 15:47:57 +0000 (15:47 +0000)]
Revert "[PowerPC] Make no-PIC default to match GCC - CLANG"

This reverts commit rL348299.

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

5 years ago[analyzer] Fix a minor typo.
Gabor Horvath [Tue, 11 Dec 2018 14:40:48 +0000 (14:40 +0000)]
[analyzer] Fix a minor typo.

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

5 years agoReland r348741 "[Sema] Further improvements to to static_assert diagnostics."
Clement Courbet [Tue, 11 Dec 2018 08:39:11 +0000 (08:39 +0000)]
Reland r348741 "[Sema] Further improvements to to static_assert diagnostics."

Fix a dangling reference to temporary, never return nullptr.

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

5 years agoRevert r348830 "[Sema]improve static_assert(!expr)"
Clement Courbet [Tue, 11 Dec 2018 07:28:00 +0000 (07:28 +0000)]
Revert r348830 "[Sema]improve static_assert(!expr)"

Submitted the wrong change.

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

5 years ago[Sema]improve static_assert(!expr)
Clement Courbet [Tue, 11 Dec 2018 07:04:49 +0000 (07:04 +0000)]
[Sema]improve static_assert(!expr)

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

5 years agoMove CodeGenOptions from Frontend to Basic
Richard Trieu [Tue, 11 Dec 2018 03:18:39 +0000 (03:18 +0000)]
Move CodeGenOptions from Frontend to Basic

Basic uses CodeGenOptions and should not depend on Frontend.

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

5 years ago[analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker
George Karpenkov [Tue, 11 Dec 2018 01:14:17 +0000 (01:14 +0000)]
[analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker

Memoization dose not seem to be necessary, as other statement visitors
run just fine without it,
and in fact seems to be causing memory corruptions.
Just removing it instead of investigating the root cause.

rdar://45945002

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

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

5 years ago[analyzer] Hack for backwards compatibility for options for RetainCountChecker.
George Karpenkov [Tue, 11 Dec 2018 01:13:58 +0000 (01:13 +0000)]
[analyzer] Hack for backwards compatibility for options for RetainCountChecker.

To be removed once the clients update.

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

5 years ago[analyzer] Display a diagnostics when an inlined function violates its os_consumed...
George Karpenkov [Tue, 11 Dec 2018 01:13:40 +0000 (01:13 +0000)]
[analyzer] Display a diagnostics when an inlined function violates its os_consumed summary

This is currently a diagnostics, but might be upgraded to an error in the future,
especially if we introduce os_return_on_success attributes.

rdar://46359592

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

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

5 years ago[analyzer] Resolve another bug where the name of the leaked object was not printed...
George Karpenkov [Tue, 11 Dec 2018 01:13:20 +0000 (01:13 +0000)]
[analyzer] Resolve another bug where the name of the leaked object was not printed properly

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

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

5 years agoUpdate test for instcombine change
Matt Arsenault [Mon, 10 Dec 2018 23:02:40 +0000 (23:02 +0000)]
Update test for instcombine change

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

5 years agoRevert "Change InitListExpr dump to label and pointer"
Stephen Kelly [Mon, 10 Dec 2018 21:20:05 +0000 (21:20 +0000)]
Revert "Change InitListExpr dump to label and pointer"

This reverts commit r348794.

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

5 years agoFix nits
Stephen Kelly [Mon, 10 Dec 2018 21:04:04 +0000 (21:04 +0000)]
Fix nits

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

5 years agoRe-order content of template parameter dumps
Stephen Kelly [Mon, 10 Dec 2018 21:03:00 +0000 (21:03 +0000)]
Re-order content of template parameter dumps

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoRe-order content in OMPDeclareReductionDecl dump
Stephen Kelly [Mon, 10 Dec 2018 20:53:39 +0000 (20:53 +0000)]
Re-order content in OMPDeclareReductionDecl dump

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoChange InitListExpr dump to label and pointer
Stephen Kelly [Mon, 10 Dec 2018 20:53:32 +0000 (20:53 +0000)]
Change InitListExpr dump to label and pointer

Summary: Don't add a child just for the label.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoAdd an explicit triple to this test to fix failing test bots.
Aaron Ballman [Mon, 10 Dec 2018 19:18:11 +0000 (19:18 +0000)]
Add an explicit triple to this test to fix failing test bots.

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

5 years ago[constexpr][c++2a] Try-catch blocks in constexpr functions
Bruno Cardoso Lopes [Mon, 10 Dec 2018 19:03:12 +0000 (19:03 +0000)]
[constexpr][c++2a] Try-catch blocks in constexpr functions

Implement support for try-catch blocks in constexpr functions, as
proposed in http://wg21.link/P1002 and voted in San Diego for c++20.

The idea is that we can still never throw inside constexpr, so the catch
block is never entered. A try-catch block like this:

try { f(); } catch (...) { }

is then morally equivalent to just

{ f(); }

Same idea should apply for function/constructor try blocks.

rdar://problem/45530773

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

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Mon, 10 Dec 2018 18:37:47 +0000 (18:37 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for expressions in C.

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

5 years agoComputeLineNumbers: delete SSE2 vectorization
Fangrui Song [Mon, 10 Dec 2018 18:10:35 +0000 (18:10 +0000)]
ComputeLineNumbers: delete SSE2 vectorization

Summary:
SSE2 vectorization was added in 2012, but it is 2018 now and I can't
observe any performance boost (testing clang -E [all Sema/* CodeGen/* with proper -I options]) with the existing _mm_movemask_epi8+countTrailingZeros or the following SSE4.2 (compiling with -msse4.2):

  __m128i C = _mm_setr_epi8('\r','\n',0,0,0,0,0,0,0,0,0,0,0,0,0,0);
  _mm_cmpestri(C, 2, Chunk, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_POSITIVE_POLARITY | _SIDD_LEAST_SIGNIFICANT)

Delete the vectorization to simplify the code.

Also simplify the code a bit and don't check the line ending sequence \n\r

Reviewers: bkramer, #clang

Reviewed By: bkramer

Subscribers: cfe-commits

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

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

5 years ago[libclang] Revert removal of tidy plugin support from libclang introduced in r347496
Ivan Donchevskii [Mon, 10 Dec 2018 15:58:50 +0000 (15:58 +0000)]
[libclang] Revert removal of tidy plugin support from libclang introduced in r347496

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

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

5 years agoUse zip_longest for iterator range comparisons. NFC.
Michael Kruse [Mon, 10 Dec 2018 15:16:37 +0000 (15:16 +0000)]
Use zip_longest for iterator range comparisons. NFC.

Use zip_longest in two locations that compare iterator ranges.
zip_longest allows the iteration using a range-based for-loop and to be
symmetric over both ranges instead of prioritizing one over the other.
In that latter case code have to handle the case that the first is
longer than the second, the second is longer than the first, and both
are of the same length, which must partially be checked after the loop.

With zip_longest, this becomes an element comparison within the loop
like the comparison of the elements themselves. The symmetry makes it
clearer that neither the first and second iterators are handled
differently. The iterators are not event used directly anymore, just
the ranges.

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

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

5 years agoMisc typos fixes in ./lib folder
Raphael Isemann [Mon, 10 Dec 2018 12:37:46 +0000 (12:37 +0000)]
Misc typos fixes in ./lib folder

Summary: Found via `codespell -q 3 -I ../clang-whitelist.txt -L uint,importd,crasher,gonna,cant,ue,ons,orign,ned`

Reviewers: teemperor

Reviewed By: teemperor

Subscribers: teemperor, jholewinski, jvesely, nhaehnle, whisperity, jfb, cfe-commits

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

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

5 years ago[OpenCL][CodeGen] Fix replacing memcpy with addrspacecast
Andrew Savonichev [Mon, 10 Dec 2018 12:03:00 +0000 (12:03 +0000)]
[OpenCL][CodeGen] Fix replacing memcpy with addrspacecast

Summary:
If a function argument is byval and RV is located in default or alloca address space
an optimization of creating addrspacecast instead of memcpy is performed. That is
not correct for OpenCL, where that can lead to a situation of address space casting
from __private * to __global *. See an example below:

```
typedef struct {
  int x;
} MyStruct;

void foo(MyStruct val) {}

kernel void KernelOneMember(__global MyStruct* x) {
  foo (*x);
}
```

for this code clang generated following IR:
...
%0 = load %struct.MyStruct addrspace(1)*, %struct.MyStruct addrspace(1)**
%x.addr, align 4
%1 = addrspacecast %struct.MyStruct addrspace(1)* %0 to %struct.MyStruct*
...

So the optimization was disallowed for OpenCL if RV is located in an address space
different than that of the argument (0).

Reviewers: yaxunl, Anastasia

Reviewed By: Anastasia

Subscribers: cfe-commits, asavonic

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

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

5 years agoRevert r348741 "[Sema] Further improvements to to static_assert diagnostics."
Clement Courbet [Mon, 10 Dec 2018 08:53:17 +0000 (08:53 +0000)]
Revert r348741 "[Sema] Further improvements to to static_assert diagnostics."

Seems to break build bots.

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

5 years ago[Sema] Further improvements to to static_assert diagnostics.
Clement Courbet [Mon, 10 Dec 2018 08:19:38 +0000 (08:19 +0000)]
[Sema] Further improvements to to static_assert diagnostics.

Summary:
We're now handling cases like `static_assert(!expr)` and
static_assert(!(expr))`.

Reviewers: aaron.ballman, Quuxplusone

Subscribers: cfe-commits

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

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

5 years ago[X86] Remove the addcarry builtins. Leaving only the addcarryx builtins since that...
Craig Topper [Mon, 10 Dec 2018 06:07:59 +0000 (06:07 +0000)]
[X86] Remove the addcarry builtins. Leaving only the addcarryx builtins since that matches gcc.

The addcarry and addcarryx builtins do the same thing. The only difference is that addcarryx previously required adx feature.

This commit removes the adx feature check from addcarryx and removes the addcarry builtin. This matches the builtins that gcc has. We don't guarantee compatibility in builtins, but we generally try to be consistent if its not a burden.

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

5 years agoMove the make_const_ptr trait into STLExtras; use add_pointer where possible; NFC.
Aaron Ballman [Sun, 9 Dec 2018 19:53:24 +0000 (19:53 +0000)]
Move the make_const_ptr trait into STLExtras; use add_pointer where possible; NFC.

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

5 years agoNFC: Rename TemplateDecl dump utilities
Stephen Kelly [Sun, 9 Dec 2018 13:33:30 +0000 (13:33 +0000)]
NFC: Rename TemplateDecl dump utilities

There is a clang::TemplateDecl AST type, so a method called
VisitTemplateDecl looks like it should 'override' the method from the
base visitor, but it does not because of the extra parameters it takes.

In reality, these methods are utilities, so name them like utilities.

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

5 years agoNFC: Move dump of individual comment nodes to NodeDumper
Stephen Kelly [Sun, 9 Dec 2018 13:30:17 +0000 (13:30 +0000)]
NFC: Move dump of individual comment nodes to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoRevert "Introduce optional labels to dumpStmt"
Stephen Kelly [Sun, 9 Dec 2018 13:24:40 +0000 (13:24 +0000)]
Revert "Introduce optional labels to dumpStmt"

This reverts commit 933402caa09963792058198578522a95f013c69c.

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

5 years agoIntroduce optional labels to dumpStmt
Stephen Kelly [Sun, 9 Dec 2018 13:23:07 +0000 (13:23 +0000)]
Introduce optional labels to dumpStmt

If the label is present, it is added as a child, with the statement a
child of the label.  This preserves behavior of the InitListExpr dump
output.

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

5 years agoInline hasNodes into only caller
Stephen Kelly [Sun, 9 Dec 2018 13:20:43 +0000 (13:20 +0000)]
Inline hasNodes into only caller

It is easier to refactor with fewer utility methods.

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

5 years agoInline dumpFullComment into callers
Stephen Kelly [Sun, 9 Dec 2018 13:18:55 +0000 (13:18 +0000)]
Inline dumpFullComment into callers

It causes confusion over whether it or dumpComment is the more
important. It is easier to refactor with fewer utility methods.

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

5 years agoRe-order content from InitListExpr
Stephen Kelly [Sun, 9 Dec 2018 13:15:18 +0000 (13:15 +0000)]
Re-order content from InitListExpr

Summary:
This causes no change in the output of ast-dump-stmt.cpp due to the way
child nodes are printed with a delay.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoFix InitListExpr test
Stephen Kelly [Sun, 9 Dec 2018 13:13:41 +0000 (13:13 +0000)]
Fix InitListExpr test

Wrong case of Check meant this has no effect.

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

5 years agoSourceManager: insert(make_pair(..)) -> try_emplace. NFC
Fangrui Song [Sun, 9 Dec 2018 01:46:01 +0000 (01:46 +0000)]
SourceManager: insert(make_pair(..)) -> try_emplace. NFC

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

5 years agoConvert some ObjC msgSends to runtime calls.
Pete Cooper [Sat, 8 Dec 2018 05:13:50 +0000 (05:13 +0000)]
Convert some ObjC msgSends to runtime calls.

It is faster to directly call the ObjC runtime for methods such as alloc/allocWithZone instead of sending a message to those functions.

This patch adds support for converting messages to alloc/allocWithZone to their equivalent runtime calls.

Tests included for the positive case of applying this transformation, negative tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and also a driver test to ensure we enable this only for supported runtime versions.

Reviewed By: rjmccall

https://reviews.llvm.org/D55349

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

5 years agoMove diagnostic enums into Basic.
Richard Trieu [Sat, 8 Dec 2018 05:05:03 +0000 (05:05 +0000)]
Move diagnostic enums into Basic.

Move enums from */*Diagnostic.h to Basic/Diagnostic*.h.  Basic/AllDiagnostics.h
needs all the enums and moving the sources to Basic prevents a Basic->*->Basic
dependency loop.  This also allows each Basic/Diagnostics*Kinds.td to have a
header at Basic/Diagnostic*.h (except for Common).  The old headers are kept in place since other packages are still using them.

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

5 years agoStop tracking retain count of OSObject after escape to void * / other primitive types
George Karpenkov [Sat, 8 Dec 2018 01:18:40 +0000 (01:18 +0000)]
Stop tracking retain count of OSObject after escape to void * / other primitive types

Escaping to void * / uint64_t / others non-OSObject * should stop tracking,
as such functions can have heterogeneous semantics depending on context,
and can not always be annotated.

rdar://46439133

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

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

5 years ago[tests] Fix the FileManagerTest getVirtualFile test on Windows
Stella Stamenova [Fri, 7 Dec 2018 23:50:05 +0000 (23:50 +0000)]
[tests] Fix the FileManagerTest getVirtualFile test on Windows

Summary: The test passes on Windows only when it is executed on the C: drive. If the build and tests run on a different drive, the test is currently failing.

Reviewers: kadircet, asmith

Subscribers: cfe-commits

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

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

5 years ago[CUDA] Added missing 'inline' for functions defined in a header.
Artem Belevich [Fri, 7 Dec 2018 22:20:53 +0000 (22:20 +0000)]
[CUDA] Added missing 'inline' for functions defined in a header.

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

5 years ago[Preprocessor] Don't avoid entering included files after hitting a fatal error.
Volodymyr Sapsai [Fri, 7 Dec 2018 20:29:54 +0000 (20:29 +0000)]
[Preprocessor] Don't avoid entering included files after hitting a fatal error.

Change in r337953 violated the contract for `CXTranslationUnit_KeepGoing`:

> Do not stop processing when fatal errors are encountered.

Use different approach to fix long processing times with multiple inclusion
cycles. Instead of stopping preprocessing for fatal errors, do this after
reaching the max allowed include depth and only for the files that were
processed already. It is likely but not guaranteed those files cause a cycle.

rdar://problem/46108547

Reviewers: erik.pilkington, arphaman

Reviewed By: erik.pilkington

Subscribers: jkorous, dexonsmith, ilya-biryukov, Dmitry.Kozhevnikov

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

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

5 years ago[analyzer] Move out tracking retain count for OSObjects into a separate checker
George Karpenkov [Fri, 7 Dec 2018 20:21:51 +0000 (20:21 +0000)]
[analyzer] Move out tracking retain count for OSObjects into a separate checker

Allow enabling and disabling tracking of ObjC/CF objects
separately from tracking of OS objects.

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

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

5 years ago[analyzer] RetainCountChecker: remove untested, unused, incorrect option IncludeAlloc...
George Karpenkov [Fri, 7 Dec 2018 20:21:37 +0000 (20:21 +0000)]
[analyzer] RetainCountChecker: remove untested, unused, incorrect option IncludeAllocationLine

The option has no tests, is not used anywhere, and is actually
incorrect: it prints the line number without the reference to a file,
which can be outright incorrect.

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

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

5 years agoMake testcase more robust for bots actually building in /var
Adrian Prantl [Fri, 7 Dec 2018 17:57:44 +0000 (17:57 +0000)]
Make testcase more robust for bots actually building in /var

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

5 years ago[CTU] test/Analysis/ctu-main.cpp Attempt to fix failing windows bot
Gabor Marton [Fri, 7 Dec 2018 17:36:44 +0000 (17:36 +0000)]
[CTU] test/Analysis/ctu-main.cpp Attempt to fix failing windows bot

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

5 years agoAdding an AST dump test for statement expressions; NFC.
Aaron Ballman [Fri, 7 Dec 2018 17:06:40 +0000 (17:06 +0000)]
Adding an AST dump test for statement expressions; NFC.

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

5 years agoMake testcase more robust for completely-out-of-tree builds.
Adrian Prantl [Fri, 7 Dec 2018 17:04:26 +0000 (17:04 +0000)]
Make testcase more robust for completely-out-of-tree builds.

Thats to Dave Zarzycki for reprorting this!

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

5 years ago[CTU] Add triple/lang mismatch handling
Gabor Marton [Fri, 7 Dec 2018 16:32:43 +0000 (16:32 +0000)]
[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

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

5 years ago[CTU] test/Analysis/ctu-main.cpp Attempt to fix failing windows bot
Gabor Marton [Fri, 7 Dec 2018 16:27:31 +0000 (16:27 +0000)]
[CTU] test/Analysis/ctu-main.cpp Attempt to fix failing windows bot

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

5 years ago[CTU] Add more lit tests and better error handling
Gabor Marton [Fri, 7 Dec 2018 16:05:58 +0000 (16:05 +0000)]
[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

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

5 years ago[unittests] Add C++17 and C++2a support to the tooling tests
Hamza Sood [Fri, 7 Dec 2018 15:46:29 +0000 (15:46 +0000)]
[unittests] Add C++17 and C++2a support to the tooling tests

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

5 years agoMake CPUDispatch resolver emit dependent functions.
Erich Keane [Fri, 7 Dec 2018 15:31:23 +0000 (15:31 +0000)]
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

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

5 years agoAdd an explicit triple to this test to prevent failures due to size_t differences.
Aaron Ballman [Fri, 7 Dec 2018 15:13:51 +0000 (15:13 +0000)]
Add an explicit triple to this test to prevent failures due to size_t differences.

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

5 years agoFix spelling of WINDOWS in a test
Erich Keane [Fri, 7 Dec 2018 15:06:43 +0000 (15:06 +0000)]
Fix spelling of WINDOWS in a test

Change-Id: I232515655359f14308e1c5509c4b7db96d1fafcb

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

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