]> granicus.if.org Git - clang/log
clang
5 years ago[c++20] Add rewriting from comparison operators to <=> / ==.
Richard Smith [Sat, 19 Oct 2019 00:04:43 +0000 (00:04 +0000)]
[c++20] Add rewriting from comparison operators to <=> / ==.

This adds support for rewriting <, >, <=, and >= to a normal or reversed
call to operator<=>, for rewriting != to a normal or reversed call to
operator==, and for rewriting <=> and == to reversed forms of those same
operators.

Note that this is a breaking change for various C++17 code patterns,
including some in use in LLVM. The most common patterns (where an
operator== becomes ambiguous with a reversed form of itself) are still
accepted under this patch, as an extension (with a warning). I'm hopeful
that we can get the language rules fixed before C++20 ships, and the
extension warning is aimed primarily at providing data to inform that
decision.

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

5 years ago[c++20] Add CXXRewrittenBinaryOperator to represent a comparison
Richard Smith [Sat, 19 Oct 2019 00:04:38 +0000 (00:04 +0000)]
[c++20] Add CXXRewrittenBinaryOperator to represent a comparison
operator that is rewritten as a call to multiple other operators.

No functionality change yet: nothing creates these expressions.

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

5 years agoDebugInfo: Render the canonical name of a class template specialization, even when...
David Blaikie [Fri, 18 Oct 2019 23:58:34 +0000 (23:58 +0000)]
DebugInfo: Render the canonical name of a class template specialization, even when nested in another class template specialization

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

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

5 years ago[profile] Do not cache __llvm_profile_get_filename result
Vedant Kumar [Fri, 18 Oct 2019 23:33:40 +0000 (23:33 +0000)]
[profile] Do not cache __llvm_profile_get_filename result

When the %m filename pattern is used, the filename is unique to each
image, so the cached value is wrong.

It struck me that the full filename isn't something that's recomputed
often, so perhaps it doesn't need to be cached at all. David Li pointed
out we can go further and just hide lprofCurFilename. This may regress
workflows that depend on using the set-filename API to change filenames
across all loaded DSOs, but this is expected to be very rare.

rdar://55137071

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

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

5 years ago[analyzer] exploded-graph-rewriter: Unforget to censor stmt_ids in the test.
Artem Dergachev [Fri, 18 Oct 2019 20:48:21 +0000 (20:48 +0000)]
[analyzer] exploded-graph-rewriter: Unforget to censor stmt_ids in the test.

They're not stable across machines.

Fixes buildbots after r375278.

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

5 years ago[analyzer] exploded-graph-rewriter: Rename Environment to Expressions.
Artem Dergachev [Fri, 18 Oct 2019 20:15:41 +0000 (20:15 +0000)]
[analyzer] exploded-graph-rewriter: Rename Environment to Expressions.

It's less confusing for newcomers.

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

5 years ago[analyzer] Fix FieldRegion dumps.
Artem Dergachev [Fri, 18 Oct 2019 20:15:39 +0000 (20:15 +0000)]
[analyzer] Fix FieldRegion dumps.

The '->' thing has always been confusing; the actual operation '->'
translates to a pointer dereference together with adding a FieldRegion,
but FieldRegion on its own doesn't imply an additional pointer
dereference.

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

5 years ago[analyzer] Drop the logic for collapsing the state if it's same as in preds.
Artem Dergachev [Fri, 18 Oct 2019 20:15:35 +0000 (20:15 +0000)]
[analyzer] Drop the logic for collapsing the state if it's same as in preds.

One of the first attempts to reduce the size of the exploded graph dumps
was to skip the state dump as long as the state is the same as in all of
the predecessor nodes. With all the new facilities in place (node joining,
diff dumps), this feature doesn't do much, and when it does,
it's more harmful than useful. Let's remove it.

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

5 years ago[analyzer] exploded-graph-rewriter: Fix dump for state 0.
Artem Dergachev [Fri, 18 Oct 2019 20:15:32 +0000 (20:15 +0000)]
[analyzer] exploded-graph-rewriter: Fix dump for state 0.

It shouldn't say "unspecified" when the state is specified to be empty.

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

5 years ago[analyzer] Fix hidden node traversal in exploded graph dumps.
Artem Dergachev [Fri, 18 Oct 2019 20:15:29 +0000 (20:15 +0000)]
[analyzer] Fix hidden node traversal in exploded graph dumps.

The joined nodes now actually have the same state. That was intended
from the start but the original implementation turned out to be buggy.

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

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

5 years ago[Format] Add format check for throwing negative numbers
Brian Gesiak [Fri, 18 Oct 2019 16:59:02 +0000 (16:59 +0000)]
[Format] Add format check for throwing negative numbers

Summary:
The code `throw -1;` is currently formatted by clang-format as
`throw - 1;`. This diff adds a fix for this edge case and a test to check
for this in the future.

For context, I am looking into a related bug in the clang-formatting of
coroutine keywords: `co_yield -1;` is also reformatted in this manner
as `co_yield - 1;`. A later diff will add these changes and tests for the
`co_yield` and `co_return` keywords.

Patch by Jonathan Thomas (jonathoma)!

Reviewers: modocache, sammccall, Quuxplusone

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

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

5 years ago[DOCS]Update list of implemented constructs, NFC.
Alexey Bataev [Fri, 18 Oct 2019 16:53:54 +0000 (16:53 +0000)]
[DOCS]Update list of implemented constructs, NFC.

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

5 years ago[OPENMP50]Add support for master taskloop simd.
Alexey Bataev [Fri, 18 Oct 2019 16:47:35 +0000 (16:47 +0000)]
[OPENMP50]Add support for master taskloop simd.

Added  trsing/semantics/codegen for combined construct master taskloop simd.

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

5 years ago[clang-format] fix regression recognizing casts in Obj-C calls
Krasimir Georgiev [Fri, 18 Oct 2019 15:21:06 +0000 (15:21 +0000)]
[clang-format] fix regression recognizing casts in Obj-C calls

Summary:
r373922 added checks for a few tokens that, following an `)` make it
unlikely that the `)` is the closing paren of a cast expression. The
specific check for `tok::l_square` there introduced a regression for
casts of Obj-C calls, like:
```
(cast)[func arg]
```
From the tests added in r373922, I believe the `tok::l_square` case is added to
capture the case where a non-cast `)` is directly followed by an
attribute specifier, like:
```
int f(int x) [[noreturn]];
```

I've specialized the code to look for such attribute specifier instead
of `tok::l_square` in general. Also, I added a regression test and moved
the test cases added in r373922 to an already existing place documenting
other instances of historically misidentified casts.

Reviewers: MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[tooling] Relax an assert when multiple GPU targets are specified.
Michael Liao [Fri, 18 Oct 2019 15:03:34 +0000 (15:03 +0000)]
[tooling] Relax an assert when multiple GPU targets are specified.

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

5 years ago[ThinLTOCodeGenerator] Add support for index-based WPD
Eugene Leviant [Fri, 18 Oct 2019 11:58:21 +0000 (11:58 +0000)]
[ThinLTOCodeGenerator] Add support for index-based WPD

This is clang part of the patch. It adds -flto-unit flag for thin LTO
builds on Mac and PS4

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

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

5 years ago[WebAssembly] -pthread implies -target-feature +sign-ext
Thomas Lively [Fri, 18 Oct 2019 04:34:26 +0000 (04:34 +0000)]
[WebAssembly] -pthread implies -target-feature +sign-ext

Summary:
The sign extension proposal was motivated by a desire to not have
separate sign-extending atomic operations, so it is meant to be
enabled when threads are used.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, jfb, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] exploded-graph-rewriter: Fix typo in r375186. Unbreaks tests.
Artem Dergachev [Thu, 17 Oct 2019 23:27:35 +0000 (23:27 +0000)]
[analyzer] exploded-graph-rewriter: Fix typo in r375186. Unbreaks tests.

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

5 years ago[analyzer] Assign truly stable identifiers to exploded nodes.
Artem Dergachev [Thu, 17 Oct 2019 23:10:09 +0000 (23:10 +0000)]
[analyzer] Assign truly stable identifiers to exploded nodes.

ExplodedGraph nodes will now have a numeric identifier stored in them
which will keep track of the order in which the nodes were created
and it will be fully deterministic both accross runs and across machines.

This is extremely useful for debugging as it allows reliably setting
conditional breakpoints by node IDs.

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

5 years ago[analyzer] Display cast kinds in program point dumps.
Artem Dergachev [Thu, 17 Oct 2019 23:10:05 +0000 (23:10 +0000)]
[analyzer] Display cast kinds in program point dumps.

Because cast expressions have their own hierarchy, it's extremely useful
to have some information about what kind of casts are we dealing with.

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

5 years ago[analyzer] exploded-graph-rewriter: Make node headers a bit lighter.
Artem Dergachev [Thu, 17 Oct 2019 23:10:02 +0000 (23:10 +0000)]
[analyzer] exploded-graph-rewriter: Make node headers a bit lighter.

The 50% grey color is too dark on some monitors.

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

5 years ago[ARM] Fix arm_neon.h with -flax-vector-conversions=none, part 3
Eli Friedman [Thu, 17 Oct 2019 21:57:28 +0000 (21:57 +0000)]
[ARM] Fix arm_neon.h with -flax-vector-conversions=none, part 3

It's completely impossible to check that I've actually found all the
issues, due to the use of macros in arm_neon.h, but hopefully this time
it'll take more than a few hours for someone to find another issue.

I have no idea why, but apparently there's a rule that some, but not
all, builtins which should take an fp16 vector actually take an int8
vector as an argument.  Fix this, and add test coverage.

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

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

5 years ago[clang-offload-wrapper][NFC] Use captured name of the entry type in LIT test
Sergey Dmitriev [Thu, 17 Oct 2019 21:55:39 +0000 (21:55 +0000)]
[clang-offload-wrapper][NFC] Use captured name of the entry type in LIT test

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

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

5 years ago[OPENMP]Dow not emit warnings for uninitialized loop counters.
Alexey Bataev [Thu, 17 Oct 2019 20:35:08 +0000 (20:35 +0000)]
[OPENMP]Dow not emit warnings for uninitialized loop counters.

In OpenMP constructs all counters are initialized and we should not emit
warnings about uninitialized privatized loop control variables.

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

5 years ago[OPENMP]Improve use of the global tid parameter.
Alexey Bataev [Thu, 17 Oct 2019 17:12:03 +0000 (17:12 +0000)]
[OPENMP]Improve use of the global tid parameter.

If we can determined, that the global tid parameter can be used in the
function, better to use it rather than calling __kmpc_global_thread_num
function.

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

5 years ago[ObjC] Diagnose implicit type coercion from ObjC 'Class' to object
James Y Knight [Thu, 17 Oct 2019 15:27:04 +0000 (15:27 +0000)]
[ObjC] Diagnose implicit type coercion from ObjC 'Class' to object
pointer types.

For example, in Objective-C mode, the initialization of 'x' in:
```
  @implementation MyType
  + (void)someClassMethod {
    MyType *x = self;
  }
  @end
```
is correctly diagnosed with an incompatible-pointer-types warning, but
in Objective-C++ mode, it is not diagnosed at all -- even though
incompatible pointer conversions generally become an error in C++.

This patch fixes that oversight, allowing implicit conversions
involving Class only to/from unqualified-id, and between qualified and
unqualified Class, where the protocols are compatible.

Note that this does change some behaviors in Objective-C, as well, as
shown by the modified tests.

Of particular note is that assignment from from 'Class<MyProtocol>' to
'id<MyProtocol>' now warns. (Despite appearances, those are not
compatible types. 'Class<MyProtocol>' is not expected to have instance
methods defined by 'MyProtocol', while 'id<MyProtocol>' is.)

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

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

5 years ago[ObjC] Add some additional test cases around pointer conversions.
James Y Knight [Thu, 17 Oct 2019 15:18:59 +0000 (15:18 +0000)]
[ObjC] Add some additional test cases around pointer conversions.

This is especially important for Objective-C++, which is entirely
missing this testing at the moment.

This annotates with "FIXME" the cases which I change in the next
patch -- I primarily wanted to document the current state of things so
that the effect of the code change is made clear.

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

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

5 years ago[OPENMP]Fix thread id passed to outlined region in sequential parallel
Alexey Bataev [Thu, 17 Oct 2019 14:36:43 +0000 (14:36 +0000)]
[OPENMP]Fix thread id passed to outlined region in sequential parallel
regions.

The real global thread id must be passed to the outlined region instead
of the zero thread id.

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

5 years ago[OpenCL] Preserve addrspace in CGClass (PR43145)
Sven van Haastregt [Thu, 17 Oct 2019 14:12:51 +0000 (14:12 +0000)]
[OpenCL] Preserve addrspace in CGClass (PR43145)

PR43145 revealed two places where Clang was attempting to create a
bitcast without considering the address space of class types during
C++ class code generation.

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

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

5 years ago[OpenCL] Add doc to describe OpenCL support
Sven van Haastregt [Thu, 17 Oct 2019 12:56:02 +0000 (12:56 +0000)]
[OpenCL] Add doc to describe OpenCL support

The idea of this page is to document work in progress functionality
and also describe the plan of future development work.

Patch by Anastasia Stulova.

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

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

5 years agoInclude leading attributes in DeclStmt's SourceRange
Stephan Bergmann [Thu, 17 Oct 2019 11:20:21 +0000 (11:20 +0000)]
Include leading attributes in DeclStmt's SourceRange

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

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

5 years agoSemaExprCXX - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Thu, 17 Oct 2019 11:12:31 +0000 (11:12 +0000)]
SemaExprCXX - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

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

5 years agoSemaDeclObjC - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Thu, 17 Oct 2019 10:35:29 +0000 (10:35 +0000)]
SemaDeclObjC - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

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

5 years agoReland: Dead Virtual Function Elimination
Oliver Stannard [Thu, 17 Oct 2019 09:58:57 +0000 (09:58 +0000)]
Reland: Dead Virtual Function Elimination

Remove dead virtual functions from vtables with
replaceNonMetadataUsesWith, so that CGProfile metadata gets cleaned up
correctly.

Original commit message:

Currently, it is hard for the compiler to remove unused C++ virtual
functions, because they are all referenced from vtables, which are referenced
by constructors. This means that if the constructor is called from any live
code, then we keep every virtual function in the final link, even if there
are no call sites which can use it.

This patch allows unused virtual functions to be removed during LTO (and
regular compilation in limited circumstances) by using type metadata to match
virtual function call sites to the vtable slots they might load from. This
information can then be used in the global dead code elimination pass instead
of the references from vtables to virtual functions, to more accurately
determine which functions are reachable.

To make this transformation safe, I have changed clang's code-generation to
always load virtual function pointers using the llvm.type.checked.load
intrinsic, instead of regular load instructions. I originally tried writing
this using clang's existing code-generation, which uses the llvm.type.test
and llvm.assume intrinsics after doing a normal load. However, it is possible
for optimisations to obscure the relationship between the GEP, load and
llvm.type.test, causing GlobalDCE to fail to find virtual function call
sites.

The existing linkage and visibility types don't accurately describe the scope
in which a virtual call could be made which uses a given vtable. This is
wider than the visibility of the type itself, because a virtual function call
could be made using a more-visible base class. I've added a new
!vcall_visibility metadata type to represent this, described in
TypeMetadata.rst. The internalization pass and libLTO have been updated to
change this metadata when linking is performed.

This doesn't currently work with ThinLTO, because it needs to see every call
to llvm.type.checked.load in the linkage unit. It might be possible to
extend this optimisation to be able to use the ThinLTO summary, as was done
for devirtualization, but until then that combination is rejected in the
clang driver.

To test this, I've written a fuzzer which generates random C++ programs with
complex class inheritance graphs, and virtual functions called through object
and function pointers of different types. The programs are spread across
multiple translation units and DSOs to test the different visibility
restrictions.

I've also tried doing bootstrap builds of LLVM to test this. This isn't
ideal, because only classes in anonymous namespaces can be optimised with
-fvisibility=default, and some parts of LLVM (plugins and bugpoint) do not
work correctly with -fvisibility=hidden. However, there are only 12 test
failures when building with -fvisibility=hidden (and an unmodified compiler),
and this change does not cause any new failures for either value of
-fvisibility.

On the 7 C++ sub-benchmarks of SPEC2006, this gives a geomean code-size
reduction of ~6%, over a baseline compiled with "-O2 -flto
-fvisibility=hidden -fwhole-program-vtables". The best cases are reductions
of ~14% in 450.soplex and 483.xalancbmk, and there are no code size
increases.

I've also run this on a set of 8 mbed-os examples compiled for Armv7M, which
show a geomean size reduction of ~3%, again with no size increases.

I had hoped that this would have no effect on performance, which would allow
it to awlays be enabled (when using -fwhole-program-vtables). However, the
changes in clang to use the llvm.type.checked.load intrinsic are causing ~1%
performance regression in the C++ parts of SPEC2006. It should be possible to
recover some of this perf loss by teaching optimisations about the
llvm.type.checked.load intrinsic, which would make it worth turning this on
by default (though it's still dependent on -fwhole-program-vtables).

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

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

5 years agoRevert "Include sanitize blacklist and other extra deps as part of scan-deps output"
Kousik Kumar [Thu, 17 Oct 2019 04:50:12 +0000 (04:50 +0000)]
Revert "Include sanitize blacklist and other extra deps as part of scan-deps output"

This test is failing on Windows bots, revert for now (will check the right fix and retry the patch).

Summary: This reverts commit 962ca076e51c25a7a08f4e0d329c65328a635bdb.

Reviewers: Bigcheese, jkorous, arphaman

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

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

5 years agoInclude sanitize blacklist and other extra deps as part of scan-deps output
Kousik Kumar [Thu, 17 Oct 2019 02:14:44 +0000 (02:14 +0000)]
Include sanitize blacklist and other extra deps as part of scan-deps output

Summary:
Clang's -M mode includes these extra dependencies in its output and clang-scan-deps
should have equivalent behavior, so adding these extradeps to output just like
how its being done for ".d" file generation mode.

Reviewers: arphaman, dexonsmith, Bigcheese, jkorous

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoRevert Tag CFI-generated data structures with "#pragma clang section" attributes.
Dmitry Mikulin [Thu, 17 Oct 2019 00:55:38 +0000 (00:55 +0000)]
Revert Tag CFI-generated data structures with "#pragma clang section" attributes.

This reverts r375022 (git commit e2692b3bc0327606748b6d291b9009d2c845ced5)

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

5 years ago[Concepts] ConceptSpecializationExprs mangling
Saar Raz [Thu, 17 Oct 2019 00:16:01 +0000 (00:16 +0000)]
[Concepts] ConceptSpecializationExprs mangling

Implement mangling for CSEs to match regular template-ids.
Reviewed as part of D41569 <https://reviews.llvm.org/D41569>.

Re-commit fixing failing test.

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

5 years agoReplace platform-dependent `stat` with `llvm::sys::fs::status`. NFC intended.
Volodymyr Sapsai [Wed, 16 Oct 2019 19:12:34 +0000 (19:12 +0000)]
Replace platform-dependent `stat` with `llvm::sys::fs::status`. NFC intended.

Reviewers: bruno, sammccall

Reviewed By: sammccall

Subscribers: jkorous, dexonsmith, arphaman, ributzka, cfe-commits

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

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

5 years agoFix darwin-ld-lto test for some speical path
Steven Wu [Wed, 16 Oct 2019 18:12:41 +0000 (18:12 +0000)]
Fix darwin-ld-lto test for some speical path

Fix the test by not assuming the prefix path of the temp directory can
be matched by a regex.

rdar://problem/56259195

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

5 years ago[OPENMP]Allow priority clause in combined task-based directives.
Alexey Bataev [Wed, 16 Oct 2019 18:09:37 +0000 (18:09 +0000)]
[OPENMP]Allow priority clause in combined task-based directives.

The expression of the priority clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.

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

5 years agoTag CFI-generated data structures with "#pragma clang section" attributes.
Dmitry Mikulin [Wed, 16 Oct 2019 17:51:40 +0000 (17:51 +0000)]
Tag CFI-generated data structures with "#pragma clang section" attributes.

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

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

5 years ago[OPENMP]Use different addresses for zeroed thread_id/bound_id.
Alexey Bataev [Wed, 16 Oct 2019 16:59:01 +0000 (16:59 +0000)]
[OPENMP]Use different addresses for zeroed thread_id/bound_id.

When the parallel region is called directly in the sequential region,
the zeroed tid/bound id are used. But they must point to the different
memory locations as the parameters are marked as noalias.

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

5 years ago[DWARF5] Added support for DW_AT_noreturn attribute to be emitted for
Adrian Prantl [Wed, 16 Oct 2019 16:30:38 +0000 (16:30 +0000)]
[DWARF5] Added support for DW_AT_noreturn attribute to be emitted for
C++ class member functions.

Patch by Sourabh Singh Tomar!

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

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

5 years ago[libTooling] Fix r374962: add more Transformer forwarding decls.
Yitzhak Mandelbaum [Wed, 16 Oct 2019 14:26:20 +0000 (14:26 +0000)]
[libTooling] Fix r374962: add more Transformer forwarding decls.

Summary:
The move to a new, single namespace in r374962 left out some type definitions
from the old namespace and resulted in one naming conflict (`text`).  This
revision adds aliases for those definitions and removes one of the `text`
functions from the new namespace.

Reviewers: alexfh

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Driver,ARM] Make -mfloat-abi=soft turn off MVE.
Simon Tatham [Wed, 16 Oct 2019 13:23:39 +0000 (13:23 +0000)]
[Driver,ARM] Make -mfloat-abi=soft turn off MVE.

Since `-mfloat-abi=soft` is taken to mean turning off all uses of the
FP registers, it should turn off the MVE vector instructions as well
as NEON and scalar FP. But it wasn't doing so.

So the options `-march=armv8.1-m.main+mve.fp+fp.dp -mfloat-abi=soft`
would cause the underlying LLVM to //not// support MVE (because it
knows the real target feature relationships and turned off MVE when
the `fpregs` feature was removed), but the clang layer still thought
it //was// supported, and would misleadingly define the feature macro
`__ARM_FEATURE_MVE`.

The ARM driver code already has a long list of feature names to turn
off when `-mfloat-abi=soft` is selected. The fix is to add the missing
entries `mve` and `mve.fp` to that list.

Reviewers: dmgreen

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

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

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

5 years agoRewriteModernObjC - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Wed, 16 Oct 2019 10:50:06 +0000 (10:50 +0000)]
RewriteModernObjC - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

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

5 years agoCGDebugInfo - silence static analyzer dyn_cast<> null dereference warnings. NFCI.
Simon Pilgrim [Wed, 16 Oct 2019 10:38:49 +0000 (10:38 +0000)]
CGDebugInfo - silence static analyzer dyn_cast<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use cast<> directly and if not assert will fire for us.

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

5 years agoCGExprConstant - silence static analyzer getAs<> null dereference warning. NFCI.
Simon Pilgrim [Wed, 16 Oct 2019 10:38:40 +0000 (10:38 +0000)]
CGExprConstant - silence static analyzer getAs<> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

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

5 years agoCGBuiltin - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Wed, 16 Oct 2019 10:38:32 +0000 (10:38 +0000)]
CGBuiltin - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

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

5 years agoRevert 374967 "[Concepts] ConceptSpecializationExprs mangling"
Nico Weber [Wed, 16 Oct 2019 10:23:53 +0000 (10:23 +0000)]
Revert 374967 "[Concepts] ConceptSpecializationExprs mangling"

This reverts commit 5e34ad109ced8dbdea9500ee28180315b2aeba3d.

The mangling test fails on Windows:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15944

It also fails on ppc64le:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/21092

Also revert follow-up  374971 "Fix failing mangle-concept.cpp test."
(it did not help on Win/ppc64le).

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

5 years agoFix failing mangle-concept.cpp test.
Saar Raz [Wed, 16 Oct 2019 02:56:40 +0000 (02:56 +0000)]
Fix failing mangle-concept.cpp test.

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

5 years ago[Concepts] ConceptSpecializationExprs mangling
Saar Raz [Wed, 16 Oct 2019 02:33:41 +0000 (02:33 +0000)]
[Concepts] ConceptSpecializationExprs mangling

Implement mangling for CSEs to match regular template-ids.
Reviewed as part of D41569.

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

5 years ago[libTooling] Put all Transformer declarations in a single namespace.
Yitzhak Mandelbaum [Wed, 16 Oct 2019 01:06:46 +0000 (01:06 +0000)]
[libTooling] Put all Transformer declarations in a single namespace.

Summary:
This revision introduces a new namespace, `clang::transformer`, to hold
the declarations for the Transformer library.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoPR43674: fix incorrect constant evaluation of 'switch' where no case
Richard Smith [Tue, 15 Oct 2019 22:23:11 +0000 (22:23 +0000)]
PR43674: fix incorrect constant evaluation of 'switch' where no case
label corresponds to the condition.

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

5 years agoRemove unnecessary and inappropriate forward-declaration of Sema from
Richard Smith [Tue, 15 Oct 2019 21:50:24 +0000 (21:50 +0000)]
Remove unnecessary and inappropriate forward-declaration of Sema from
AST.

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

5 years ago[OPENMP]Fix comments/params, NFC.
Alexey Bataev [Tue, 15 Oct 2019 19:51:30 +0000 (19:51 +0000)]
[OPENMP]Fix comments/params, NFC.

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

5 years ago[OPENMP]Allow final clause in combined task-based directives.
Alexey Bataev [Tue, 15 Oct 2019 19:37:05 +0000 (19:37 +0000)]
[OPENMP]Allow final clause in combined task-based directives.
The condition of the final clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.

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

5 years ago[Concept] Associated Constraints Infrastructure
Saar Raz [Tue, 15 Oct 2019 18:44:06 +0000 (18:44 +0000)]
[Concept] Associated Constraints Infrastructure

Add code to correctly calculate the associated constraints of a template (no enforcement yet).
D41284 on Phabricator.

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

5 years ago[Clang][OpenMP Offload] Move offload registration code to the wrapper
Sergey Dmitriev [Tue, 15 Oct 2019 18:42:47 +0000 (18:42 +0000)]
[Clang][OpenMP Offload] Move offload registration code to the wrapper

The final list of OpenMP offload targets becomes known only at the link time and since offload registration code depends on the targets list it makes sense to delay offload registration code generation to the link time instead of adding it to the host part of every fat object. This patch moves offload registration code generation from clang to the offload wrapper tool.

This is the last part of the OpenMP linker script elimination patch https://reviews.llvm.org/D64943

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

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

5 years agoFix as-w-option.c on Windows where no assembler exists
Reid Kleckner [Tue, 15 Oct 2019 18:39:41 +0000 (18:39 +0000)]
Fix as-w-option.c on Windows where no assembler exists

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

5 years agoAdded support for "#pragma clang section relro=<name>"
Dmitry Mikulin [Tue, 15 Oct 2019 18:31:10 +0000 (18:31 +0000)]
Added support for "#pragma clang section relro=<name>"

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

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

5 years ago[clang] refactor -Wa,-W test cases.
Jian Cai [Tue, 15 Oct 2019 18:17:08 +0000 (18:17 +0000)]
[clang] refactor -Wa,-W test cases.

Remove REQUIRES and only keep the clang driver tests, since the
assembler are already tested with -Wa,--no-warn. This way we could run
the test on non-linux platforms and catch breaks on them.

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

5 years agoFix Driver/working-directory.c test
Jan Korous [Tue, 15 Oct 2019 18:04:18 +0000 (18:04 +0000)]
Fix Driver/working-directory.c test

Accidentally committed debug print.

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

5 years agoReland [Driver] Fix -working-directory issues
Jan Korous [Tue, 15 Oct 2019 17:51:59 +0000 (17:51 +0000)]
Reland [Driver] Fix -working-directory issues

Don't change the default VFS in Driver, update tests & reland.

This reverts commit 999f8a7416f8edc54ef92e715fd23c532bcc74d4.

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

5 years agoAdd more information to JSON AST dumping of source locations.
Aaron Ballman [Tue, 15 Oct 2019 17:30:19 +0000 (17:30 +0000)]
Add more information to JSON AST dumping of source locations.

This adds information about the offset within the source file to the given source location as well as information about the include file a location is from. These pieces of information allow for more efficient post-processing of JSON AST dumps.

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

5 years agoCFI: wrong type passed to llvm.type.test with multiple inheritance devirtualization.
Dmitry Mikulin [Tue, 15 Oct 2019 16:32:50 +0000 (16:32 +0000)]
CFI: wrong type passed to llvm.type.test with multiple inheritance devirtualization.

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

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

5 years ago[Concepts] Remove unused and illegal Sema includes from ExprCXX.cpp
Saar Raz [Tue, 15 Oct 2019 15:49:29 +0000 (15:49 +0000)]
[Concepts] Remove unused and illegal Sema includes from ExprCXX.cpp

Fixing accidental includes introduced in 374903

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

5 years ago[Concepts] Concept Specialization Expressions
Saar Raz [Tue, 15 Oct 2019 15:24:26 +0000 (15:24 +0000)]
[Concepts] Concept Specialization Expressions

Part of C++20 Concepts implementation effort. Added Concept Specialization Expressions that are created when a concept is refe$

D41217 on Phabricator.

(recommit after fixing failing Parser test on windows)

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

5 years agoRevert 374882 "[Concepts] Concept Specialization Expressions"
Nico Weber [Tue, 15 Oct 2019 14:46:39 +0000 (14:46 +0000)]
Revert 374882 "[Concepts] Concept Specialization Expressions"

This reverts commit ec87b003823d63f3342cf648f55a134c1522e612.
The test fails on Windows, see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11533/steps/stage%201%20check/logs/stdio

Also revert follow-up r374893.

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

5 years agoReapply: [Modules][PCH] Hash input files content
Bruno Cardoso Lopes [Tue, 15 Oct 2019 14:23:55 +0000 (14:23 +0000)]
Reapply: [Modules][PCH] Hash input files content

Summary:
When files often get touched during builds, the mtime based validation
leads to different problems in implicit modules builds, even when the
content doesn't actually change:

- Modules only: module invalidation due to out of date files. Usually causing rebuild traffic.
- Modules + PCH: build failures because clang cannot rebuild a module if it comes from building a PCH.
- PCH: build failures because clang cannot rebuild a PCH in case one of the input headers has different mtime.

This patch proposes hashing the content of input files (headers and
module maps), which is performed during serialization time. When looking
at input files for validation, clang only computes the hash in case
there's a mtime mismatch.

I've tested a couple of different hash algorithms availble in LLVM in
face of building modules+pch for `#import <Cocoa/Cocoa.h>`:
- `hash_code`: performace diff within the noise, total module cache increased by 0.07%.
- `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from `hash_code`.
- `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file.

Given the numbers above, the patch uses `hash_code`. The patch also
improves invalidation error msgs to point out which type of problem the
user is facing: "mtime", "size" or "content".

rdar://problem/29320105

Reviewers: dexonsmith, arphaman, rsmith, aprantl

Subscribers: jkorous, cfe-commits, ributzka

Tags: #clang

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

llvm-svn: 374841

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

5 years ago[AST] Remove unused Sema includes to fix a cyclic dependency from Sema to AST
Benjamin Kramer [Tue, 15 Oct 2019 14:23:05 +0000 (14:23 +0000)]
[AST] Remove unused Sema includes to fix a cyclic dependency from Sema to AST

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

5 years ago[Alignment] Migrate Attribute::getWith(Stack)Alignment
Guillaume Chatelet [Tue, 15 Oct 2019 12:56:24 +0000 (12:56 +0000)]
[Alignment] Migrate Attribute::getWith(Stack)Alignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, jdoerfert

Reviewed By: courbet

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[Concepts] Concept Specialization Expressions
Saar Raz [Tue, 15 Oct 2019 11:48:58 +0000 (11:48 +0000)]
[Concepts] Concept Specialization Expressions

Part of C++20 Concepts implementation effort. Added Concept Specialization Expressions that are created when a concept is referenced with arguments, and tests thereof.

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

5 years agoFix uninitialized variable warnings. NFCI.
Simon Pilgrim [Tue, 15 Oct 2019 10:23:05 +0000 (10:23 +0000)]
Fix uninitialized variable warnings. NFCI.

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

5 years ago[Format] Add machine-readable SPDX license ID to clang-format.el
Sam McCall [Tue, 15 Oct 2019 07:25:18 +0000 (07:25 +0000)]
[Format] Add machine-readable SPDX license ID to clang-format.el

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

5 years ago[WebAssembly] Trapping fptoint builtins and intrinsics
Thomas Lively [Tue, 15 Oct 2019 01:11:51 +0000 (01:11 +0000)]
[WebAssembly] Trapping fptoint builtins and intrinsics

Summary:
The WebAssembly backend lowers fptoint instructions to a code sequence
that checks for overflow to avoid traps because fptoint is supposed to
be speculatable. These new builtins and intrinsics give users a way to
depend on the trapping semantics of the underlying instructions and
avoid the extra code generated normally.

Patch by coffee and tlively.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoRevert "Dead Virtual Function Elimination"
Jorge Gorbe Moya [Mon, 14 Oct 2019 23:25:25 +0000 (23:25 +0000)]
Revert "Dead Virtual Function Elimination"

This reverts commit 9f6a873268e1ad9855873d9d8007086c0d01cf4f.

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

5 years agoTemporarily Revert [Modules][PCH] Hash input files content
Eric Christopher [Mon, 14 Oct 2019 23:14:24 +0000 (23:14 +0000)]
Temporarily Revert [Modules][PCH] Hash input files content
as it's breaking a few bots.

This reverts r374841 (git commit 2a1386c81de504b5bda44fbecf3f7b4cdfd748fc)

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

5 years ago[Modules][PCH] Hash input files content
Bruno Cardoso Lopes [Mon, 14 Oct 2019 23:02:03 +0000 (23:02 +0000)]
[Modules][PCH] Hash input files content

Summary:
When files often get touched during builds, the mtime based validation
leads to different problems in implicit modules builds, even when the
content doesn't actually change:

- Modules only: module invalidation due to out of date files. Usually causing rebuild traffic.
- Modules + PCH: build failures because clang cannot rebuild a module if it comes from building a PCH.
- PCH: build failures because clang cannot rebuild a PCH in case one of the input headers has different mtime.

This patch proposes hashing the content of input files (headers and
module maps), which is performed during serialization time. When looking
at input files for validation, clang only computes the hash in case
there's a mtime mismatch.

I've tested a couple of different hash algorithms availble in LLVM in
face of building modules+pch for `#import <Cocoa/Cocoa.h>`:
- `hash_code`: performace diff within the noise, total module cache increased by 0.07%.
- `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from `hash_code`.
- `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file.

Given the numbers above, the patch uses `hash_code`. The patch also
improves invalidation error msgs to point out which type of problem the
user is facing: "mtime", "size" or "content".

rdar://problem/29320105

Reviewers: dexonsmith, arphaman, rsmith, aprantl

Subscribers: jkorous, cfe-commits, ributzka

Tags: #clang

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

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

5 years agoAdd -fno-experimental-pass-manager to make clear which pass manager
Eric Christopher [Mon, 14 Oct 2019 23:01:48 +0000 (23:01 +0000)]
Add -fno-experimental-pass-manager to make clear which pass manager
we're running and to make flipping the default not regress testing.

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

5 years agoIn the new pass manager use PTO.LoopUnrolling to determine when and how
Eric Christopher [Mon, 14 Oct 2019 22:56:07 +0000 (22:56 +0000)]
In the new pass manager use PTO.LoopUnrolling to determine when and how
we will unroll loops. Also comment a few occasions where we need to
know whether or not we're forcing the unwinder or not.

The default before and after this patch is for LoopUnroll to be enabled,
and for it to use a cost model to determine whether to unroll the loop
(`OnlyWhenForced = false`). Before this patch, disabling loop unroll
would not run the LoopUnroll pass. After this patch, the LoopUnroll pass
is being run, but it restricts unrolling to only the loops marked by a
pragma (`OnlyWhenForced = true`).

In addition, this patch disables the UnrollAndJam pass when disabling unrolling.

Testcase is in clang because it's controlling how the loop optimizer
is being set up and there's no other way to trigger the behavior.

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

5 years ago[clang] add requirements to -Wa,-W test cases.
Jian Cai [Mon, 14 Oct 2019 22:51:12 +0000 (22:51 +0000)]
[clang] add requirements to -Wa,-W test cases.

Include linux as a test requirement.

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

5 years ago[test] Fix test failure
Eli Friedman [Mon, 14 Oct 2019 22:44:42 +0000 (22:44 +0000)]
[test] Fix test failure

The version mismatch symbol is version 9 on 32 bit android. Since
this test isn't actually testing any android specific functionality,
we force the target triple to x86_64-unknown-unknown in order to have
a consistent version number. It seems the test was already trying to
do this, just not doing it right

Patch by Christopher Tetrault

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

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

5 years agoAdd support to -Wa,-W in clang
Jian Cai [Mon, 14 Oct 2019 22:28:03 +0000 (22:28 +0000)]
Add support to -Wa,-W in clang

Summary:
Currently clang does not support -Wa,-W, which suppresses warning
messages in GNU assembler. Add this option for gcc compatibility.
https://bugs.llvm.org/show_bug.cgi?id=43651. Reland with differential
information.

Reviewers: bcain

Reviewed By: bcain

Subscribers: george.burgess.iv, gbiv, llozano, manojgupta, nickdesaulniers, cfe-commits

Tags: #clang

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

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

5 years agoRevert "Add support to -Wa,-W in clang"
Jian Cai [Mon, 14 Oct 2019 22:28:01 +0000 (22:28 +0000)]
Revert "Add support to -Wa,-W in clang"

This reverts commit e72eeca43b9577be2aae55f7603febbf223a6ab3.

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

5 years agoPR43080: Do not build context-sensitive expressions during name classification.
Richard Smith [Mon, 14 Oct 2019 21:53:03 +0000 (21:53 +0000)]
PR43080: Do not build context-sensitive expressions during name classification.

Summary:
We don't know what context to use until the classification result is
consumed by the parser, which could happen in a different semantic
context. So don't build the expression that results from name
classification until we get to that point and can handle it properly.

This covers everything except C++ implicit class member access, which
is a little awkward to handle properly in the face of the protected
member access check. But it at least fixes all the currently-filed
instances of PR43080.

Reviewers: efriedma

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd support to -Wa,-W in clang
Jian Cai [Mon, 14 Oct 2019 21:21:39 +0000 (21:21 +0000)]
Add support to -Wa,-W in clang

Currently clang does not support -Wa,-W, which suppresses warning
messages in GNU assembler. Add this option for gcc compatibility.
https://bugs.llvm.org/show_bug.cgi?id=43651

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

5 years ago[NFC] Fix ClangScanDeps/static-analyzer.c test on Windows
Jan Korous [Mon, 14 Oct 2019 21:06:11 +0000 (21:06 +0000)]
[NFC] Fix ClangScanDeps/static-analyzer.c test on Windows

Follow-up to c5d14b5c6fa

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

5 years ago[OPNEMP]Allow num_tasks clause in combined task-based directives.
Alexey Bataev [Mon, 14 Oct 2019 20:44:34 +0000 (20:44 +0000)]
[OPNEMP]Allow num_tasks clause in combined task-based directives.

The expression of the num_tasks clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.

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

5 years ago[clang-scan-deps] Support for clang --analyze in clang-scan-deps
Jan Korous [Mon, 14 Oct 2019 20:15:01 +0000 (20:15 +0000)]
[clang-scan-deps] Support for clang --analyze in clang-scan-deps

The goal is to have 100% fidelity in clang-scan-deps behavior when
--analyze is present in compilation command.

At the same time I don't want to break clang-tidy which expects
__static_analyzer__ macro defined as built-in.

I introduce new cc1 options (-setup-static-analyzer) that controls
the macro definition and is conditionally set in driver.

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

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

5 years ago[OPNEMP]Allow grainsize clause in combined task-based directives.
Alexey Bataev [Mon, 14 Oct 2019 19:29:52 +0000 (19:29 +0000)]
[OPNEMP]Allow grainsize clause in combined task-based directives.

The expression of the grainsize clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.

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

5 years ago[clang][IFS][test] Fixing lit test breakages on macOS due to r374798
Puyan Lotfi [Mon, 14 Oct 2019 18:57:29 +0000 (18:57 +0000)]
[clang][IFS][test] Fixing lit test breakages on macOS due to r374798

Adding the quotes breaks tests because on Darwin the name mangling is prefixed
with an underscore.

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

5 years ago[clang][IFS] Escape mangled names so MS ABI doesn't break YAML parsing.
Puyan Lotfi [Mon, 14 Oct 2019 18:03:03 +0000 (18:03 +0000)]
[clang][IFS] Escape mangled names so  MS ABI doesn't break YAML parsing.

Microsoft's ABI mangles names differently than Itanium and this breaks the LLVM
yaml parser unless the name is escaped in quotes. Quotes are being added to the
mangled names of the IFS file generation so that llvm-ifs doesn't break when
Windows triples are passed to the driver.

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

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

5 years ago[OPENMP50]Add support for 'parallel master taskloop' construct.
Alexey Bataev [Mon, 14 Oct 2019 17:17:41 +0000 (17:17 +0000)]
[OPENMP50]Add support for 'parallel master taskloop' construct.

Added parsing/sema/codegen support for 'parallel master taskloop'
constructs. Some of the clauses, like 'grainsize', 'num_tasks', 'final'
and 'priority' are not supported in full, only constant expressions can
be used currently in these clauses.

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

5 years ago[OPENMP]Fix codegen for private variably length vars in combined
Alexey Bataev [Mon, 14 Oct 2019 16:44:01 +0000 (16:44 +0000)]
[OPENMP]Fix codegen for private variably length vars in combined
constructs.

If OpenMP construct includes several capturing regions and the variable
is declared as private, the length of the inner variable length array is
not captured in outer captured regions, only in the innermost region.
Patch fixes this bug.

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

5 years ago[ARM] Preserve fpu behaviour for '-crypto'
Diogo N. Sampaio [Mon, 14 Oct 2019 16:29:26 +0000 (16:29 +0000)]
[ARM] Preserve fpu behaviour for '-crypto'

Summary:
This patch restores the behaviour that -fpu overwrites the
architecture obtained from -march or -mcpu flags, not enforcing to
disable 'crypto' if march=armv7 and mfpu=neon-fp-armv8.
However, it does warn that 'crypto' is ignored when passing
mfpu=crypto-neon-fp-armv8.

Reviewers: peter.smith, labrinea

Reviewed By: peter.smith

Subscribers: nickdesaulniers, kristof.beyls, dmgreen, cfe-commits, krisb

Tags: #clang

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

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

5 years ago[IRBuilder] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator
Cameron McInally [Mon, 14 Oct 2019 15:35:01 +0000 (15:35 +0000)]
[IRBuilder] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator

Reapply r374240 with fix for Ocaml test, namely Bindings/OCaml/core.ml.

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

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

5 years ago[RISCV] enable LTO support, pass some options to linker.
Sam Elliott [Mon, 14 Oct 2019 14:00:13 +0000 (14:00 +0000)]
[RISCV] enable LTO support, pass some options to linker.

Summary:
1. enable LTO need to pass target feature and abi to LTO code generation
   RISCV backend need the target feature to decide which extension used in
   code generation.
2. move getTargetFeatures to CommonArgs.h and add ForLTOPlugin flag
3. add general tools::getTargetABI in CommonArgs.h because different target uses different
   way to get the target ABI.

Patch by Kuan Hsu Chen (khchen)

Reviewers: lenary, lewis-revill, asb, MaskRay

Reviewed By: lenary

Subscribers: hiraditya, dschuff, aheejin, fedor.sergeev, mehdi_amini, inglorion, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, cfe-commits

Tags: #clang

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

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

5 years ago[docs] loop pragmas: options implying transformations
Sjoerd Meijer [Mon, 14 Oct 2019 07:40:36 +0000 (07:40 +0000)]
[docs] loop pragmas: options implying transformations

Following our discussion on the cfe dev list:
http://lists.llvm.org/pipermail/cfe-dev/2019-August/063054.html,
I have added a paragraph that is explicit about loop pragmas, and
transformation options implying the corresponding transformation.

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

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