Commit Graph

92979 Commits

Author SHA1 Message Date
Jan Svoboda 27d9a58407 [clang][modules] Infer framework modules in explicit builds
This patch enables inferring framework modules in explicit builds in all contexts. Until now, inferring framework modules only worked with `-fimplicit-module-maps` due to this block of code:

```
// HeaderSearch::loadFrameworkModule
  case LMM_InvalidModuleMap:
    // Try to infer a module map from the framework directory.
    if (HSOpts->ImplicitModuleMaps)
      ModMap.inferFrameworkModule(Dir, IsSystem, /*Parent=*/nullptr);
    break;
```

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D113880
2022-02-23 14:46:23 +01:00
Timm Bäder 2f300d34de [clang][driver][wasm] Fix libstdc++ target-dependent include dir
The triple goes after the gcc version, not before. Also add the
/backward version.

Differential Revision: https://reviews.llvm.org/D120251
2022-02-23 14:38:34 +01:00
Sven van Haastregt aa9c2d19d9 [OpenCL] Align subgroup builtin guards
Until now, subgroup builtins are available with `opencl-c.h` when at
least one of `cl_intel_subgroups`, `cl_khr_subgroups`, or
`__opencl_c_subgroups` is defined.  With `-fdeclare-opencl-builtins`,
subgroup builtins are conditionalized on `cl_khr_subgroups` only.

Align `-fdeclare-opencl-builtins` to `opencl-c.h` by introducing the
internal `__opencl_subgroup_builtins` macro.

Differential Revision: https://reviews.llvm.org/D120254
2022-02-23 12:22:09 +00:00
Balazs Benics 7036413dc2 Revert "Revert "[analyzer] Fix taint rule of fgets and setproctitle_init""
This reverts commit 2acead35c1.

Let's try `REQUIRES: asserts`.
2022-02-23 12:55:31 +01:00
Balazs Benics a848a5cf2f Revert "Revert "[analyzer] Fix taint propagation by remembering to the location context""
This reverts commit d16c5f4192.

Let's try `REQUIRES: asserts`.
2022-02-23 12:53:07 +01:00
Dawid Jurczak fbe38a784e [NFC][Lexer] Make access to LangOpts more consistent
Before this change without any good reason Lexer::LangOpts is sometimes accessed by getter and another time read directly in Lexer functions.
Since getLangOpts is a bit more verbose prefer direct access to LangOpts member when possible.

Differential Revision: https://reviews.llvm.org/D120333
2022-02-23 12:46:13 +01:00
iains e0f1dd018e [C++20][Modules] Rework testcase to use split file [NFC].
This switches the testcase committed for initial C++20 modules import tracking to
use split-file rather than preprocessor directives.

Differential Revision: https://reviews.llvm.org/D120352
2022-02-23 11:07:36 +00:00
Stanislav Gatev 169e1aba55 Revert "[clang][dataflow] Add support for global storage values"
This reverts commit 7ea103de14.
2022-02-23 10:32:17 +00:00
Iain Sandoe 5a74e6a21c [Modules] Add module structure output to -module-file-info.
It is useful to be able to visualise the C++20 modules content of a PCM file
both for inspection and for testing.  In particular, when adding more module
types to support C++20 Partitions and Header Units, we would like to be able
to confirm that the output PCM has the intended structure.

The existing scheme for dumping data is restricted to the content of the AST
file control block, which does not include structural data beyond imports.

The change here makes use of the AST unit that is set up by BeginSourceFile
to query for the information on the primary and sub-modules.  We can then
inspect each of these in turn, accounting for Global, Private, Imported and
Exported modules/fragments and then showing the sub-stucture of the main
module(s).

The disadvantage of this mechanism is that it has no easy method to control
the granularity of the output.  Perhaps more detailed inspection would be
better handled by a stand-alone module inspection tool.

Differential Revision: https://reviews.llvm.org/D119823
2022-02-23 10:26:42 +00:00
Simon Pilgrim 9d91e03b7d [clang] CIndex.cpp - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointers are used immediately, so assert the cast is correct instead of returning nullptr
2022-02-23 10:09:44 +00:00
Balazs Benics fa0a80e017 Revert "Revert "[analyzer] Add failing test case demonstrating buggy taint propagation""
This reverts commit b8ae323cca.

Let's try `REQUIRES: asserts`.
2022-02-23 10:48:06 +01:00
Nathan James c34d898183
[ASTMatchers] Expand isInline matcher to VarDecl
Add support to the `isInline` matcher for C++17's inline variables.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D118900
2022-02-23 08:34:00 +00:00
Chuanqi Xu f85a6a8127 [NFC] Add unittest for Decl::isInExportDeclContext 2022-02-23 16:29:42 +08:00
Stanislav Gatev 7ea103de14 [clang][dataflow] Add support for global storage values
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D120149
2022-02-23 08:27:58 +00:00
Haojian Wu a2fab82f33 [pseudo] Implement LRTable.
This patch introduces a dense implementation of the LR parsing table, which is
used by LR parsers.

We build a SLR(1) parsing table from the LR(0) graph.

Statistics of the LR parsing table on the C++ spec grammar:
  - number of states: 1449
  - number of actions: 83069
  - size of the table (bytes): 334928

Differential Revision: https://reviews.llvm.org/D118196
2022-02-23 09:21:34 +01:00
Arthur Eubanks 36e335eeb5 [clang] Remove Address::deprecated() calls in CodeGenFunction.cpp 2022-02-22 18:28:49 -08:00
Joseph Huber 6a0b78af91 [OpenMP] Remove static allocator in linker wrapper
Summary:
We don't need this static allocator to survive the entire file, the
strings stored have a defined lifetime.
2022-02-22 21:22:19 -05:00
Joseph Huber 55cb84d9fb [OpenMP] Unrecognized objects should not be considered failure
Summary:
This patch removes the error we recieve when attempting to extract
offloading sections. We shouldn't consider this a failure because
extracting bitcode isn't necessarily required.
2022-02-22 21:22:18 -05:00
Arthur Eubanks cde658fa1f [clang] Remove Address::deprecated() calls in CGVTables.cpp 2022-02-22 16:54:28 -08:00
Arthur Eubanks 3ef7e6c53c [clang] Remove an Address::deprecated() call in CGClass.cpp 2022-02-22 16:19:06 -08:00
Björn Schäpers 923c3755ea [clang-format] Don't break semi after requires clause ...
..regardless of the chosen style.

Fixes https://github.com/llvm/llvm-project/issues/53818

Differential Revision: https://reviews.llvm.org/D120278
2022-02-22 22:08:03 +01:00
Björn Schäpers 7ebb00a22e [clang-format][NFC] Simplify if in ContinuationIndenter::addTokenOCL
Setting a boolean within an if and only using it in the very next if is
a bit confusing. Merge it into one if.

Differential Revision: https://reviews.llvm.org/D120237
2022-02-22 22:08:02 +01:00
Rainer Orth b1fc966d2e [Driver] Support Solaris/amd64 GetTls
This is the driver part of D91605 <https://reviews.llvm.org/D91605>, a
workaround to allow direct calls to `__tls_get_addr` on Solaris/amd64.

Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.

Differential Revision: https://reviews.llvm.org/D119829
2022-02-22 20:14:33 +01:00
Shilei Tian 104d9a6743 [Clang][OpenMP] Add the codegen support for `atomic compare`
This patch adds the codegen support for `atomic compare` in clang.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D118632
2022-02-22 13:01:39 -05:00
Aaron Ballman 16994a2cfa Fix the Sphinx build after f8cedc642d 2022-02-22 12:50:39 -05:00
Simon Atanasyan cedc23bc86 [MIPS] Add `-no-pie` option to the clang driver's tests depend on it 2022-02-22 20:24:21 +03:00
serge-sans-paille 79c9072dc0 Restore documentation for __builtin_assume
This got removed by 6cacd420a1, and that was a
mistake.

Differential Revision: https://reviews.llvm.org/D120205
2022-02-22 17:19:11 +01:00
tyb0807 8e10448cbb [AArch64] Remove unused feature flags from AArch64TargetInfo
This removes two feature flags from `AArch64TargetInfo` class:

- `HasHBC`: this feature does not involve generating any IR intrinsics,
so clang does not need to know about whether it is set

- `HasCrypto`: this feature is deprecated in favor of finer grained
features such as AES, SHA2, SHA3 and SM4. The associated ACLE macro
__ARM_FEATURE_CRYPTO is thus no longer used.

Differential Revision: https://reviews.llvm.org/D118757
2022-02-22 16:13:44 +00:00
Marek Kurdej 071f870e7f [clang-format] Avoid parsing "requires" as a keyword in non-C++-like languages.
Fixes the issue raised post-review in D113319 (cf. https://reviews.llvm.org/D113319#3337485).

Reviewed By: krasimir

Differential Revision: https://reviews.llvm.org/D120324
2022-02-22 16:55:38 +01:00
Marek Kurdej fee4a9712f [clang-format] Use FormatToken::is* functions without passing through `Tok`. NFC. 2022-02-22 16:41:15 +01:00
Timm Bäder 535a23053b Fix docs build after f8cedc642d
Looks like rst doesn't like '#' in link texts. Just remove it.
2022-02-22 16:35:35 +01:00
Timm Bäder f8cedc642d [clang] Never wrap a nullptr in CXXNewExpr::getArraySize()
Otherwise callers of these functions have to check both the return value
for and the contents of the returned llvm::Optional.

Fixes #53742

Differential Revision: https://reviews.llvm.org/D119525
2022-02-22 16:27:32 +01:00
Timm Bäder 02571f86bb [clang][www] Port make_cxx_dr_status script to Python3
And run it to re-generate the cxx_dr_status.html

Differential Revision: https://reviews.llvm.org/D120313
2022-02-22 15:47:43 +01:00
Krasimir Georgiev c9592ae49b [clang-format] Fix preprocessor nesting after commit 529aa4b011
In 529aa4b011
by setting the identifier info to nullptr, we started to subtly
interfere with the parts in the beginning of the function,
529aa4b011/clang/lib/Format/UnwrappedLineParser.cpp (L991)
causing the preprocessor nesting to change in some cases. E.g., for the
added regression test, clang-format started incorrectly guessing the
language as C++.

This tries to address this by introducing an internal identifier info
element to use instead.

Reviewed By: curdeius, MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D120315
2022-02-22 15:43:18 +01:00
Sven van Haastregt e7e17b30d0 [OpenCL] opencl-c.h: use uint/ulong consistently
Most places already seem to use the short spelling instead of
'unsigned int/long', so perform the following substitutions:

  s/unsigned int /uint /g
  s/unsigned long /ulong /g

This simplifies completeness comparisons against OpenCLBuiltins.td.

Differential Revision: https://reviews.llvm.org/D120032
2022-02-22 10:15:40 +00:00
Iain Sandoe c9cc8035eb [C++20][Modules][2/8] Add enumerations for partition modules and stream them.
This is an initial enabling patch for module partition support.
We add enumerations for partition interfaces/implementations.

This means that the module kind enumeration now occupies three
bits, so the AST streamer is adjusted for this.  Adding one bit there
seems preferable to trying to overload the meanings of existing
kinds (and we will also want to add a C++20 header unit case later).

Differential Revision: https://reviews.llvm.org/D114714
2022-02-22 10:08:15 +00:00
tyb0807 650aec687e [ARM][AArch64] Add missing v8.x checks
Summary:
This patch adds checks that were missing in clang for Armv8.5/6/7-A. These include:
* ACLE macro defines for AArch32.
* Handling of crypto and SM4, SHA and AES feature flags on clang's driver.

Reviewers: dmgreen, SjoerdMeijer, tmatheson

Differential Revision: https://reviews.llvm.org/D116153
2022-02-22 09:07:59 +00:00
Sam McCall 48dc980847 [Format] Remove unused LineContainsContinuedForLoopSection. NFC
Differential Revision: https://reviews.llvm.org/D120282
2022-02-22 09:59:02 +01:00
Brad Smith 8d9eeb03b3 [Driver][OpenBSD] Add comments for C++ tests 2022-02-22 00:20:46 -05:00
Brad Smith 289b725051 [Driver][OpenBSD] Test tweaking and clean up 2022-02-21 23:44:53 -05:00
owenca 77e60bc42c [clang-format] Add option to insert braces after control statements
Adds a new option InsertBraces to insert the optional braces after
if, else, for, while, and do in C++.

Differential Revision: https://reviews.llvm.org/D120217
2022-02-21 20:16:25 -08:00
Brad Smith 95fed2b267 [Driver][OpenBSD] Pass sysroot to the linker 2022-02-21 23:11:13 -05:00
Petr Hosek eec3488cf1 [CMake][Fuchsia] Disable assertions and analyzer for stage 1
We don't need these in the first stage compiler and disabling these
helps a bit with the compile time and runtime performance.

Differential Revision: https://reviews.llvm.org/D120280
2022-02-21 13:31:13 -08:00
Alexey Bataev f9c3310d32 [OPENMP]Fix PR49366: crash on VLAs in task untied regions.
We need to capture the local variables into a record in task untied
regions but clang does not support record with VLA data members.

Differential Revision: https://reviews.llvm.org/D99436
2022-02-21 12:28:47 -08:00
Shilei Tian e2855e1760 [Clang][OpenMP] Add Sema support for atomic compare capture
This patch adds Sema support for `atomic compare capture`.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D120200
2022-02-21 14:21:02 -05:00
Shilei Tian 3a3d9ae545 [Clang][OpenMP] Fix wrong form of 'cond-update-stmt' in atomic_ast_print.cpp
In `clang/test/OpenMP/atomic_ast_print.cpp` for `atomic compare capture`,
it was using 'cond-expr-stmt' instead of 'cond-update-stmt'. The spec only supports
'cond-update-stmt'.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D120252
2022-02-21 11:40:09 -05:00
Shilei Tian 6da60647cd [Clang][Sema] Check unexpected else statement in cond-update-stmt
In 'cond-update-stmt', `else` statement is not expected. This patch adds
the check in Sema.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D120225
2022-02-21 08:20:34 -05:00
Kito Cheng 071a9b751a [NFC][RISCV] Fix path checking issue if default sysroot is given 2022-02-21 20:43:51 +08:00
Sven van Haastregt 52df866615 [OpenCL] opencl-c.h: remove arg names from atomics; NFC
This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" the identifiers "success",
"failure", "desired", "value".

Differential Revision: https://reviews.llvm.org/D119560
2022-02-21 11:29:10 +00:00
Benjamin Kramer b32ead41b1 Increase the limit on parser diagnostics
We're really close to the limit
$ grep -c DIAG tools/clang/include/clang/Basic/DiagnosticParseKinds.inc
598
2022-02-21 11:44:48 +01:00