Commit Graph

87752 Commits

Author SHA1 Message Date
Erik Pilkington
1e8afba6f1 [clang] Add support for attribute 'swift_async_error'
This attribute specifies how an error is represented for a swift async method.
rdar://71941280

Differential revision: https://reviews.llvm.org/D96175
2021-02-10 13:18:13 -05:00
Tom Weaver
b86a763afb Revert "Revert "[clang][driver] Only warn once about invalid library values""
This reverts commit a743702a1f.

Test was fixed in c6a1b16db7
2021-02-10 16:40:07 +00:00
Tom Weaver
a743702a1f Revert "[clang][driver] Only warn once about invalid library values"
This reverts commit a6439b5208.

Caused buildbot failure http://lab.llvm.org:8014/#/builders/125/builds/125
2021-02-10 16:37:34 +00:00
Paul Robinson
5ea2d4fa48 Avoid conflicts between debug-info and pseudo-probe profiling
After D93264, using both -fdebug-info-for-profiling and
-fpseudo-probe-for-profiling will cause the compiler to crash.
Diagnose these conflicting options in the driver.

Also, the existing CodeGen test was using the driver when it should be
running cc1.

Differential Revision: https://reviews.llvm.org/D96354
2021-02-10 07:09:18 -08:00
Nico Weber
c6a1b16db7 clang: try to fix Driver/undefined-libs.cpp on non-linux 2021-02-10 09:45:04 -05:00
Timm Bäder
6f9db455a5 [clang][NFC] Fix undefined-libs tests
Not all platforms accept -stdlib or -rtlib. Instead of complaining about
the wrong argument to these options, clang complains about the option
itself being present.

Pass an appropriate -target to the clang invocations.
2021-02-10 15:01:09 +01:00
Jan Svoboda
a7150415dd [clang][cli] Declare local variable for marshalling macros
Some Windows build bots report `FileSystemOpts` and `MigratorOpts` as undeclared. This fix renames the parameter and declares a local variable with the original name.
2021-02-10 13:54:08 +01:00
Jan Svoboda
fa11496b61 [clang][cli] Extract FileSystem and Migrator options parsing/generation
This patch splits out the last two option groups (`Filesystem` and `Migrator`) into their own `Parse`/`Generate` functions.

This effectively removes the need for `parseSimpleArgs` and marshalling block in `CompilerInvocation::generateCC1CommandLine`.

The two new `Parse`/`Generate` functions are not part of the round-trip, because they contain no custom code and the very next patch starts round-tripping the whole `CompilerInvocation`.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96278
2021-02-10 13:36:00 +01:00
Jan Svoboda
eb581fc324 [clang][cli] Generate and round-trip Diagnostic options
This patch implements generation of remaining diagnostic options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96274
2021-02-10 12:44:49 +01:00
Jan Svoboda
17e5c99d51 [clang][cli] Generate and round-trip DependencyOutput options
This patch implements generation of remaining dependency output options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96273
2021-02-10 12:20:51 +01:00
Jan Svoboda
b89af18d9e [clang][cli] Generate and round-trip Target options
This patch implements generation of remaining target options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96158
2021-02-10 11:45:32 +01:00
Jan Svoboda
cb933632bc [clang][cli] Generate and round-trip PreprocessorOutput options
This patch implements generation of remaining preprocessor output options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96156
2021-02-10 11:27:55 +01:00
Faris Rehman
6d48a1a53f [flang][driver] Add support for -fopenmp and -fopenacc
Add support for the following options:
* -fopenmp
* -fopenacc

Update OpenMP and OpenACC semantics tests to use the new driver if it is built, otherwise use f18.
OpenMP tests that include `use omp_lib` or run `test_symbols.sh` have not been updated as they require options `-intrinsic-module-directory` and `-funparse-with-symbols` which are currently not implemented in the new driver.
Similarly OpenACC tests that run `test_symbols.sh` have not been updated.

This patch also moves semanticsContext to CompilerInvocation and creates it in CompilerInvocation#setSemanticsOpts so that the semantics context can use Fortran::parser::Options#features.

Summary of changes:
- Move semanticsContext to CompilerInvocation.h
- Update OpenMP and OpenACC semantics tests that do not rely on `-intrinsic-module-directory` and `-funparse-with-symbols` to use %flang

Differential Revision: https://reviews.llvm.org/D96032
2021-02-10 09:59:35 +00:00
Sven van Haastregt
a7d01772ac [OpenCL] Add cl_khr_subgroup_clustered_reduce to TableGen BIFs
Add the builtin functions brought by the
cl_khr_subgroup_clustered_reduce extension to
`-fdeclare-opencl-builtins`.
2021-02-10 09:44:52 +00:00
Sven van Haastregt
9ae99a0de8 [OpenCL] Add cl_khr_subgroup_non_uniform_arithmetic to TableGen BIFs
Add the builtin functions brought by the
cl_khr_subgroup_non_uniform_arithmetic extension to
`-fdeclare-opencl-builtins`.

Differential Revision: https://reviews.llvm.org/D95951
2021-02-10 09:44:39 +00:00
Artem Dergachev
ddb01010b2 Revert "[analyzer] RetainCountChecker: Add a suppression for OSSymbols."
This reverts commit 3500cc8d89.

This old commit was made over a completely false premise. OSSymbols
aren't different from other OSObjects and we shouldn't treat them
differently for the purposes of static analysis.
2021-02-09 23:44:33 -08:00
Timm Bäder
a6439b5208 [clang][driver] Only warn once about invalid library values
Since ToolChain::GetCXXStdlibType() is a simple getter that might emit
the "invalid library name in argument" warning, it can conceivably be
called several times while initializing the build pipeline.

Before this patch, a simple 'clang++ -stdlib=foo ./test.cpp' would print
the warning twice, -rt=lib=foo would print 6 times.

Change this and always only print the warning once. Keep the rest of the
semantics of the functions.

Differential Revision: https://reviews.llvm.org/D95915
2021-02-10 06:19:52 +01:00
Yang Fan
66ac53fe31
[clang][cli] Fix gcc "enumeral and non-enumeral type in conditional expression" warning (NFC) 2021-02-10 11:15:39 +08:00
Richard Smith
d5d8c529ab PR48545: Access check the inherited constructor, not the inheriting
constructor.

We got this wrong only when forming a CXXTemporaryObjectExpr, which
caused the bug to only appear for certain syntactic forms.
2021-02-09 13:27:55 -08:00
Artem Belevich
2aa01ccec3 [CUDA, NVPTX] Allow targeting sm_86 GPUs.
The patch only plumbs through the option necessary for targeting sm_86 GPUs w/o
adding any new functionality.

Differential Revision: https://reviews.llvm.org/D95974
2021-02-09 11:01:10 -08:00
Nico Weber
de1966e542 Revert "[ObjC][ARC] Use operand bundle 'clang.arc.rv' instead of explicitly"
This reverts commit 4a64d8fe39.
Makes clang crash when buildling trivial iOS programs, see comment
after https://reviews.llvm.org/D92808#2551401
2021-02-09 11:06:32 -05:00
Jan Svoboda
5e8a246ac9 [clang][cli] Generate and round-trip Frontend options
This patch implements generation of remaining frontend options and tests it by performing parse-generate-parse round trip.

Depends on D96269.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96155
2021-02-09 16:40:30 +01:00
Anastasia Stulova
79b222c39f [OpenCL] Fix types with signed prefix in arginfo metadata.
Signed prefix is removed and the single word spelling is
printed for the scalar types.

Tags: #clang

Differential Revision: https://reviews.llvm.org/D96161
2021-02-09 15:13:19 +00:00
Jan Svoboda
396d6a3220 [clang][cli] Store unsigned instead of OptSpecifier in table
This fixes some buildbot failures with ambiguous call to OptSpecifier constructor.
2021-02-09 15:46:10 +01:00
Jan Svoboda
7369bfb8ab [clang][cli] Look up program action argument in a table
This patch extracts the mapping between command line option and frontend::ActionKind into a table. The table can be reused when parsing and also generating command line options.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96269
2021-02-09 15:29:33 +01:00
Jan Svoboda
521e1733f1 [clang][cli] Store InputKind in FrontendOptions
This patch stores the `InputKind` (parsed mainly from `-x`) to `FrontendOptions`. This is necessary for command line generation.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96149
2021-02-09 15:19:26 +01:00
Wang, Pengfei
dd2460ed5d [X86] Always assign reassoc flag for intrinsics *reduce_add/mul_ps/pd.
Intrinsics *reduce_add/mul_ps/pd have assumption that the elements in
the vector are reassociable. So we need to always assign the reassoc
flag when we call _mm_reduce_* intrinsics.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D96231
2021-02-09 21:14:06 +08:00
Vitaly Buka
03c6a6d9ef [NFC,Clang] Add more Asan Driver tests 2021-02-09 03:08:00 -08:00
Vitaly Buka
4ddf7562d5 [NFC,Clang] Add SanCov Driver tests 2021-02-09 03:08:00 -08:00
Vitaly Buka
dde9f0fa98 [NFC,Clang] Add LTO Driver MSan,KMsan tests 2021-02-09 03:08:00 -08:00
Vitaly Buka
9ff678f614 [NFC,Clang] Add LTO Driver DFsan tests 2021-02-09 03:08:00 -08:00
Vitaly Buka
ea891099f2 [NFC,Clang] Add LTO Driver Tsan tests 2021-02-09 03:08:00 -08:00
Valeriy Savchenko
2f994d4ee9 [-Wcompletion-handler][NFC] Remove unexpected warnings on Windows 2021-02-09 13:50:11 +03:00
Jan Svoboda
e721bc9eff [clang][cli] Generate and round-trip CodeGen options
This patch implements generation of remaining codegen options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D96056
2021-02-09 11:43:38 +01:00
Jan Svoboda
ec12f5febe [clang][codegen] Remember string used to create llvm::Regex for optimization remarks
Regular expression patterns passed through the command line are being used to create an instances of `llvm::Regex` and thrown away.

There is no API to serialize `Regex` back to the original pattern. This means we have no way to reconstruct the original pattern from command line. This is necessary for serializing `CompilerInvocation`.

This patch stores the original pattern string in `CodeGenOptions` alongside the `llvm::Regex` instance.

Reviewed By: dexonsmith, thegameg

Differential Revision: https://reviews.llvm.org/D96036
2021-02-09 11:12:13 +01:00
Jan Svoboda
40c261c41c [clang][cli] Generate and round-trip language options
This patch implements generation of remaining language options and tests it by performing parse-generate-parse round trip (on by default for assert builds, off otherwise).

This patch also correctly reports failures in `parseSanitizerKinds`, which is necessary for emitting diagnostics when an invalid sanitizer is passed to `-fsanitize=` during round-trip.

This patch also removes TableGen marshalling classes from two options:
* `fsanitize_blacklist` When parsing: it's first initialized via the generated code, but then also changed by manually written code, which is confusing.
* `fopenmp` When parsing: it's first initialized via generated code, but then conditionally changed by manually written code. This is also confusing. Moreover, we need to do some extra checks when generating it, which would be really cumbersome in TableGen. (Specifically, not emitting it when `-fopenmp-simd` was present.)

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D95793
2021-02-09 10:18:55 +01:00
Valeriy Savchenko
d1522d349f [-Wcompletion-handler] Support checks with builtins
It is very common to check callbacks and completion handlers for null.
This patch supports such checks using built-in functions:
  * __builtin_expect
  * __builtin_expect_with_probablity
  * __builtin_unpredictable

rdar://73455388

Differential Revision: https://reviews.llvm.org/D96268
2021-02-09 11:32:24 +03:00
Yaxun (Sam) Liu
98c21289f1 [CUDA][HIP] Add -fuse-cuid
This patch added a distinct CUID for each input file, which is represented by InputAction.
clang initially creates an InputAction for each input file for the host compilation. In CUDA/HIP action
builder, each InputAction is given a CUID and cloned for each GPU arch, and the CUID is also cloned. In this way,
we guarantee the corresponding device and host compilation for the same file shared the
same CUID. On the other hand, different compilation units have different CUID.

-fuse-cuid=random|hash|none is added to control the method to generate CUID. The default
is hash. -cuid=X is also added to specify CUID explicitly, which overrides -fuse-cuid.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D95007
2021-02-08 22:26:12 -05:00
Richard Smith
21e8bb8325 PR48606: The lifetime of a constexpr heap allocation always started
during the same evaluation.

It looks like the only case for which this matters is determining
whether mutable subobjects of a heap allocation can be modified during
constant evaluation.
2021-02-08 17:58:05 -08:00
Richard Smith
c945dc4a50 PR48587: is_constant_evaluated() should not evaluate to true during a
variable's destruction if it didn't do so during construction.

The standard doesn't give any guidance as to what to do here, but this
approach seems reasonable and conservative, and has been proposed to the
standard committee.
2021-02-08 17:34:40 -08:00
Yaxun (Sam) Liu
52f312c69e Fix failure in cuda-external-tools.cu
-fgpu-rdc is output in different order
2021-02-08 19:27:43 -05:00
Argyrios Kyrtzidis
a8cb39bab0 Make sure a module file with errors produced via '-fallow-pcm-with-compiler-errors' can be loaded when using implicit modules
A module with errors would be marked as out-of-date, then the `compilerModule` action would produce it, but due to the error it would be treated as failure and the resulting PCM would not get used.

rdar://74087062

Differential Revision: https://reviews.llvm.org/D96246
2021-02-08 16:10:39 -08:00
Yaxun (Sam) Liu
1dab94f9ed [CUDA][HIP] Pass -fgpu-rdc to host clang -cc1
Currently -fgpu-rdc is not passed to host clang -cc1.
This causes issue because -fgpu-rdc affects shadow
variable linkage in host compilation.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D96105
2021-02-08 19:08:20 -05:00
Fangrui Song
87dbdd2e3b [FileCheck] Default --allow-unused-prefixes to false
Link: https://lists.llvm.org/pipermail/llvm-dev/2020-October/146162.html "[RFC] FileCheck: (dis)allowing unused prefixes"

If a downstream project using lit needs time for transition,
add the following to `lit.local.cfg`:

```
from lit.llvm.subst import ToolSubst

fc = ToolSubst('FileCheck', unresolved='fatal')
config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes'))
```

Differential Revision: https://reviews.llvm.org/D95849
2021-02-08 13:37:04 -08:00
Xiangling Liao
6b1e2fc893 [FE] Manipulate the first byte of guard variable type in both load and store operation
As Itanium ABI[http://itanium-cxx-abi.github.io/cxx-abi/abi.html#once-ctor]
points out:

"The size of the guard variable is 64 bits. The first byte (i.e. the byte at
the address of the full variable) shall contain the value 0 prior to
initialization of the associated variable, and 1 after initialization is complete."

Differential Revision: https://reviews.llvm.org/D95822
2021-02-08 11:14:34 -05:00
Anastasia Stulova
ecc8ac3f08 [OpenCL] Fix pipe type printing in arg info metadata
Pipe element type spelling for arg info metadata
should follow the same behavior as normal type spelling.

We should only use the canonical type spelling in the
base type field.

This patch also removed duplication in type handling.

Tags: #clang

Differential Revision: https://reviews.llvm.org/D96151
2021-02-08 16:05:13 +00:00
einvbri
9083d0a40d Revert "[Sema] Fix -Warray-bounds false negative when casting an out-of-bounds array item"
This reverts commit e48f444751.

thakis noticed false reports, so reverting this change for now until
those can be sorted out.

See https://reviews.llvm.org/D71714
2021-02-08 06:38:31 -06:00
Kadir Cetinkaya
f743184911
[clang][CodeComplete] Fix crash on ParenListExprs
Fixes https://github.com/clangd/clangd/issues/676.

Differential Revision: https://reviews.llvm.org/D95935
2021-02-08 13:16:49 +01:00
Jan Svoboda
e22677bbdb Reapply "[clang][cli] Report result of ParseLangArgs"
This reverts commit 6039f821 and reapplies bff6d9bb.

Clang's Index/implicit-attrs.m test invokes c-index-test with -fobjc-arc. This flag is not compatible with -fobjc-runtime=gcc, which gets implied on Linux.

The original commit uncovered this by correctly reporting issues when parsing -cc1 command line.

This commit fixes the test to explicitly provide ObjectiveC runtime compatible with ARC.
2021-02-08 13:14:43 +01:00
Sven van Haastregt
a016374d07 [OpenCL] Do not enforce ASTContext for OCL2Qual
Do not enforce that the expression to obtain the QualType for an
OpenCL type starts with an ASTContext.  This adds the required
flexibility for handling the remaining missing argument types such as
enums.

Differential Revision: https://reviews.llvm.org/D96050
2021-02-08 10:56:39 +00:00