]> granicus.if.org Git - clang/log
clang
5 years ago[clang] Add storage for APValue in ConstantExpr
Gauthier Harnisch [Sat, 15 Jun 2019 10:24:47 +0000 (10:24 +0000)]
[clang] Add storage for APValue in ConstantExpr

Summary:
When using ConstantExpr we often need the result of the expression to be kept in the AST. Currently this is done on a by the node that needs the result and has been done multiple times for enumerator, for constexpr variables... . This patch adds to ConstantExpr the ability to store the result of evaluating the expression. no functional changes expected.

Changes:
 - Add trailling object to ConstantExpr that can hold an APValue or an uint64_t. the uint64_t is here because most ConstantExpr yield integral values so there is an optimized layout for integral values.
 - Add basic* serialization support for the trailing result.
 - Move conversion functions from an enum to a fltSemantics from clang::FloatingLiteral to llvm::APFloatBase. this change is to make it usable for serializing APValues.
 - Add basic* Import support for the trailing result.
 - ConstantExpr created in CheckConvertedConstantExpression now stores the result in the ConstantExpr Node.
 - Adapt AST dump to print the result when present.

basic* : None, Indeterminate, Int, Float, FixedPoint, ComplexInt, ComplexFloat,
the result is not yet used anywhere but for -ast-dump.

Reviewers: rsmith, martong, shafik

Reviewed By: rsmith

Subscribers: rnkovacs, hiraditya, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[analyzer] ReturnVisitor: Bypass everything to see inlined calls
Csaba Dabis [Sat, 15 Jun 2019 10:05:49 +0000 (10:05 +0000)]
[analyzer] ReturnVisitor: Bypass everything to see inlined calls

Summary:
When we traversed backwards on ExplodedNodes to see where processed the
given statement we `break` too early. With the current approach we do not
miss the CallExitEnd ProgramPoint which stands for an inlined call.

Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp, cfe-commits

Tags: #clang

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

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

5 years ago[clang] perform semantic checking in constant context
Gauthier Harnisch [Sat, 15 Jun 2019 08:32:56 +0000 (08:32 +0000)]
[clang] perform semantic checking in constant context

Summary:
Since the addition of __builtin_is_constant_evaluated the result of an expression can change based on whether it is evaluated in constant context. a lot of semantic checking performs evaluations with out specifying context. which can lead to wrong diagnostics.
for example:
```
constexpr int i0 = (long long)__builtin_is_constant_evaluated() * (1ll << 33); //#1
constexpr int i1 = (long long)!__builtin_is_constant_evaluated() * (1ll << 33); //#2
```
before the patch, #2 was diagnosed incorrectly and #1 wasn't diagnosed.
after the patch #1 is diagnosed as it should and #2 isn't.

Changes:
 - add a flag to Sema to passe in constant context mode.
 - in SemaChecking.cpp calls to Expr::Evaluate* are now done in constant context when they should.
 - in SemaChecking.cpp diagnostics for UB are not checked for in constant context because an error will be emitted by the constant evaluator.
 - in SemaChecking.cpp diagnostics for construct that cannot appear in constant context are not checked for in constant context.
 - in SemaChecking.cpp diagnostics on constant expression are always emitted because constant expression are always evaluated.
 - semantic checking for initialization of constexpr variables is now done in constant context.
 - adapt test that were depending on warning changes.
 - add test.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoFixed the --print-supported-cpus test
Ziang Wan [Fri, 14 Jun 2019 23:34:40 +0000 (23:34 +0000)]
Fixed the --print-supported-cpus test

Add constraints for the test that require specific backend targets
to be registered.

Remove trailing whitespace in the doc.

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

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

5 years ago[X86] Add checks that immediate for reducesd/ss fits in 8-bits.
Craig Topper [Fri, 14 Jun 2019 23:23:19 +0000 (23:23 +0000)]
[X86] Add checks that immediate for reducesd/ss fits in 8-bits.

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

5 years ago[CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute
Akira Hatanaka [Fri, 14 Jun 2019 22:06:28 +0000 (22:06 +0000)]
[CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute
'objc_arc_inert'

The attribute enables the ARC optimizer to delete ObjC ARC runtime calls
on the annotated globals (see https://reviews.llvm.org/D62433). We
currently only annotate global variables for string literals and global
blocks with the attribute.

rdar://problem/49839633

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

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

5 years agoAdd --print-supported-cpus flag for clang.
Ziang Wan [Fri, 14 Jun 2019 21:42:21 +0000 (21:42 +0000)]
Add --print-supported-cpus flag for clang.

This patch allows clang users to print out a list of supported CPU models using
clang [--target=<target triple>] --print-supported-cpus

Then, users can select the CPU model to compile to using
clang --target=<triple> -mcpu=<model> a.c

It is a handy feature to help cross compilation.

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

5 years ago[Remarks][NFC] Improve testing and documentation of -foptimization-record-passes
Francis Visoiu Mistrih [Fri, 14 Jun 2019 21:38:57 +0000 (21:38 +0000)]
[Remarks][NFC] Improve testing and documentation of -foptimization-record-passes

This adds:

* documentation to the user manual
* nicer error message
* test for the error case
* test for the gold plugin

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

5 years ago[OpenMP] Add target task alloc function with device ID
Gheorghe-Teodor Bercea [Fri, 14 Jun 2019 20:19:54 +0000 (20:19 +0000)]
[OpenMP] Add target task alloc function with device ID

Summary: Add a new call to Clang to perform task allocation for the target.

Reviewers: ABataev, AlexEichenberger, caomhin

Reviewed By: ABataev, AlexEichenberger

Subscribers: openmp-commits, Hahnfeld, guansong, jdoerfert, cfe-commits

Tags: #clang, #openmp

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

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

5 years agoUse unsigned for bitfields to avoid sign extension
Reid Kleckner [Fri, 14 Jun 2019 20:19:29 +0000 (20:19 +0000)]
Use unsigned for bitfields to avoid sign extension

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

5 years agoPR42071: Reject weird names for non-type template parameters.
Richard Smith [Fri, 14 Jun 2019 20:01:54 +0000 (20:01 +0000)]
PR42071: Reject weird names for non-type template parameters.

Also reject default arguments appearing in invalid locations.

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

5 years agoUse getOperatorSpelling to get the spelling of an overloaded operator
Richard Smith [Fri, 14 Jun 2019 20:01:51 +0000 (20:01 +0000)]
Use getOperatorSpelling to get the spelling of an overloaded operator
rather than duplicating operator name tables in multiple places.

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

5 years ago[OpenMP] Avoid emitting maps for target link variables when unified memory is used
Gheorghe-Teodor Bercea [Fri, 14 Jun 2019 17:58:26 +0000 (17:58 +0000)]
[OpenMP] Avoid emitting maps for target link variables when unified memory is used

Summary: This patch avoids the emission of maps for target link variables when unified memory is present.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoRemove unused SK_LValueToRValue initialization step.
Richard Smith [Fri, 14 Jun 2019 17:46:39 +0000 (17:46 +0000)]
Remove unused SK_LValueToRValue initialization step.

In addition to being unused and duplicating code, this was also wrong
(it didn't properly mark the operand as being potentially not odr-used).

This reinstates r363340, reverted in r363352.

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

5 years agoPR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
Richard Smith [Fri, 14 Jun 2019 17:46:38 +0000 (17:46 +0000)]
PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
nullptr_t does not access memory.

We now reuse CK_NullToPointer to represent a conversion from a glvalue
of type nullptr_t to a prvalue of nullptr_t where necessary.

This reinstates r363337, reverted in r363352.

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

5 years agoC++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversio...
Richard Smith [Fri, 14 Jun 2019 17:46:37 +0000 (17:46 +0000)]
C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression.

Summary:
When a variable is named in a context where we can't directly emit a
reference to it (because we don't know for sure that it's going to be
defined, or it's from an enclosing function and not captured, or the
reference might not "work" for some reason), we emit a copy of the
variable as a global and use that for the known-to-be-read-only access.

This reinstates r363295, reverted in r363352, with a fix for PR42276:
we now produce a proper name for a non-odr-use reference to a static
constexpr data member. The name <mangled-name>.const is used in that
case; such names are reserved to the implementation for cases such as
this and should demangle nicely.

Reviewers: rjmccall

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoReland: [Remarks] Refactor optimization remarks setup
Francis Visoiu Mistrih [Fri, 14 Jun 2019 16:20:51 +0000 (16:20 +0000)]
Reland: [Remarks] Refactor optimization remarks setup

* Add a common function to setup opt-remarks
* Rename common options to the same names
* Add error types to distinguish between file errors and regex errors

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

5 years ago[AMDGPU] Enable the implicit arguments for HIP (CLANG)
Yaxun Liu [Fri, 14 Jun 2019 15:54:47 +0000 (15:54 +0000)]
[AMDGPU] Enable the implicit arguments for HIP (CLANG)

Enable 48-bytes of implicit arguments for HIP as well. Earlier it was enabled for OpenCL. This code is specific to AMDGPU target.

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

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

5 years agoAMDGPU: Use AMDGPU toolchain for other OSes
Matt Arsenault [Fri, 14 Jun 2019 13:39:57 +0000 (13:39 +0000)]
AMDGPU: Use AMDGPU toolchain for other OSes

This would need more work to actually support them, but this is less
wrong than the default.

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

5 years agoRevert r363298 "[lit] Disable test on darwin when building shared libs."
Nico Weber [Fri, 14 Jun 2019 12:58:17 +0000 (12:58 +0000)]
Revert r363298 "[lit] Disable test on darwin when building shared libs."

It broke running check-lld on mac, see https://reviews.llvm.org/D61697

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

5 years agoRevert "[OpenCL] Move OpenCLBuiltins.td and remove unused include"
Sven van Haastregt [Fri, 14 Jun 2019 12:14:58 +0000 (12:14 +0000)]
Revert "[OpenCL] Move OpenCLBuiltins.td and remove unused include"

This reverts commit r363242 as it broke some builds with

  make[2]: *** No rule to make target 'ClangOpenCLBuiltinsImpl', needed by
  'tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaLookup.cpp.o'.

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

5 years agoadd a missing parenthese in the clang doc
Sylvestre Ledru [Fri, 14 Jun 2019 11:33:40 +0000 (11:33 +0000)]
add a missing parenthese in the clang doc

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

5 years ago[C++20] add Basic consteval specifier
Gauthier Harnisch [Fri, 14 Jun 2019 08:56:20 +0000 (08:56 +0000)]
[C++20] add Basic consteval specifier

Summary:
this revision adds Lexing, Parsing and Basic Semantic for the consteval specifier as specified by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html

with this patch, the consteval specifier is treated as constexpr but can only be applied to function declaration.

Changes:
 - add the consteval keyword.
 - add parsing of consteval specifier for normal declarations and lambdas expressions.
 - add the whether a declaration is constexpr is now represented by and enum everywhere except for variable because they can't be consteval.
 - adapt diagnostic about constexpr to print constexpr or consteval depending on the case.
 - add tests for basic semantic.

Reviewers: rsmith, martong, shafik

Reviewed By: rsmith

Subscribers: eraman, efriedma, rnkovacs, cfe-commits

Tags: #clang

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

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

5 years ago[clang] Fixing incorrect implicit deduction guides (PR41549)
Gauthier Harnisch [Fri, 14 Jun 2019 08:40:04 +0000 (08:40 +0000)]
[clang] Fixing incorrect implicit deduction guides (PR41549)

Summary:
[[ https://bugs.llvm.org/show_bug.cgi?id=41549 | bug report ]]

Before this patch, implicit deduction guides were generated from the first declaration found by lookup.
With this patch implicit deduction guides are generated from the definition of the class template.
Also added test that was previously failing.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, Quuxplusone

Tags: #clang

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

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

5 years ago[clang] Don't segfault on incorrect using directive (PR41400)
Gauthier Harnisch [Fri, 14 Jun 2019 08:25:52 +0000 (08:25 +0000)]
[clang] Don't segfault on incorrect using directive (PR41400)

Summary:
this is a bugfixe for [[ https://bugs.llvm.org/show_bug.cgi?id=41400 | PR41400 ]]

added nullptr check at the relevent place and test

Reviewers: rsmith, riccibruno

Reviewed By: rsmith

Subscribers: jkooker, jkorous, riccibruno, cfe-commits

Tags: #clang

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

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

5 years agoRevert 363295, it caused PR42276. Also revert follow-ups 363337, 363340.
Nico Weber [Fri, 14 Jun 2019 04:05:17 +0000 (04:05 +0000)]
Revert 363295, it caused PR42276. Also revert follow-ups 363337, 363340.

Revert 363340 "Remove unused SK_LValueToRValue initialization step."
Revert 363337 "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type"
Revert 363295 "C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression."

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

5 years ago[Targets] Move soft-float-abi filtering to `initFeatureMap`
George Burgess IV [Fri, 14 Jun 2019 00:35:17 +0000 (00:35 +0000)]
[Targets] Move soft-float-abi filtering to `initFeatureMap`

ARM has a special target feature called soft-float-abi. This feature is
special, since we get it passed to us explicitly in the frontend, but
filter it out before it can land in any target feature strings in LLVM
IR.

__attribute__((target(""))) doesn't quite filter these features out
properly, so today, we get warnings about soft-float-abi being an
unknown feature from the backend.

This CL has us filter soft-float-abi out at a slightly different point,
so we don't end up passing these invalid features to the backend.

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

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

5 years ago[AMDGPU] gfx1011/gfx1012 clang support
Stanislav Mekhanoshin [Fri, 14 Jun 2019 00:33:59 +0000 (00:33 +0000)]
[AMDGPU] gfx1011/gfx1012 clang support

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

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

5 years agoRevert "[Remarks] Refactor optimization remarks setup"
Francis Visoiu Mistrih [Fri, 14 Jun 2019 00:05:56 +0000 (00:05 +0000)]
Revert "[Remarks] Refactor optimization remarks setup"

This reverts commit 6e6e3af55bb97e1a4c97375c15a2b0099120c5a7.

This breaks greendragon.

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

5 years ago[AMDGPU] gfx1010 wave32 clang support
Stanislav Mekhanoshin [Thu, 13 Jun 2019 23:47:59 +0000 (23:47 +0000)]
[AMDGPU] gfx1010 wave32 clang support

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

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

5 years agoRemove unused SK_LValueToRValue initialization step.
Richard Smith [Thu, 13 Jun 2019 23:47:42 +0000 (23:47 +0000)]
Remove unused SK_LValueToRValue initialization step.

In addition to being unused and duplicating code, this was also wrong
(it didn't properly mark the operand as being potentially not odr-used).

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

5 years agoPR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
Richard Smith [Thu, 13 Jun 2019 23:31:04 +0000 (23:31 +0000)]
PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
nullptr_t does not access memory.

We now reuse CK_NullToPointer to represent a conversion from a glvalue
of type nullptr_t to a prvalue of nullptr_t where necessary.

This reinstates r345562, reverted in r346065, now that CodeGen's
handling of non-odr-used variables has been fixed.

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

5 years agoUse fully qualified name when printing S_CONSTANT records
Amy Huang [Thu, 13 Jun 2019 22:53:43 +0000 (22:53 +0000)]
Use fully qualified name when printing S_CONSTANT records

Summary:
Before it was using the fully qualified name only for static data members.
Now it does for all variable names to match MSVC.

Reviewers: rnk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[Remarks] Refactor optimization remarks setup
Francis Visoiu Mistrih [Thu, 13 Jun 2019 21:46:57 +0000 (21:46 +0000)]
[Remarks] Refactor optimization remarks setup

* Add a common function to setup opt-remarks
* Rename common options to the same names
* Add error types to distinguish between file errors and regex errors

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

5 years ago[lit] Disable test on darwin when building shared libs.
Don Hinton [Thu, 13 Jun 2019 19:08:49 +0000 (19:08 +0000)]
[lit] Disable test on darwin when building shared libs.

Summary:
This test fails to link shared libraries because tries to run
a copied version of clang-check to see if the mock version of libcxx
in the same directory can be loaded dynamically.  Since the test is
specifically designed not to look in the default just-built lib
directory, it must be disabled when building with
BUILD_SHARED_LIBS=ON.

Currently only disabling it on Darwin and basing it on the
enable_shared flag.

Reviewed By: ilya-biryukov

Tags: #clang, #llvm

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

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

5 years agoC++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversio...
Richard Smith [Thu, 13 Jun 2019 19:00:16 +0000 (19:00 +0000)]
C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression.

Summary:
When a variable is named in a context where we can't directly emit a
reference to it (because we don't know for sure that it's going to be
defined, or it's from an enclosing function and not captured, or the
reference might not "work" for some reason), we emit a copy of the
variable as a global and use that for the known-to-be-read-only access.

Reviewers: rjmccall

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoPR42182: Allow thread-local to use __cxa_thread_atexit when
Erich Keane [Thu, 13 Jun 2019 18:20:19 +0000 (18:20 +0000)]
PR42182: Allow thread-local to use __cxa_thread_atexit when
-fno-use-cxx-atexit is used

This matches the GCC behavior, __cxa_thread_atexit should be permissible
even though cxa_atexit is disabled.

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

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

5 years ago[clang][NewPM] Fix broken -O0 test from missing assumptions
Leonard Chan [Thu, 13 Jun 2019 18:18:40 +0000 (18:18 +0000)]
[clang][NewPM] Fix broken -O0 test from missing assumptions

Add an AssumptionCache callback to the InlineFuntionInfo used for the
AlwaysInlinerPass to match codegen of the AlwaysInlinerLegacyPass to generate
llvm.assume. This fixes CodeGen/builtin-movdir.c when new PM is enabled by
default.

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

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

5 years ago[clang][NewPM] Fix split debug test
Leonard Chan [Thu, 13 Jun 2019 17:40:03 +0000 (17:40 +0000)]
[clang][NewPM] Fix split debug test

This contains the part of D62225 which fixes CodeGen/split-debug-single-file.c
by not placing .dwo sections when using -enable-split-dwarf=split.

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

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

5 years ago[clang][NewPM] Fix broken profile test
Leonard Chan [Thu, 13 Jun 2019 17:25:36 +0000 (17:25 +0000)]
[clang][NewPM] Fix broken profile test

This contains the part of D62225 which fixes Profile/gcc-flag-compatibility.c
by adding the pass that allows default profile generation to work under the new
PM. It seems that ./default.profraw was not being generated with new PM enabled.

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

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

5 years ago[clang][NewPM] Fix broken -O0 test from the AlwaysInliner
Leonard Chan [Thu, 13 Jun 2019 16:45:29 +0000 (16:45 +0000)]
[clang][NewPM] Fix broken -O0 test from the AlwaysInliner

This contains the part of D62225 which prevents insertion of lifetime
intrinsics when creating the AlwaysInliner. This fixes the following tests
when the new PM is enabled by default:

Clang :: CodeGen/aarch64-neon-across.c
Clang :: CodeGen/aarch64-neon-fcvt-intrinsics.c
Clang :: CodeGen/aarch64-neon-fma.c
Clang :: CodeGen/aarch64-neon-perm.c
Clang :: CodeGen/aarch64-neon-tbl.c
Clang :: CodeGen/aarch64-poly128.c
Clang :: CodeGen/aarch64-v8.2a-neon-intrinsics.c
Clang :: CodeGen/arm-neon-fma.c
Clang :: CodeGen/arm-neon-numeric-maxmin.c
Clang :: CodeGen/arm-neon-vcvtX.c
Clang :: CodeGen/avx-builtins.c
Clang :: CodeGen/builtins-ppc-p9vector.c
Clang :: CodeGen/builtins-ppc-vsx.c
Clang :: CodeGen/lifetime.c
Clang :: CodeGen/sse-builtins.c
Clang :: CodeGen/sse2-builtins.c

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

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

5 years agoAdded AST matcher for ignoring elidable constructors
Dmitri Gribenko [Thu, 13 Jun 2019 13:48:24 +0000 (13:48 +0000)]
Added AST matcher for ignoring elidable constructors

Summary: Added AST matcher for ignoring elidable move constructors

Reviewers: hokein, gribozavr

Reviewed By: hokein, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

Patch by Johan Vikström.

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

5 years ago[OpenCL] Move OpenCLBuiltins.td and remove unused include
Sven van Haastregt [Thu, 13 Jun 2019 09:54:22 +0000 (09:54 +0000)]
[OpenCL] Move OpenCLBuiltins.td and remove unused include

Patch by Pierre Gondois.

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

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

5 years ago[WebAssembly] Modernize include path handling
Sam Clegg [Thu, 13 Jun 2019 09:42:43 +0000 (09:42 +0000)]
[WebAssembly] Modernize include path handling

Move include path construction from
InitHeaderSearch::AddDefaultIncludePaths in the Driver which appears
to be the more modern/correct way of doing things.

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

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

5 years ago[clang-scan-deps] Fix -DBUILD_SHARED_LIBS=ON build
Sam Clegg [Thu, 13 Jun 2019 08:58:46 +0000 (08:58 +0000)]
[clang-scan-deps] Fix -DBUILD_SHARED_LIBS=ON build

The -DBUILD_SHARED_LIBS=ON build was broken in rL363204

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

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

5 years agoclang-format extension: Widen the supported versions range
Hans Wennborg [Thu, 13 Jun 2019 07:07:24 +0000 (07:07 +0000)]
clang-format extension: Widen the supported versions range

So that it covers also the latest VS 2019 version.

By Antonio Maiorano!

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

5 years agoRevert r361811: 'Re-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecess...
David L. Jones [Thu, 13 Jun 2019 02:04:45 +0000 (02:04 +0000)]
Revert r361811: 'Re-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors ...'

We have observed some failures with internal builds with this revision.

- Performance regressions:
  - llvm's SingleSource/Misc evalloop shows performance regressions (although these may be red herrings).
  - Benchmarks for Abseil's SwissTable.
- Correctness:
  - Failures for particular libicu tests when building the Google AppEngine SDK (for PHP).

hwennborg has already been notified, and is aware of reproducer failures.

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

5 years ago[clang-scan-deps] Include <mutex> in ClangScanDeps.cpp to ensure it
Alex Lorenz [Wed, 12 Jun 2019 21:52:36 +0000 (21:52 +0000)]
[clang-scan-deps] Include <mutex> in ClangScanDeps.cpp to ensure it
builds on all platforms

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

5 years agoNFC, Update the ClangScanDeps.cpp file's license comment
Alex Lorenz [Wed, 12 Jun 2019 21:45:28 +0000 (21:45 +0000)]
NFC, Update the ClangScanDeps.cpp file's license comment

The file ClangScanDeps.cpp from r363204 had the old outdated LLVM
license comment at the top of the file that I committed by accident.

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

5 years agoNFC, fixup indentation in CMakeLists.txt from r363204 as requested
Alex Lorenz [Wed, 12 Jun 2019 21:37:32 +0000 (21:37 +0000)]
NFC, fixup indentation in CMakeLists.txt from r363204 as requested
in the review.

I missed that review comment from https://reviews.llvm.org/D60233 in the original
commit.

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

5 years ago[clang-scan-deps] initial outline of the tool that runs preprocessor to find
Alex Lorenz [Wed, 12 Jun 2019 21:32:49 +0000 (21:32 +0000)]
[clang-scan-deps] initial outline of the tool that runs preprocessor to find
dependencies over a JSON compilation database

This commit introduces an outline for the clang-scan-deps tool that will be
used to implement fast dependency discovery phase using implicit modules for
explicit module builds.

The initial version of the tool works by computing non-modular header dependencies
for files in the compilation database without any optimizations
(i.e. without source minimization from r362459).
The tool spawns a number of worker threads to run the clang compiler workers in parallel.

The immediate goal for clang-scan-deps is to create a ClangScanDeps library
which will be used to build up this tool to use the source minimization and
caching multi-threaded filesystem to implement the optimized non-incremental
dependency scanning phase for a non-modular build. This will allow us to do
benchmarks and comparisons for performance that the minimization and caching give us

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

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

5 years ago[test] Reinstate the assignment to the diagnostic log in the unittest
Alex Lorenz [Wed, 12 Jun 2019 20:35:44 +0000 (20:35 +0000)]
[test] Reinstate the assignment to the diagnostic log in the unittest
from r363009

The diagnostic log is now set to "-" which forces it to use STDERR
instead of the filesystem. A new comment is added to explain why
the assignment is needed in the test.

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

5 years agoAdd comment to r363191 code as requested in code review
Reid Kleckner [Wed, 12 Jun 2019 19:50:06 +0000 (19:50 +0000)]
Add comment to r363191 code as requested in code review

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

5 years ago[MS] Pretend constexpr variable template specializations are inline
Reid Kleckner [Wed, 12 Jun 2019 18:53:49 +0000 (18:53 +0000)]
[MS] Pretend constexpr variable template specializations are inline

Fixes link errors with clang and the latest Visual C++ 14.21.27702
headers, which was reported as PR42027.

I chose to intentionally make these things linkonce_odr, i.e.
discardable, so that we don't emit definitions of these things in every
translation unit that includes STL headers.

Note that this is *not* what MSVC does: MSVC has not yet implemented C++
DR2387, so they emit fully specialized constexpr variable templates with
static / internal linkage.

Reviewers: rsmith

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

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

5 years agoPR42220: take into account the possibility of aggregates with base
Richard Smith [Wed, 12 Jun 2019 18:32:22 +0000 (18:32 +0000)]
PR42220: take into account the possibility of aggregates with base
classes when checking an InitListExpr for lifetime extension.

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

5 years ago[analyzer] ProgramPoint: more explicit printJson()
Csaba Dabis [Wed, 12 Jun 2019 18:24:02 +0000 (18:24 +0000)]
[analyzer] ProgramPoint: more explicit printJson()

Summary: Now we print out every possible kinds of ProgramPoints.

Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp, cfe-commits

Tags: #clang

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

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

5 years ago[NFC] Test commit
Nikolai Kosjar [Wed, 12 Jun 2019 07:50:48 +0000 (07:50 +0000)]
[NFC] Test commit

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

5 years ago[PowerPC] [Clang] Port SSE2 intrinsics to PowerPC
Zi Xuan Wu [Wed, 12 Jun 2019 05:25:40 +0000 (05:25 +0000)]
[PowerPC] [Clang] Port SSE2 intrinsics to PowerPC

Port emmintrin.h which include Intel SSE2 intrinsics implementation to PowerPC platform (using Altivec).

The new headers containing those implemenations are located into a directory named ppc_wrappers
which has higher priority when the platform is PowerPC on Linux. They are mainly developed by Steven Munroe,
with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu.

It's a follow-up patch of D62121.

Patched by: Qiu Chaofan <qiucf@cn.ibm.com>

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

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

5 years ago[X86] [ABI] Fix i386 ABI "__m64" type bug
Pengfei Wang [Wed, 12 Jun 2019 01:52:23 +0000 (01:52 +0000)]
[X86] [ABI] Fix i386 ABI "__m64" type bug

According to System V i386 ABI: the  __m64 type paramater and return
value are passed by MMX registers. But current implementation treats
__m64 as i64 which results in parameter passing by stack and returning
by EDX and EAX.

This patch fixes the bug (https://bugs.llvm.org/show_bug.cgi?id=41029)
for Linux and NetBSD.

Patch by Wei Xiao (wxiao3)

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

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

5 years agoMark declarations as referenced by a default argument in a
Richard Smith [Tue, 11 Jun 2019 23:51:46 +0000 (23:51 +0000)]
Mark declarations as referenced by a default argument in a
potentially-evaluated context.

This applies even if the use of the default argument is within an
unevaluated context.

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

5 years agoRemove redundant check for whether a DeclRefExpr that names a capture
Richard Smith [Tue, 11 Jun 2019 17:50:37 +0000 (17:50 +0000)]
Remove redundant check for whether a DeclRefExpr that names a capture
constitutes an odr-use.

We now track this accurately on the DeclRefExpr.

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

5 years agoFor DR712: store on a MemberExpr whether it constitutes an odr-use.
Richard Smith [Tue, 11 Jun 2019 17:50:36 +0000 (17:50 +0000)]
For DR712: store on a MemberExpr whether it constitutes an odr-use.

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

5 years agoFor DR712: store on a DeclRefExpr whether it constitutes an odr-use.
Richard Smith [Tue, 11 Jun 2019 17:50:32 +0000 (17:50 +0000)]
For DR712: store on a DeclRefExpr whether it constitutes an odr-use.

Begin restructuring to support the forms of non-odr-use reference
permitted by DR712.

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

5 years agoRevert r344630 Disable code object version 3 for HIP toolchain.
Yaxun Liu [Tue, 11 Jun 2019 15:05:11 +0000 (15:05 +0000)]
Revert r344630 Disable code object version 3 for HIP toolchain.

Remove the workaround so that by default code object v3 is enabled.

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

5 years agoFix for r42230, MSVC test failure in DependencyDirectivesSourceMinimizerTest.cpp
Erich Keane [Tue, 11 Jun 2019 14:58:26 +0000 (14:58 +0000)]
Fix for r42230, MSVC test failure in DependencyDirectivesSourceMinimizerTest.cpp

r362459 introduced DependencyDirectivesSourceMinimizerTest.cpp, which
hits an MSVC bug:
developercommunity.visualstudio.com/content/problem/67300/stringifying-raw-string-literal.html

This only happens when the parameter to a macro is stringified in the
macro.  This patch removes the string from the assert so that the
warning no longer happens.

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

5 years ago[NFC][PowerPC] Header-dependent test requires "native"
Hubert Tong [Tue, 11 Jun 2019 14:23:55 +0000 (14:23 +0000)]
[NFC][PowerPC] Header-dependent test requires "native"

Two recently added tests mention complications for cross-compile, but
they do not actually enforce native compilation. This patch makes them
require native compilation to avoid the complications they mention.

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

5 years agoReapply r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"
Hubert Tong [Tue, 11 Jun 2019 14:21:32 +0000 (14:21 +0000)]
Reapply r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"

Following r363007, which reverted r362998, r362996, and r362994,
reapply with adjustments for the CRLF differences encountered with
Windows. Namely, the `-b` option of `diff` is employed, and the `grep`
patterns have `$` replaced with `[[:space:]]*$`.

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

5 years ago[libclang] Allow skipping warnings from all included files
Nikolai Kosjar [Tue, 11 Jun 2019 14:14:24 +0000 (14:14 +0000)]
[libclang] Allow skipping warnings from all included files

Depending on the included files and the used warning flags, e.g. -
Weverything, a huge number of warnings can be reported for included
files. As processing that many diagnostics comes with a performance
impact and not all clients are interested in those diagnostics, add a
flag to skip them.

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

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

5 years ago[ASTImporter] Fix unhandled cases in ASTImporterLookupTable
Gabor Marton [Tue, 11 Jun 2019 13:35:25 +0000 (13:35 +0000)]
[ASTImporter] Fix unhandled cases in ASTImporterLookupTable

Summary:
In most cases the FriendDecl contains the declaration of the befriended
class as a child node, so it is discovered during the recursive
visitation. However, there are cases when the befriended class is not a
child, thus it must be fetched explicitly from the FriendDecl, and only
then can we add it to the lookup table.
(Note, this does affect only CTU and does not affect LLDB, because we
cannot and do not use the ASTImporterLookupTable in LLDB.)

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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

5 years ago[RISCV][NFC] Add missing test files for D54091
Lewis Revill [Tue, 11 Jun 2019 12:49:15 +0000 (12:49 +0000)]
[RISCV][NFC] Add missing test files for D54091

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

5 years ago[RISCV] Add inline asm constraints I, J & K for RISC-V
Lewis Revill [Tue, 11 Jun 2019 12:44:01 +0000 (12:44 +0000)]
[RISCV] Add inline asm constraints I, J & K for RISC-V

This allows the constraints I, J & K to be used in inline asm for
RISC-V, with the following semantics (equivalent to GCC):

I: Any 12-bit signed immediate.
J: Integer zero only.
K: Any 5-bit unsigned immediate.

See the GCC definitions here:
https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html

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

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

5 years agoMake sure a test from r363036 does not write into a working directory
Ilya Biryukov [Tue, 11 Jun 2019 12:05:03 +0000 (12:05 +0000)]
Make sure a test from r363036 does not write into a working directory

It breaks if build directory is not writable. This change is required
to fix our integrate.

Also add a flush() call, otherwise time trace option does not produce
the full output.

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

5 years ago[Frontend] Avoid creating auxilary files during a unit test. NFC
Ilya Biryukov [Tue, 11 Jun 2019 09:52:30 +0000 (09:52 +0000)]
[Frontend] Avoid creating auxilary files during a unit test. NFC

A test added in r363009 logs diagnostics into a file inside current
working directory. This breaks when the directory is not writable.

This looks like a debugging output in the first place, the test passes
without it anyway.

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

5 years ago[Support][Test] Time profiler: add regression test
Anton Afanasyev [Tue, 11 Jun 2019 08:25:54 +0000 (08:25 +0000)]
[Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

This is recommit of r362821

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

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

5 years ago[X86] Enable intrinsics that convert float and bf16 data to each other
Pengfei Wang [Tue, 11 Jun 2019 01:17:28 +0000 (01:17 +0000)]
[X86] Enable intrinsics that convert float and bf16 data to each other

Scalar version :
_mm_cvtsbh_ss , _mm_cvtness_sbh

Vector version:
_mm512_cvtpbh_ps , _mm256_cvtpbh_ps
_mm512_maskz_cvtpbh_ps , _mm256_maskz_cvtpbh_ps
_mm512_mask_cvtpbh_ps , _mm256_mask_cvtpbh_ps

Patch by Shengchen Kan (skan)

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

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

5 years ago[Frontend] SetUpDiagnosticLog should handle unowned diagnostic consumer
Alex Lorenz [Mon, 10 Jun 2019 23:32:42 +0000 (23:32 +0000)]
[Frontend] SetUpDiagnosticLog should handle unowned diagnostic consumer
in the compiler

The function SetUpDiagnosticLog that was called from createDiagnostics didn't
handle the case where the diagnostics engine didn't own the diagnostics consumer.
This is a potential problem for a clang tool, in particular some of the follow-up
patches for clang-scan-deps will need this fix.

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

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

5 years agoRevert r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"
Reid Kleckner [Mon, 10 Jun 2019 23:25:43 +0000 (23:25 +0000)]
Revert r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"

Reverts r362998, r362996, and r362994 because the tests do not pass on
Windows due to CRLF changes. Adding back `-w` to diff is not enough, the
new grep substitution doesn't work on Windows, and fixing it is
non-trivial.

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

5 years agoRequire stdcall etc parameters to be complete on ODR use
Reid Kleckner [Mon, 10 Jun 2019 22:53:12 +0000 (22:53 +0000)]
Require stdcall etc parameters to be complete on ODR use

Functions using stdcall, fastcall, or vectorcall with C linkage mangle
in the size of the parameter pack. Calculating the size of the pack
requires the parameter types to complete, which may require template
instantiation.

Previously, we would crash during IRgen when requesting the size of
incomplete or uninstantiated types, as in this reduced example:
  struct Foo;
  void __fastcall bar(struct Foo o);
  void (__fastcall *fp)(struct Foo) = &bar;

Reported in Chromium here: https://crbug.com/971245

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

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

5 years ago[analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)
Hubert Tong [Mon, 10 Jun 2019 22:40:35 +0000 (22:40 +0000)]
[analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `tail`. `%diff_plist` is then, being unused, removed.

The changes were applied via a script.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

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

Tags: #clang

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

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

5 years ago[analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)
Hubert Tong [Mon, 10 Jun 2019 22:37:31 +0000 (22:37 +0000)]
[analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `cat`.

The changes were applied via a script, except that
`clang/test/Analysis/NewDelete-path-notes.cpp` and
`clang/test/Analysis/plist-macros-with-expansion.cpp` were each adjusted
for the line-continuation on the relevant `RUN` step.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

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

Tags: #clang

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

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

5 years ago[analyzer][tests] Add normalize_plist to replace diff_plist
Hubert Tong [Mon, 10 Jun 2019 22:33:34 +0000 (22:33 +0000)]
[analyzer][tests] Add normalize_plist to replace diff_plist

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html to the
specific case shown in the list message. Mechanical changes to the other
affected files will follow in later patches.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years ago[PlistSupport] Produce a newline to end plist output files
Hubert Tong [Mon, 10 Jun 2019 22:30:57 +0000 (22:30 +0000)]
[PlistSupport] Produce a newline to end plist output files

Summary:
As suggested in the review of D62949, this patch updates the plist
output to have a newline at the end of the file. This makes it so that
the plist output file qualifies as a POSIX text file, which increases
the consumability of the generated plist file in relation to various
tools.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Reviewed By: NoQ, xingxue

Subscribers: jsji, cfe-commits

Tags: #clang

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

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

5 years ago[CUDA] Fix grep pattern in cuda-types.cu
Hubert Tong [Mon, 10 Jun 2019 22:28:20 +0000 (22:28 +0000)]
[CUDA] Fix grep pattern in cuda-types.cu

Summary:
vertical-line is not a BRE special character.

POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\|`
is undefined. This patch uses EREs instead.

Additionally, the pattern is further fixed so that `SIZEOF` and `WIDTH`
macros are checked.

Reviewers: jlebar, daltenty, xingxue, jasonliu, tra

Reviewed By: tra

Subscribers: jfb, jsji, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Attempt to make the Intel core CPU inheritance a little more readable and maint...
Craig Topper [Mon, 10 Jun 2019 16:59:28 +0000 (16:59 +0000)]
[X86] Attempt to make the Intel core CPU inheritance a little more readable and maintainable

The recently added cooperlake CPU has made our already ugly switch statement even worse. There's a CPU exclusion list around the bf16 feature in the cooper lake block. I worry that we'll have to keep adding new CPUs to that until bf16 intercepts a client space CPU. We have several other exclusion lists in other parts of the switch due to skylakeserver, cascadelake, and cooperlake not having sgx. Another for cannonlake not having clwb but having all other features from skx.

This removes all these special ifs at the cost of some duplication of features and a goto. I've copied all of the skx features into either cannonlake or icelakeclient(for clwb). And pulled sklyakeserver, cascadelake, and cooperlake out of the main inheritance chain into their own chain. At the end of skylakeserver we merge back into the main chain at skylakeclient but below sgx. I think this is at least easier to follow.

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

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

5 years ago[WebAssembly] Cleanup toolchain test files. NFC.
Sam Clegg [Mon, 10 Jun 2019 16:18:04 +0000 (16:18 +0000)]
[WebAssembly] Cleanup toolchain test files. NFC.

Summary: Split up long lines to improve test readability.

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, jfb, cfe-commits

Tags: #clang

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

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

5 years agoRe-land "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified...
Sam McCall [Mon, 10 Jun 2019 15:17:52 +0000 (15:17 +0000)]
Re-land "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."

ShadowMapEntry is now really, truly a normal class.

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

5 years agoRevert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified...
Sam McCall [Mon, 10 Jun 2019 14:55:57 +0000 (14:55 +0000)]
Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."

This reverts commit r362924, which causes a double-free of ShadowMapEntry.

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

5 years agoRevert "Revert "[CodeComplete] Improve overload handling for C++ qualified and ref...
Sam McCall [Mon, 10 Jun 2019 09:52:09 +0000 (09:52 +0000)]
Revert "Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.""

This reverts commit r362830, and relands r362785 with the leak fixed.

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

5 years ago[analyzer][NFC] Add dividers to BugReporterVisitors.cpp
Kristof Umann [Sat, 8 Jun 2019 20:25:39 +0000 (20:25 +0000)]
[analyzer][NFC] Add dividers to BugReporterVisitors.cpp

Some minor formatting to make the file more readable.
Added //===----------===// around the implementation of class methods
and divided anonymous namespaces as per
https://llvm.org/docs/CodingStandards.html#anonymous-namespaces

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

5 years ago[analyzer][NFC][tests] Pre-normalize expected-plists
Hubert Tong [Sat, 8 Jun 2019 13:51:37 +0000 (13:51 +0000)]
[analyzer][NFC][tests] Pre-normalize expected-plists

As suggested in the review for D62949, this patch pre-normalizes the
reference expected output plist files by removing lines containing
fields for which we expect differences that should be ignored.

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

5 years ago[analyzer][NFC][tests] Remove unused expected-plist files
Hubert Tong [Sat, 8 Jun 2019 13:48:25 +0000 (13:48 +0000)]
[analyzer][NFC][tests] Remove unused expected-plist files

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

5 years agoDebugInfo: Add support for 'nodebug' attribute on typedefs and alias templates
David Blaikie [Sat, 8 Jun 2019 00:01:21 +0000 (00:01 +0000)]
DebugInfo: Add support for 'nodebug' attribute on typedefs and alias templates

Seems like a logical extension to me - and of interest because it might
help reduce the debug info size of libc++ by applying this attribute to
type traits that have a disproportionate debug info cost compared to the
benefit (& possibly harm/confusion) they cause users.

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

5 years ago[analyzer] Add werror flag for analyzer warnings
Keno Fischer [Fri, 7 Jun 2019 23:34:00 +0000 (23:34 +0000)]
[analyzer] Add werror flag for analyzer warnings

Summary:
We're using the clang static analyzer together with a number of
custom analyses in our CI system to ensure that certain invariants
are statiesfied for by the code every commit. Unfortunately, there
currently doesn't seem to be a good way to determine whether any
analyzer warnings were emitted, other than parsing clang's output
(or using scan-build, which then in turn parses clang's output).
As a simpler mechanism, simply add a `-analyzer-werror` flag to CC1
that causes the analyzer to emit its warnings as errors instead.
I briefly tried to have this be `Werror=analyzer` and make it go
through that machinery instead, but that seemed more trouble than
it was worth in terms of conflicting with options to the actual build
and special cases that would be required to circumvent the analyzers
usual attempts to quiet non-analyzer warnings. This is simple and it
works well.

Reviewed-By: NoQ, Szelethusw
Differential Revision: https://reviews.llvm.org/D62885

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

5 years agoRelax test so that the clang binary doesn't need to be named "clang".
Peter Collingbourne [Fri, 7 Jun 2019 20:26:47 +0000 (20:26 +0000)]
Relax test so that the clang binary doesn't need to be named "clang".

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

5 years agoRevert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified...
Vlad Tsyrklevich [Fri, 7 Jun 2019 19:18:30 +0000 (19:18 +0000)]
Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."

This reverts commit f1f6e0fc2468e9c120b22b939507c527d08b8ee8, it was
causing LSan failures on the sanitizer bots:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/32809

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

5 years agoDriver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.
Peter Collingbourne [Fri, 7 Jun 2019 19:10:08 +0000 (19:10 +0000)]
Driver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.

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

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

5 years agoRevert "[Support][Test] Time profiler: add regression test"
Anton Afanasyev [Fri, 7 Jun 2019 18:35:58 +0000 (18:35 +0000)]
Revert "[Support][Test] Time profiler: add regression test"

This reverts commit 44282a60c90fdded249d57d91b12c6c0907102ec.
This breaks buildbot.

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

5 years ago[Support][Test] Time profiler: add regression test
Anton Afanasyev [Fri, 7 Jun 2019 18:13:48 +0000 (18:13 +0000)]
[Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 362792

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

5 years agoRevert rL362792 : [Support][Test] Time profiler: add regression test
Simon Pilgrim [Fri, 7 Jun 2019 17:37:04 +0000 (17:37 +0000)]
Revert rL362792 : [Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D61914
........
Breaks buildbots - @anton-afanasyev please can you take a look?

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

5 years ago[ARM] Add ACLE feature macros for MVE.
David Green [Fri, 7 Jun 2019 17:28:12 +0000 (17:28 +0000)]
[ARM] Add ACLE feature macros for MVE.

Fixup uninitialised variable.

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