Commit Graph

82640 Commits

Author SHA1 Message Date
Erik Pilkington 2e4f5e629d [Sema] Fix an assert when objc_externally_retained was applied to an unprototyped function
rdar://58893199
2020-02-28 15:49:16 -08:00
Volodymyr Sapsai 4069dd1412 [modules] Allow frameworks to have only a private module without a public one.
Support only preferred spelling 'Modules/module.private.modulemap' and
not the deprecated 'module_private.map'.

rdar://problem/57715533

Reviewed By: bruno

Differential Revision: https://reviews.llvm.org/D75311
2020-02-28 15:40:24 -08:00
Vedant Kumar c54597b99d [ubsan] Add support for -fsanitize=nullability-* suppressions
rdar://59402904
2020-02-28 14:30:40 -08:00
cchen 6ee6fa28a7 [OpenMP5.0] Allow pointer arithmetic in motion/map clause, by Chi Chun
Chen

Summary:
Base declaration in pointer arithmetic expression is determined by
binary search with type information. Take "int *a, *b; *(a+*b)" as an
example, we determine the base by checking the type of LHS and RHS. In
this case the type of LHS is "int *", the type of RHS is "int",
therefore, we know that we need to visit LHS in order to find base
declaration.

Reviewers: ABataev, jdoerfert

Reviewed By: ABataev

Subscribers: guansong, cfe-commits, sandoval, dreachem

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75077
2020-02-28 15:07:32 -05:00
Yitzhak Mandelbaum 586f13aeac [AST Matchers] Fix bug in 'optionally' matcher wherein all previous bindings are cleared when all inner matchers fail.
Summary: The implementation of 'optionally' doesn't preserve bindings when none of the submatchers succeed. This patch adds a regression test for that behavior and fixes it.

Reviewers: aaron.ballman, sbenza

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75365
2020-02-28 13:46:27 -05:00
Hiroshi Yamauchi f16d2bec40 Devirtualize a call on alloca without waiting for post inline cleanup and next DevirtSCCRepeatedPass iteration.
This aims to fix a missed inlining case.

If there's a virtual call in the callee on an alloca (stack allocated object) in
the caller, and the callee is inlined into the caller, the post-inline cleanup
would devirtualize the virtual call, but if the next iteration of
DevirtSCCRepeatedPass doesn't happen (under the new pass manager), which is
based on a heuristic to determine whether to reiterate, we may miss inlining the
devirtualized call.

This enables inlining in clang/test/CodeGenCXX/member-function-pointer-calls.cpp.

This is a second commit after a revert
https://reviews.llvm.org/rG4569b3a86f8a4b1b8ad28fe2321f936f9d7ffd43 and a fix
https://reviews.llvm.org/rG41e06ae7ba91.

Differential Revision: https://reviews.llvm.org/D69591
2020-02-28 09:43:32 -08:00
Simon Pilgrim bfa0aaf37f [AVX512] Add strict-fp cvtph2ps constrained tests
As suggested on D75162
2020-02-28 16:55:00 +00:00
Simon Pilgrim a06402cc69 [F16C] Add strict-fp constrained tests
As suggested on D75162
2020-02-28 16:55:00 +00:00
Jonathan Coe f829615205 [clang-format] Improve C# handling of spaces in square brackets
Reviewers: MyDeveloperDay, krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D75336
2020-02-28 12:44:15 +00:00
Jonathan Coe 5f52a93b69 [clang-format] Recognize C# nullable types
Summary:
Do not confuse C# nullable types with conditional expressions.

Do not put a space before the `?` in `[access-modifier] Type? variableName;`

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir, MyDeveloperDay

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D75261
2020-02-28 11:09:55 +00:00
Balázs Kéri b17f292010 [ASTImporter] Improved import of AlignedAttr.
Summary:
It is not enough to clone the attributes at import.
They can contain reference to objects that should be imported.
This work is done now for AlignedAttr.

Reviewers: martong, a.sidorin, shafik

Reviewed By: shafik

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

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75048
2020-02-28 09:40:59 +01:00
Douglas Yung b6f605cec5 Change test to use -S so it works when an external assembler is used that is not present in the testing environment. 2020-02-27 16:51:57 -08:00
Adrian McCarthy 0a3117832c Need /bigobj to build SourceCodeTest.cpp with MSVC. 2020-02-27 14:56:29 -08:00
Reid Kleckner 4c2a6567bb Avoid ASTContext.h -> TargetInfo.h dep
This has been done before in 2008: ab13857072
But these things regress easily.
Move some things out of line.

Saves 316 includes + transitive stuff:
    316 -    ../clang/include/clang/Basic/TargetOptions.h
    316 -    ../clang/include/clang/Basic/TargetInfo.h
    316 -    ../clang/include/clang/Basic/TargetCXXABI.h
    316 -    ../clang/include/clang/Basic/OpenCLOptions.h
    316 -    ../clang/include/clang/Basic/OpenCLExtensions.def
    302 -    ../llvm/include/llvm/Target/TargetOptions.h
    302 -    ../llvm/include/llvm/Support/CodeGen.h
    302 -    ../llvm/include/llvm/MC/MCTargetOptions.h
    302 -    ../llvm/include/llvm/ADT/FloatingPointMode.h
    302 -    ../clang/include/clang/Basic/XRayInstr.h
    302 -    ../clang/include/clang/Basic/DebugInfoOptions.h
    302 -    ../clang/include/clang/Basic/CodeGenOptions.h
    302 -    ../clang/include/clang/Basic/CodeGenOptions.def
    257 -    ../llvm/include/llvm/Support/Regex.h
     79 -    ../llvm/include/llvm/ADT/SmallSet.h
     68 -    MSVCSTL/include/set
     66 -    ../llvm/include/llvm/ADT/SmallPtrSet.h
     62 -    ../llvm/include/llvm/ADT/StringSwitch.h
2020-02-27 14:35:00 -08:00
Reid Kleckner 0f6959f363 Add some missing header dependencies
Unit tests are not part of `all` O_O, and I tested on Windows with
-fdelayed-template-parsing.
2020-02-27 14:32:12 -08:00
Reid Kleckner 86565c1309 Avoid SourceManager.h include in RawCommentList.h, add missing incs
SourceManager.h includes FileManager.h, which is expensive due to
dependencies on LLVM FS headers.

Remove dead BeforeThanCompare specialization.

Sink ASTContext::addComment to cpp file.

This reduces the time to compile a file that does nothing but include
ASTContext.h from ~3.4s to ~2.8s for me.

Saves these includes:
    219 -    ../clang/include/clang/Basic/SourceManager.h
    204 -    ../clang/include/clang/Basic/FileSystemOptions.h
    204 -    ../clang/include/clang/Basic/FileManager.h
    165 -    ../llvm/include/llvm/Support/VirtualFileSystem.h
    164 -    ../llvm/include/llvm/Support/SourceMgr.h
    164 -    ../llvm/include/llvm/Support/SMLoc.h
    161 -    ../llvm/include/llvm/Support/Path.h
    141 -    ../llvm/include/llvm/ADT/BitVector.h
    128 -    ../llvm/include/llvm/Support/MemoryBuffer.h
    124 -    ../llvm/include/llvm/Support/FileSystem.h
    124 -    ../llvm/include/llvm/Support/Chrono.h
    124 -    .../MSVCSTL/include/stack
    122 -    ../llvm/include/llvm-c/Types.h
    122 -    ../llvm/include/llvm/Support/NativeFormatting.h
    122 -    ../llvm/include/llvm/Support/FormatProviders.h
    122 -    ../llvm/include/llvm/Support/CBindingWrapping.h
    122 -    .../MSVCSTL/include/xtimec.h
    122 -    .../MSVCSTL/include/ratio
    122 -    .../MSVCSTL/include/chrono
    121 -    ../llvm/include/llvm/Support/FormatVariadicDetails.h
    118 -    ../llvm/include/llvm/Support/MD5.h
    109 -    .../MSVCSTL/include/deque
    105 -    ../llvm/include/llvm/Support/Host.h
    105 -    ../llvm/include/llvm/Support/Endian.h

Reviewed By: aaron.ballman, hans

Differential Revision: https://reviews.llvm.org/D75279
2020-02-27 13:49:40 -08:00
Joe Turner b26c88e3c6 [clang-tidy] Store all ranges in clang::tooling::Diagnostic
Summary: Instead of dropping all the ranges associated with a Diagnostic when
converting them to a ClangTidy error, instead attach them to the ClangTidyError,
so they can be consumed by other APIs.

Patch by Joe Turner <joturner@google.com>.
Differential Revision: https://reviews.llvm.org/D69782
2020-02-27 19:39:42 +01:00
Reid Kleckner bc8836651f Forward declare FileEntry and DirectoryEntry in Module.h
FileManager.h is an expensive header (~350ms for me in isolation), so
try to do without it.

Notably, we need to avoid checking the alignment of FileEntry, which
happens for DenseMap<FileEntry*> and PointerUnion<FileEntry*>. I
adjusted the code to avoid PointerUnion, and moved the DenseMap
insertion to the .cpp file.

Globally, this only saved about ~17 includes of the related headers
because SourceManager.h still includes FileManager.h, and it is more
popular than Module.h.
2020-02-27 10:18:06 -08:00
Reid Kleckner 04da3dfecc Forward declare special case lists
This avoids pulling in unordered_map from TrigramIndex.h:

$ diff -u thedeps-before.txt thedeps-after.txt | \
        grep '^[-+] ' | sort | uniq -c | sort -nr
    976 -    ../llvm/include/llvm/Support/TrigramIndex.h
    976 -    ../llvm/include/llvm/Support/SpecialCaseList.h
    976 -    ../clang/include/clang/Basic/SanitizerSpecialCaseList.h
    502 -    ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/unordered_map
    467 -    ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/xhash
    467 -    ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/xbit_ops.h
    212 -    ../llvm/include/llvm/ADT/StringSet.h
2020-02-27 10:05:30 -08:00
John Brawn 75d4d4bd02 Add an attribute registry so plugins can add attributes
When constructing a ParsedAttr the ParsedAttrInfo gets looked up in the
AttrInfoMap, which is auto-generated using tablegen. If that lookup fails then
we look through the ParsedAttrInfos that plugins have added to the registry and
check if any has a spelling that matches.

Differential Revision: https://reviews.llvm.org/D31338
2020-02-27 17:23:16 +00:00
Simon Moll ddd11273d9 Remove BinaryOperator::CreateFNeg
Use UnaryOperator::CreateFNeg instead.

Summary:
With the introduction of the native fneg instruction, the
fsub -0.0, %x idiom is obsolete. This patch makes LLVM
emit fneg instead of the idiom in all places.

Reviewed By: cameron.mcinally

Differential Revision: https://reviews.llvm.org/D75130
2020-02-27 09:06:03 -08:00
Alexey Bader 740ed617f7 Revert "[SYCL] Driver option to select SYCL version"
This reverts commit bd97704eaa.

It broke tests on mac: http://45.33.8.238/mac/9011/step_7.txt
2020-02-27 16:23:54 +03:00
Dan Gohman 00072c08c7 [WebAssembly] Mangle the argc/argv `main` as `__wasm_argc_argv`.
WebAssembly enforces a rule that caller and callee signatures must
match. This means that the traditional technique of passing `main`
`argc` and `argv` even when it doesn't need them doesn't work.

Currently the backend renames `main` to `__original_main`, however this
doesn't interact well with LTO'ing libc, and the name isn't intuitive.
This patch allows us to transition to `__main_argc_argv` instead.

This implements the proposal in
https://github.com/WebAssembly/tool-conventions/pull/134
with a flag to disable it when targeting Emscripten, though this is
expected to be temporary, as discussed in the proposal comments.

Differential Revision: https://reviews.llvm.org/D70700
2020-02-27 07:55:36 -08:00
Ruyman bd97704eaa [SYCL] Driver option to select SYCL version
Summary:
User can select the version of SYCL the compiler will
use via the flag -sycl-std, similar to -cl-std.

The flag defines the LangOpts.SYCLVersion option to the
version of SYCL. The default value is undefined.
If driver is building SYCL code, flag is set to the default SYCL
version (1.2.1)

The preprocessor uses this variable to define CL_SYCL_LANGUAGE_VERSION macro,
which should be defined according to SYCL 1.2.1 standard.

Only valid value at this point for the flag is 1.2.1.

Co-Authored-By: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
Signed-off-by: Ruyman Reyes <ruyman@codeplay.com>

Subscribers: ebevhan, Anastasia, cfe-commits

Tags: #clang

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

Signed-off-by: Alexey Bader <alexey.bader@intel.com>
2020-02-27 15:08:42 +03:00
Krzysztof Parzyszek ee1b2e7ded [Hexagon] Do not use init_arrays by default 2020-02-27 09:16:25 -06:00
Kirill Bobyrev 4569b3a86f
Revert "Devirtualize a call on alloca without waiting for post inline cleanup and next"
This reverts commit 59fb9cde7a.

The patch caused internal miscompilations.
2020-02-27 15:58:39 +01:00
Aaron Ballman f35f59ac36 Adding some documentation for __builtin_dump_struct. 2020-02-27 09:30:17 -05:00
Jonathan Coe 7dfe0cc7f5 [clang-format] Recognize C# named argument colons as a token type
Summary:
No longer merge 'name' and ':' into a single token.

Ensure that line breaks cannot be placed before or after a named-argument colon.

Ensure that no space is inserted before a named-argument colon.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D75244
2020-02-27 13:47:29 +00:00
Hans Wennborg 7ea9a6e022 Revert "make -fmodules-codegen and -fmodules-debuginfo work also with PCHs"
This caused PR44953. See also the discussion on D74846.

This reverts commit cbc9d22e49.
2020-02-27 14:33:43 +01:00
Hans Wennborg 5122e82870 [driver][darwin] Don't use -platform_version flag by default (PR44813)
The code in llvmorg-10-init-12188-g25ce33a6e4f is a breaking change for
users of older linkers who don't pass a version parameter, which
prevents a drop-in clang upgrade. Old tools can't know about what future
tools will do, so as a general principle the burden should be new tools
to be compatible by default. Also, for comparison, none of the other
tests of Version within AddLinkArgs add any new behaviors unless the
version is explicitly specified. Therefore, this patch changes the
-platform_version behavior from opt-out to opt-in.

Patch by David Major!

Differential revision: https://reviews.llvm.org/D74784
2020-02-27 13:48:26 +01:00
Jonathan Coe 548e540d2c [clang-format] Handle commas in [] in C#
Summary:
Respect setting `SpacesInSquareBrackets` for commas in square brackets in C# code.

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D75182
2020-02-27 11:49:30 +00:00
Simon Tatham 8c26f42fe9 [clang,ARM,MVE] Remove redundant #includes in test file.
I made that file by pasting together several pieces, and forgot to
take out the #include <arm_mve.h> from the tops of the later ones, so
the test was pointlessly including the same header five times. NFC.
2020-02-27 09:39:35 +00:00
Richard Smith 98ed0c5475 PR44978: Accept as an extension some cases where destructor name lookup
is ambiguous, but only one of the possible lookup results could possibly
be right.

Clang recently started diagnosing ambiguity in more cases, and this
broke the build of Firefox. GCC, ICC, MSVC, and previous versions of
Clang all accept some forms of ambiguity here (albeit different ones in
each case); this patch mostly accepts anything any of those compilers
accept.
2020-02-26 14:55:31 -08:00
Nathan James 16cabf278f [ASTMatchers] HasNameMatcher handles `extern "C"`
Summary: Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=42193 | hasName AST matcher is confused by extern "C" in namespace. ]]

Reviewers: klimek, aaron.ballman, gribozavr2

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75202
2020-02-26 22:07:47 +00:00
John McCall 7848a3c8ab Update the ARC docs for non-trivial ownership in structs. 2020-02-26 16:42:08 -05:00
Leonard Chan d2cbaf1755 Fix for the test failues introduced in https://reviews.llvm.org/D74704. 2020-02-26 12:23:15 -08:00
Eric Astor 85b641c27a [ms] Rename ParsingInlineAsm functions/variables to reflect MS-specificity.
Summary: ParsingInlineAsm was a misleading name. These values are only set for MS-style inline assembly.

Reviewed By: rnk

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D75198
2020-02-26 15:19:40 -05:00
Tyker ca50f09db9 [clang] fix error detection in consteval calls
Summary:
code like:
```
consteval int f() {
  int *A = new int(0);
  return *A;
}

int i1 = f();
```
currently doesn't generate any error.

Reviewers: rsmith

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D74418
2020-02-26 21:09:31 +01:00
Hiroshi Yamauchi 59fb9cde7a Devirtualize a call on alloca without waiting for post inline cleanup and next
DevirtSCCRepeatedPass iteration.  Needs ReviewPublic

This aims to fix a missed inlining case.

If there's a virtual call in the callee on an alloca (stack allocated object) in
the caller, and the callee is inlined into the caller, the post-inline cleanup
would devirtualize the virtual call, but if the next iteration of
DevirtSCCRepeatedPass doesn't happen (under the new pass manager), which is
based on a heuristic to determine whether to reiterate, we may miss inlining the
devirtualized call.

This enables inlining in clang/test/CodeGenCXX/member-function-pointer-calls.cpp.
2020-02-26 09:51:24 -08:00
John Brawn 590dc8d02c Use virtual functions in ParsedAttrInfo instead of function pointers
This doesn't do anything on its own, but it's the first step towards
allowing plugins to define attributes. It does simplify the
ParsedAttrInfo generation in ClangAttrEmitter a little though.

Differential Revision: https://reviews.llvm.org/D31337
2020-02-26 17:24:30 +00:00
Jonathan Coe e8c5fea243 [clang-format] Special handling of spaces for C# code
Summary:
Ensure that there are spaces around braces '{', '}'.

Ensure that there is a space before and after '=>'.

Ensure that 'async' and 'when' are considered as keywords when inserting spaces.

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir

Tags: #clang-format

Differential Revision: https://reviews.llvm.org/D75129
2020-02-26 15:27:03 +00:00
Simon Tatham 9eb3cc10b2 [ARM,MVE] Add predicated intrinsics for many unary functions.
Summary:
This commit adds the predicated MVE intrinsics for the same set of
unary operations that I added in their unpredicated forms in

* D74333 (vrint)
* D74334 (vrev)
* D74335 (vclz, vcls)
* D74336 (vmovl)
* D74337 (vmovn)

but since the predicated versions are a lot more similar to each
other, I've kept them all together in a single big patch. Everything
here is done in the standard way we've been doing other predicated
operations: an IR intrinsic called `@llvm.arm.mve.foo.predicated` and
some isel rules that match that alongside whatever they accept for the
unpredicated version of the same instruction.

In order to write the isel rules conveniently, I've refactored the
existing isel rules for the affected instructions into multiclasses
parametrised by a vector-type class, in the usual way. All those
refactorings are intended to leave the existing isel rules unchanged:
the only difference should be that new ones for the predicated
intrinsics are introduced.

The only tiny infrastructure change I needed in this commit was to
change the implementation of `IntrinsicMX` in `arm_mve_defs.td` so
that the records it defines are anonymous rather than named (and use
`NameOverride` to set the output intrinsic name), which allows me to
call it twice in two multiclasses with the same `NAME` without a
tablegen-time error.

Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D75165
2020-02-26 15:12:07 +00:00
Hans Wennborg 41a6612ea8 Put microsoft template parameter shadow warning behind separate flag (PR44794)
Differential revision: https://reviews.llvm.org/D75121
2020-02-26 16:04:40 +01:00
Yitzhak Mandelbaum 38b4516de8 [libTooling] Add function to determine associated text of a declaration.
Summary:
Second attempt -- the first was reverted in commit 0e480b39c6, because of test breakages. This revision fixes the cause of the test breakages.

Original description follows:
This patch adds `getAssociatedRange` which, for a given decl, computes preceding
and trailing text that would conceptually be associated with the decl by the
reader. This includes comments, whitespace, and separators like ';'.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72153
2020-02-26 09:56:48 -05:00
Sven van Haastregt 319ea2dd9e [OpenCL] Add atomic type builtins
Add atomic types and builtins operating on those atomic types to
`-fdeclare-opencl-builtins`.  The _explicit variants are left out of
this commit, as these take enum arguments that are not yet supported
by the `-fdeclare-opencl-builtins` machinery.
2020-02-26 14:08:23 +00:00
Kirill Bobyrev 6e34a9a838
[OpenMP] Fix the test by generating output file in temporary directory
Related Revison: D74925
Commit: 396b725394
2020-02-26 14:07:13 +01:00
Kadir Cetinkaya 8c2cf499e6
[clang][Tooling] Add a way to tokenize a FileRange
Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D74962
2020-02-26 13:50:41 +01:00
Hans Wennborg 546918cbb4 Revert "[compiler-rt] Add a critical section when flushing gcov counters"
See discussion on PR44792.

This reverts commit 02ce9d8ef5.

It also reverts the follow-up commits
8f46269f0 "[profile] Don't dump counters when forking and don't reset when calling exec** functions"
62c7d8402 "[profile] gcov_mutex must be static"
2020-02-26 13:27:44 +01:00
serge-sans-paille 19c664f71e Fix typo in clang lit config
Typo introduced in e058667a2e
2020-02-26 10:37:04 +01:00
serge-sans-paille e058667a2e Support -fuse-ld=lld for riscv
Add a configure feature test to filter out tests that explicitly depend on platform linker.

Differential Revision: https://reviews.llvm.org/D74704
2020-02-26 10:20:20 +01:00