Commit Graph

80406 Commits

Author SHA1 Message Date
Raphael Isemann b941cdd6bc [clang][NFC] Fix misspellings in ExternalASTMerger.h
llvm-svn: 373577
2019-10-03 09:55:13 +00:00
Serge Pavlov 110a24fb44 Fix driver tests when `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is `ON`
Some Driver tests relied on the default resource direcory having per-os per-arch
subdirectory layout, and when clang is built with `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`,
those test fail, because clang by default assumes per-target subdirectories.

Explicitly set `-resource-dir` flag to point to a tree with per-os per-arch layout.

See also: D45604, D62469

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

Patch by Sergej Jaskiewicz <jaskiewiczs@icloud.com>.

llvm-svn: 373565
2019-10-03 04:52:46 +00:00
Yaxun Liu f13b8d4fe9 [HIP] Support -emit-llvm for device compilation
Sometimes it is useful to compile HIP device code to LLVM BC. It is not convenient to use clang -cc1 since
there are lots of options needed.

This patch allows clang driver to compile HIP device code to LLVM BC with -emit-llvm -c.

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

llvm-svn: 373561
2019-10-03 03:27:43 +00:00
Nico Weber 6713f8235b Revert 373538 and follow-ups 373549 and 373552.
They break tests on (at least) macOS.

llvm-svn: 373556
2019-10-03 02:38:43 +00:00
Richard Smith 5258202a81 PR43519: don't inject a diagnostic when constant-evaulation of a
pointer-to-member call can't determine a callee.

We will have produced a diagnostic already if the callee is known to be
unevaluatable, and diagnosing here rejects valid code during potential
constant expression checking.

llvm-svn: 373553
2019-10-03 01:20:27 +00:00
Puyan Lotfi 30c8df02ba Fixing broken builds due to r373538, issues with filepath and hexagon toolchain.
It appears there are some issues with the hexagon toolchain, and also the file
path for the library file. If this doesn't fix the remaining breakages I will
attempt a revert.

llvm-svn: 373552
2019-10-03 01:19:51 +00:00
Puyan Lotfi 8581f860c7 Fixing broken builds due to r373538 due to test that should have been deleted.
test/InterfaceStubs/object.cpp should have been deleted.

llvm-svn: 373549
2019-10-03 00:41:13 +00:00
Richard Smith 69e9d84b1a Mark P0784R7 as complete and start defining its feature-test macro.
Note that this only covers the language side of this feature. (The
library side has its own feature test macro.)

llvm-svn: 373548
2019-10-03 00:39:37 +00:00
Richard Smith b542602c5f For P0784R7: support placement new-expressions in constant evaluation.
For now, we restrict this support to use from within the standard
library implementation, since we're required to make parts of the
standard library that use placement new work, but not permitted to
make uses of placement new from user code work.

llvm-svn: 373547
2019-10-03 00:39:35 +00:00
Richard Smith 19ad523971 For P0784R7: allow direct calls to operator new / operator delete from
std::allocator::{allocate,deallocate} in constant evaluation.

llvm-svn: 373546
2019-10-03 00:39:33 +00:00
Puyan Lotfi 406de17b9b [clang][ifs] Clang Interface Stubs ToolChain plumbing.
This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:

clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp

will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.

* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
  instead of the final object format (normally ELF)


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

llvm-svn: 373538
2019-10-02 22:50:07 +00:00
Simon Pilgrim 426078a781 Fix uninitialized variable warning in CodeGenPGO constructor. NFCI.
llvm-svn: 373526
2019-10-02 21:05:21 +00:00
Simon Pilgrim f2805470e6 ItaniumCXXABI - silence static analyzer getAs<RecordType> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but we should be able to use castAs<RecordType> directly and if not assert will fire for us.

llvm-svn: 373525
2019-10-02 20:45:16 +00:00
Sergey Dmitriev 5ac9d18e7d [Clang][Driver][NFC] Corrected DeviceActionBuilder methods' comments.
Differential Revision: https://reviews.llvm.org/D68355

llvm-svn: 373523
2019-10-02 20:44:45 +00:00
Simon Pilgrim 5a8b229c97 CGObjCMac - silence static analyzer dyn_cast<>/getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but we should be able to use cast<>/castAs<> directly and if not assert will fire for us.

llvm-svn: 373520
2019-10-02 20:30:37 +00:00
Benjamin Kramer 340406a740 [Stencil] Hide implementaion detai. NFC.
llvm-svn: 373504
2019-10-02 18:33:44 +00:00
Alexey Bataev a15a1413ac [OPENMP50]Add parsing/sema analysis for declare variant score.
Context selectors may include optional score clause in format
`score(<expr>):`, where `<expr>` must be a constant integer expression.
Added parsing/sema analysis only.

llvm-svn: 373502
2019-10-02 18:19:02 +00:00
Simon Pilgrim 96ab296ea4 Type - 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.

llvm-svn: 373480
2019-10-02 16:03:36 +00:00
Simon Pilgrim e0712019f2 Silence static analyzer getAs<VectorType> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<VectorType> directly and if not assert will fire for us.

llvm-svn: 373478
2019-10-02 15:31:25 +00:00
Simon Pilgrim ed3b68e0dc SemaOverload - 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.

llvm-svn: 373475
2019-10-02 14:02:27 +00:00
Simon Pilgrim 920ff02ece SemaInit - 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.

llvm-svn: 373474
2019-10-02 14:02:18 +00:00
Simon Pilgrim d06ee791f3 Log2_32 returns an unsigned. NFCI.
Silences clang static analyzer warning about out of bounds (negative) shifts.

llvm-svn: 373451
2019-10-02 11:49:32 +00:00
Simon Pilgrim eed4b122ef ASTContext - silence static analyzer getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373447
2019-10-02 11:48:06 +00:00
Sam McCall 08bfd9e42e [ClangFormat] relnotes for r373439
llvm-svn: 373441
2019-10-02 09:52:52 +00:00
Haojian Wu fbd134f969 [clang-rename] Better renaming the typedef decl.
Summary:
when renaming a typedef decl, we used to rename the underlying decl of the
typedef, we should rename the typedef itself.

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373440
2019-10-02 09:50:46 +00:00
Sam McCall e503256790 [ClangFormat] Future-proof Standard option, allow floating or pinning to arbitrary lang version
Summary:
The historical context:
- clang-format was written when C++11 was current,
  and the main language-version concern was >> vs > > template-closers.
  An option was added to allow selection of the 03/11 behavior, or auto-detection.
- there was no option to choose simply "latest standard" so anyone who didn't
  ever want 03 behavior or auto-detection specified Cpp11.
- In r185149 this option started to affect lexer mode.
- no options were added to cover c++14, as parsing/formatting
  didn't change that much. The usage of Cpp11 to mean "latest" became
  codified e.g. in r206263
- c++17 added some new constructs. These were mostly backwards-compatible and so
  not used in old programs, so having no way to turn them off was OK.
- c++20 added some new constructs and keywords (e.g. co_*) that changed the
  meaning of existing programs, and people started to complain that
  the c++20 parsing couldn't be turned off.

New plan:
 - Default ('Auto') behavior remains unchanged: parse as latest, format
   template-closers based on input.
 - Add new 'Latest' option that more clearly expresses the intent "use
   modern features" that many projects have chosen for their .clang-format files.
 - Allow pinning to *any* language version, using the same name as clang -std:
   c++03, c++11, c++14 etc. These set precise lexer options, and any
   clang-format code depending on these can use a >= check.
 - For backwards compatibility, `Cpp11` is an alias for `Latest`, not `c++11`.
   This matches the historical documented semantics of this option.
   This spelling (and `Cpp03`) are deprecated.

Reviewers: klimek, modocache

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373439
2019-10-02 09:50:40 +00:00
John McCall 36b12a861c Rename TypeNodes.def to TypeNodes.inc for consistency across all
our autogenerated files.  NFC.

As requested by Nico Weber.

llvm-svn: 373425
2019-10-02 06:35:23 +00:00
Richard Trieu e388725316 Revert r368237 - Update fix-it hints for std::move warnings.
r368237 attempted to improve fix-its for move warnings, but introduced some
regressions to -Wpessimizing-move.  Revert that change and add the missing
test cases to the pessimizing move test to prevent future regressions.

llvm-svn: 373421
2019-10-02 02:32:15 +00:00
Richard Smith 5e18f4db08 Fix crash on constant-evaluation of pseudo-destruction of a pointer.
We got confused and thought we might be pseudo-destroying the pointee
instead.

llvm-svn: 373418
2019-10-02 01:13:57 +00:00
John McCall c60a824205 Remove TypeNodes.def from the modulemap.
We currently just look for files named in the modulemap in its
associated source directory.  This means that we can't name
generated files, like TypeNodes.def now is, which means we can't
explicitly mark it as textual.  But fortunately that's okay
because (as I understand it) the most important purpose of naming
the header in the modulemap is to ensure that it's not treated as
public, and the search for public headers also only considers
files in the associated source directory.  This isn't an elegant
solution, since among other things it means that a build which
wrote the generated files directly into the source directory would
result in something that wouldn't build as a module, but that's
a problem for all our other generated files as well.

llvm-svn: 373416
2019-10-02 01:02:27 +00:00
Michael Liao d838cf76ca Fix unused variable warning. NFCI.
llvm-svn: 373410
2019-10-02 00:22:45 +00:00
John McCall a82d2fe944 Emit TypeNodes.def with tblgen.
The primary goal here is to make the type node hierarchy available to
other tblgen backends, although it should also make it easier to generate
more selective x-macros in the future.

Because tblgen doesn't seem to allow backends to preserve the source
order of defs, this is not NFC because it significantly re-orders IDs.
I've fixed the one (fortunately obvious) place where we relied on
the old order.  Unfortunately, I wasn't able to share code with the
existing AST-node x-macro generators because the x-macro schema we use
for types is different in a number of ways.  The main loss is that
subclasses aren't ordered together, which doesn't seem important for
types because the hierarchy is generally very shallow with little
clustering.

llvm-svn: 373407
2019-10-01 23:13:03 +00:00
John McCall c45f8d4989 Use scope qualifiers in Clang's tblgen backends to get useful
redeclaration checking.  NFC.

llvm-svn: 373406
2019-10-01 23:12:57 +00:00
Jordan Rupprecht 5269091dc7 [clang][OpenMP][NFC] #include GlobalDecl.h to avoid incomplete class type
llvm-svn: 373400
2019-10-01 22:30:10 +00:00
Simon Pilgrim 5e0a0b707b CGVTables - silence static analyzer getAs<FunctionProtoType> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but we should be able to use castAs<FunctionProtoType> directly and if not assert will fire for us.

llvm-svn: 373398
2019-10-01 22:02:46 +00:00
Simon Pilgrim f7133b7977 CGExprAgg - remove duplicate code. NFCI.
Remove duplicate getAs<> call, avoiding a clang static analyzer null dereference warning.

llvm-svn: 373396
2019-10-01 21:50:30 +00:00
Paul Hoad 603650213b [clang-format] [PR43372] - clang-format shows replacements in DOS files when no replacement is needed
Summary:
This is a patch to fix PR43372 (https://bugs.llvm.org/show_bug.cgi?id=43372) - clang-format can't format file with includes, ( which really keep providing replacements for already sorted headers.)

A similar issue was addressed by @krasimir in {D60199}, however, this seemingly only prevented the issue when the files being formatted did not contain windows line endings (\r\n)

It's possible this is related to https://twitter.com/StephanTLavavej/status/1176722938243895296 given who @STL_MSFT  works for!

As people often used the existence of replacements to determine if a file needs clang-formatting, this is probably pretty important for windows users

There may be a better way of comparing 2 strings and ignoring \r (which appear in both Results and Code), I couldn't choose between this idiom or the copy_if approach, but I'm happy to change it to whatever people consider more performant.

Reviewers: krasimir, klimek, owenpan, ioeric

Reviewed By: krasimir

Subscribers: cfe-commits, STL_MSFT, krasimir

Tags: #clang-format, #clang, #clang-tools-extra

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

llvm-svn: 373388
2019-10-01 20:20:22 +00:00
Alexey Bataev 2df5f12ea1 [OPENMP50]Initial codegen for declare variant implementation vendor.
Initial implementation of global aliases emission for the declare
variant pragma with implementation vendor context selector set.

llvm-svn: 373387
2019-10-01 20:18:32 +00:00
David Bolvansky 1f345cb05d [NFC] Updated tests after rL373371
Forgot to run check-clang-semacxx.

llvm-svn: 373375
2019-10-01 18:18:45 +00:00
Alexey Bataev b9b8ca2334 [OPENMP]Fix PR43330: OpenMP target: Mapping of partial arrays fails.
Fixed calculation the size of the array sections.

llvm-svn: 373374
2019-10-01 18:18:03 +00:00
David Bolvansky 00d632e089 [Diagnostics] Make -Wenum-compare-conditional off by default
Too many false positives, eg. in Chromium.

llvm-svn: 373371
2019-10-01 18:12:13 +00:00
Teresa Johnson dca5b94e79 [ThinLTO] Enable index-only WPD from clang
Summary:
To trigger the index-only Whole Program Devirt support added to LLVM, we
need to be able to specify -fno-split-lto-unit in conjunction with
-fwhole-program-vtables. Keep the default for -fwhole-program-vtables as
-fsplit-lto-unit, but don't error on that option combination.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 373370
2019-10-01 18:08:29 +00:00
Alexey Bataev 658ad4d4d2 [OPENMP]Fix PR43516: Compiler crash with collapse(2) on non-rectangular
loop.

Missed check if the condition is also dependent when building final
expressions for the collapsed loop directives.

llvm-svn: 373348
2019-10-01 16:19:10 +00:00
David Bolvansky 362055d1fa [Diagnostics] Move warning into the subgroup (-Wenum-compare-conditional)
llvm-svn: 373345
2019-10-01 15:44:38 +00:00
Kadir Cetinkaya fd019ed54e [clang] Make handling of unnamed template params similar to function params
Summary:
Clang uses the location identifier should be inserted for declarator
decls when a decl is unnamed. But for type template and template template
paramaters it uses the location of "typename/class" keyword, which makes it hard
for tooling to insert/change parameter names.

This change tries to unify these two cases by making template parameter
parsing and sourcerange operations similar to function params/declarator decls.

Reviewers: ilya-biryukov

Subscribers: arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 373340
2019-10-01 14:08:51 +00:00
Raphael Isemann ed5a8971ec [clang] Ignore builtin namespaces in test/Import/cxx-anon-namespace
Some platforms (e.g. AArch64) put __va_list in the 'std' namespace which might
end up being the first namespace we match in this test. Instead let
the first namespace match via file name/line so that we skip the
builtin namespaces.

llvm-svn: 373327
2019-10-01 11:53:20 +00:00
Raphael Isemann cf62871488 [clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSource
NFC preparation work for upcoming ExternalASTMerger patches.

llvm-svn: 373312
2019-10-01 09:02:05 +00:00
Sylvestre Ledru 7009204bd2 Decrease the verbosity of the -ftime-trace option
And move the relevant information in the doc.

Summary:
Currently, building a large software like Firefox shows
'Use chrome://tracing or Speedscope App (https://www.speedscope.app) for flamegraph visualization'
for each file.

Reviewers: anton-afanasyev

Reviewed By: anton-afanasyev

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373308
2019-10-01 07:52:42 +00:00
Richard Smith 8ac5c746fc Don't elide the use of the thread wrapper for a thread_local constinit
variable with non-trivial destruction.

We still need to invoke the thread wrapper to trigger registration of
the destructor call on thread shutdown.

llvm-svn: 373289
2019-10-01 01:23:23 +00:00
Richard Smith 9f42a1231e [c++20] Add a C++20 version of the existing turing machine test.
Unlike the C++11 version, this one uese mutable state and dynamic
allocation instead of a carefully balanced and ever-accumulating pile of
temporaries.

llvm-svn: 373281
2019-10-01 00:47:41 +00:00