Commit Graph

92193 Commits

Author SHA1 Message Date
Anastasia Stulova dbb8d08637 [SPIR-V] Add linking using spirv-link.
Add support of linking files compiled into SPIR-V objects
using spirv-link.

Command line inteface examples:

clang --target=spirv64 test1.cl test2.cl

clang  --target=spirv64 test1.cl -o test1.o
clang  --target=spirv64 test1.o test2.cl -o test_app.out

This works independently from the SPIR-V generation method
(via an external tool or an internal backend) and applies
to either approach that is being used.

Differential Revision: https://reviews.llvm.org/D116266
2022-01-11 13:11:38 +00:00
David Green 0c7f515f88 Revert "[Clang][AArch64][ARM] PMUv3.4 Option Added"
It turns out this is conflating a few different PMU extensions. And on
Arm ended up breaking M-Profile code generation. Reverting for the
moment whilst we sort out the details.

This reverts commit d17fb46e89.
2022-01-11 12:33:53 +00:00
Egor Zhdan fda47db8ee [Clang][Sema] Fix attribute mismatch warning for ObjC class properties
If a class declares an instance property, and an inheritor class declares a class property with the same name, Clang Sema currently treats the latter as an overridden property, and compares the attributes of the two properties to check for a mismatch. The resulting diagnostics might be misleading, since neither of the properties actually overrides the another one.

rdar://86018435

Differential Revision: https://reviews.llvm.org/D116412
2022-01-11 12:10:18 +00:00
Nikita Popov acc39873b7 [CodeGen] Avoid deprecated Address constructor 2022-01-11 13:07:02 +01:00
Simon Pilgrim fba8ad2b71 [SemaTemplateInstantiate] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr
2022-01-11 11:29:38 +00:00
Haojian Wu 41fbdfa4d5 Reland "[AST] Add RParen loc for decltype AutoTypeloc."
Reland 55d96ac and 37ec65e with a clang-tidy fix.
2022-01-11 12:06:18 +01:00
Hans Wennborg 0b48d0fe12 [ADT] Add an in-place version of toHex()
and use that to simplify MD5's hex string code which was previously
using a string stream, as well as Clang's
CGDebugInfo::computeChecksum().

Differential revision: https://reviews.llvm.org/D116960
2022-01-11 11:51:04 +01:00
Simon Pilgrim 2e52f76a72 [SemaOverload] compareConversionFunctions - use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is dereferenced immediately below, so assert the cast is correct instead of returning nullptr
2022-01-11 10:31:26 +00:00
Simon Pilgrim c61299e2b3 [SemaOverload] Use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is always dereferenced inside BuildSimilarlyQualifiedPointerType, so assert the cast is correct instead of returning nullptr
2022-01-11 10:31:25 +00:00
Martin Storsjö 18b2385f2b [clang] [test] Fix clang-cl unused argument tests on paths that start with /U
This reinstates a test that was temporarily removed in
e26bbae302, in a form that works on
Darwin.

Use -LD instead of -link as a linker argument that is unused when
compiling, that produces warnings normally. -LD can be placed anywhere
in the command line, so that the command line ends with "-- %s", making
paths starting with /U correctly interpreted as paths, not options.
2022-01-11 12:28:23 +02:00
Martin Storsjö e26bbae302 [clang] [test] Remove newly added tests that fail on Darwin
These tests were recently added in
50ec1306d0. The clang-cl invocations
interpret the source path, %s, which begins with /Users, as a cl
option /U. Normally this is worked around by passing -- before
the arguments that must be interpreted as files, not options, but
in the current test, the -link option must be passed last, after any
file names.
2022-01-11 11:06:29 +02:00
Nikita Popov 2d1b55ebea [CodeGen] Make element type in emitArrayDestroy() predictable
When calling emitArrayDestroy(), the pointer will usually have
ConvertTypeForMem(EltType) as the element type, as one would expect.
However, globals with initializers sometimes don't use the same
types as values normally would, e.g. here the global uses
{ double, i32 } rather than %struct.T as element type.

Add an early cast to the global destruction path to avoid this
special case. The cast would happen lateron anyway, it only gets
moved to an earlier point.

Differential Revision: https://reviews.llvm.org/D116219
2022-01-11 09:25:29 +01:00
Martin Storsjö 50ec1306d0 [clang] Add --start-no-unused-arguments/--end-no-unused-arguments to silence some unused argument warnings
When passing a set of flags to configure defaults for a specific
target (similar to the cmake settings `CLANG_DEFAULT_RTLIB`,
`CLANG_DEFAULT_UNWINDLIB`, `CLANG_DEFAULT_CXX_STDLIB` and
`CLANG_DEFAULT_LINKER`, but without hardcoding them in the binary),
some of the flags may cause warnings (e.g. `-stdlib=` when compiling C
code). Allow requesting selectively ignoring unused arguments among
some of the arguments on the command line, without needing to resort
to `-Qunused-arguments` or `-Wno-unused-command-line-argument`.

Fix up the existing diagnostics.c testcase. It was added in
response to PR12181 to fix handling of
`-Werror=unused-command-line-argument`, but the command line option
in the test (`-fzyzzybalubah`) now triggers "error: unknown argument"
instead of the intended warning. Change it into a linker input
(`-lfoo`) which triggers the intended diagnostic. Extend the
existing test case to check more cases and make sure that it keeps
testing the intended case.

Add testing of the new option to this existing test.

Differential Revision: https://reviews.llvm.org/D116503
2022-01-11 09:22:00 +02:00
Chuanqi Xu d9d63fc108 [AST] lookup in parent DeclContext for transparent DeclContext
The compiler would crash if we lookup for name in transparent decl
context. See the tests attached for example.

I think this should make sense since the member declared in transparent
DeclContext are semantically defined in the enclosing (non-transparent)
DeclContext, this is the definition for transparent DeclContext.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D116792
2022-01-11 10:16:26 +08:00
Chuanqi Xu 86c5b870b2 [AST] Don't consider 'ExportDecl' when calculating DeclContext 'Encloses'
This mimics the style of 90010c2e1 (Don't consider 'LinkageSpec' when
calculating DeclContext 'Encloses'). Since ExportDecl and LinkageSpec
are transparent DeclContext, they share some similarity.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D116911
2022-01-11 09:54:57 +08:00
Jennifer Yu 140a6b1e5c [clang][OpenMP5.1] Initial parsing/sema for 'indirect' clause
Differential Revision: https://reviews.llvm.org/D116764
2022-01-10 16:58:56 -08:00
Sam McCall 4258d68dc7 [Tooling] When transferring compile commands between files, always use '--'
"driver <flags> -- <input>" is a particularly convenient form of the
compile command to manipulate, with fewer special cases to handle.

Guaranteeing that the output command is of that form is cheap and makes
it easier to consume the result in some cases.

Differential Revision: https://reviews.llvm.org/D116721
2022-01-11 01:41:42 +01:00
Wolfgang Pieb d789ea7133 [Diagnostics] Don't drop a statically set NoWarningAsError flag during option processing
When a -W<diag> option is given on the command line, and the corresponding diagnostic has
the NoWarnOnError flag set, prevent the flag from being dropped when the severity is reevaluated.
This fixes PR51837.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D109981
2022-01-10 16:38:01 -08:00
Adrian Prantl eb200e584e Emit the C++ dialect in -gmodules .pcm files.
Because of commit: https://reviews.llvm.org/D104291 the -gmodules .pcm
files do not have the same DW_AT_language dialect as the .o file. This
was a simple matter of passing the DebugStrictDwarf flag to the
PCHContainerGenerator object's CodeGenOpts from the CompilerInstance
passed in to it.

Before this change if you ran dwarfdump on the gmodule cache folder
you would get DW_AT_language (DW_LANG_C_plus_plus) even when using
-std=c++14 with clang

Patch by Shubham Rastogi!

Differential Revision: https://reviews.llvm.org/D116790
2022-01-10 16:13:40 -08:00
Sam McCall bbf234b56a [CodeCompletion] Complete designators for fields in anonymous structs/unions
Fixes https://github.com/clangd/clangd/issues/836

Differential Revision: https://reviews.llvm.org/D116717
2022-01-11 00:58:49 +01:00
Yaxun (Sam) Liu 98ab43a1d2 [HIP] Fix device only linking for -fgpu-rdc
Currently when -fgpu-rdc is specified, HIP toolchain always does host linking even
if --cuda-device-only is specified.

This patch fixes that. Only device linking is performed when --cuda-device-only
is specified.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D116840
2022-01-10 17:38:02 -05:00
Stanislav Gatev e7481f6ee5 [clang][dataflow] Add transfer functions for assignment
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Differential Revision: https://reviews.llvm.org/D116596
2022-01-10 19:35:50 +00:00
Alex Xu (Hello71) f5b387988b Revert "[CodeGen] Mark fma as const for Android"
This code is intended to give a special exception for platforms which set errno in some math functions but not fma. This does not apply to Android, which does not set errno in any math functions (https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/math.h;drc=master;l=59). The correct implementation for Android is to set -fno-math-errno by default, which was done in https://reviews.llvm.org/D51068. Therefore, this special exception is no longer needed for Android. Deleting it slightly reduces code complexity, clang executable size, compile time, and test time.

This reverts fbfba29d74.

Reviewed By: pirama

Differential Revision: https://reviews.llvm.org/D116755
2022-01-10 11:31:09 -08:00
David Goldman 0cf7e61a42 [clang][HeaderSearch] Support framework includes in suggestPath...
Clang will now search through the framework includes to identify
the framework include path to a file, and then suggest a framework
style include spelling for the file.

Differential Revision: https://reviews.llvm.org/D115183
2022-01-10 12:25:53 -05:00
Kazu Hirata 7485e6c7e9 Revert "[clang] Remove redundant member initialization (NFC)"
This reverts commit 80e2c58749.

The original patch causes a lot of warnings on gcc like:

  llvm-project/clang/include/clang/Basic/Diagnostic.h:1329:3: warning:
  base class ‘class clang::StreamingDiagnostic’ should be explicitly
  initialized in the copy constructor [-Wextra]
2022-01-10 09:21:59 -08:00
Simon Pilgrim 4e77868c7c [SemaDecl] Use castAs<> instead of getAs<> to avoid dereference of nullptr
This will assert the cast is correct instead of returning nullptr
2022-01-10 16:31:08 +00:00
Yitzhak Mandelbaum 64f7b2d4bf [clang][dataflow] Change `transfer` function to update lattice element in place.
Currently, the transfer function returns a new lattice element, which forces an
unnecessary copy on processing each CFG statement.

Differential Revision: https://reviews.llvm.org/D116834
2022-01-10 14:45:30 +00:00
Haojian Wu c2293bc17d Revert "[AST] Add RParen loc for decltype AutoTypeloc."
This breaks a clang-tidy check, needs to investigate and fix. Revert
them to bring the buildbot back.

This reverts commit 55d96ac3dc and
37ec65e1d7
2022-01-10 15:18:41 +01:00
Nuno Lopes 7b1cb72ad9 [SROA] Switch replacement of dead/UB/unreachable ops from undef to poison
SROA has 3 data-structures where it stores sets of instructions that should
be deleted:
 - DeadUsers -> instructions that are UB or have no users
 - DeadOperands -> instructions that are UB or operands of useless phis
 - DeadInsts -> "dead" instructions, including loads of uninitialized memory
with users

The first 2 sets can be RAUW with poison instead of undef. No brainer as UB
can be replaced with poison, and for instructions with no users RAUW is a
NOP.

The 3rd case cannot be currently replaced with poison because the set mixes
the loads of uninit memory. I leave that alone for now.

Another case where we can use poison is in the construction of vectors from
multiple loads. The base vector for the first insertelement is now poison as
it doesn't matter as it is fully overwritten by inserts.

Differential Revision: https://reviews.llvm.org/D116887
2022-01-10 14:04:26 +00:00
Nikita Popov 7725331ccd [CodeGen] Avoid some pointer element type accesses
Possibly this is sufficient to fix PR53089.
2022-01-10 15:02:55 +01:00
Serge Guelton d2cc6c2d0c Use a sorted array instead of a map to store AttrBuilder string attributes
Using and std::map<SmallString, SmallString> for target dependent attributes is
inefficient: it makes its constructor slightly heavier, and involves extra
allocation for each new string attribute. Storing the attribute key/value as
strings implies extra allocation/copy step.

Use a sorted vector instead. Given the low number of attributes generally
involved, this is cheaper, as showcased by

https://llvm-compile-time-tracker.com/compare.php?from=5de322295f4ade692dc4f1823ae4450ad3c48af2&to=05bc480bf641a9e3b466619af43a2d123ee3f71d&stat=instructions

Differential Revision: https://reviews.llvm.org/D116599
2022-01-10 14:49:53 +01:00
Alex Xu (Hello71) f282b68091 set __NO_MATH_ERRNO__ if -fno-math-errno
This causes modern glibc to unset math_errhandling MATH_ERRNO. gcc 12
also sets some other macros, but most of them are associated with
flags ignored by clang, so without library examples, it is difficult to
determine whether they should be set. I think setting this one macro is
OK for now.
2022-01-10 08:45:46 -05:00
Haojian Wu 55d96ac3dc [AST] Add RParen loc for decltype AutoTypeloc.
Differential Revision: https://reviews.llvm.org/D116919
2022-01-10 12:46:27 +01:00
Haojian Wu abe3003ead [AST] Use recovery-expr to preserve incomplete-type-member-access expression.
Fixes https://github.com/clangd/clangd/issues/502

Differential Revision: https://reviews.llvm.org/D116922
2022-01-10 12:45:20 +01:00
Mubashar Ahmad d17fb46e89 [Clang][AArch64][ARM] PMUv3.4 Option Added
An option has been added to Clang to enable or disable
the PMU v3.4 architecture extension.

Differential Revision: https://reviews.llvm.org/D116748
2022-01-10 11:28:19 +00:00
Sam McCall 1ab13793be [clangd] Include fixer for missing functions in C
A function call `unresolved()` in C will generate an implicit declaration
of the missing function and warn `ext_implicit_function_decl` or so.
(Compared to in C++ where we get `err_undeclared_var_use`).
We want to try to resolve these names.

Unfortunately typo correction is disabled in sema for performance
reasons unless this warning is promoted to error.
(We need typo correction for include-fixer.)
It's not clear to me where a switch to force this correction on should
go, include-fixer is kind of a hack. So hack more by telling sema we're
promoting them to error.

Fixes https://github.com/clangd/clangd/issues/937

Differential Revision: https://reviews.llvm.org/D115490
2022-01-10 12:17:19 +01:00
Sam McCall 27ea0c4e72 [Parse] Use empty RecoveryExpr when if/while/do/switch conditions fail to parse
This allows the body to be parsed.
An special-case that would replace a missing if condition with OpaqueValueExpr
was removed as it's now redundant (unless recovery-expr is disabled).

For loops are not handled at this point, as the parsing is more complicated.

Differential Revision: https://reviews.llvm.org/D113752
2022-01-10 10:38:27 +01:00
Haojian Wu 4a4b8e4f99 [AST] Add more source information for DecltypeTypeLoc.
Adds the paren source location, and removes the hack in clangd.

Differential Revision: https://reviews.llvm.org/D116793
2022-01-10 09:34:18 +01:00
mydeveloperday 5c2e7c9ca0 [clang-format] Ensure we can correctly parse lambda in the template argument list
https://github.com/llvm/llvm-project/issues/46505

The presence of a lambda in an argument template list ignored the [] as a lambda at all, this caused the contents of the <> to be incorrectly analyzed.

```
struct Y : X < [] {
  return 0;
} > {};
```
Fixes: #46505

Reviewed By: curdeius

Differential Revision: https://reviews.llvm.org/D116806
2022-01-10 08:29:35 +00:00
jacquesguan 6b8362eb8d [RISCV] Disable EEW=64 for index values when XLEN=32.
Disable EEW=64 for vector index load/store when XLEN=32.

Differential Revision: https://reviews.llvm.org/D106518
2022-01-10 10:51:27 +08:00
Jim Lin 9b70ddaff6 [Builtins] Add missing the macro 'y' description in comments
New type str 'y' added from D76077. But missed its description in
comments.

Reviewed By: stuij

Differential Revision: https://reviews.llvm.org/D116509
2022-01-10 10:43:13 +08:00
Kazu Hirata b12fd13812 Fix bugprone argument comments.
Identified by bugprone-argument-comment.
2022-01-09 12:21:02 -08:00
Kazu Hirata ac2090d507 [clang] Remove unused forward declarations (NFC) 2022-01-09 12:21:00 -08:00
Jake Egan fbf52caf58 [AIX] Disable tests that fail because of no 64-bit XCOFF object file support
The modified tests fail because 64-bit XCOFF object files are not currently supported on AIX. This patch disables these tests on 64-bit AIX for now.

This patch is similar to D111887 except the failures on this patch are on a 64-bit build.

Reviewed By: shchenz, #powerpc

Differential Revision: https://reviews.llvm.org/D113049
2022-01-09 12:25:24 -05:00
Kazu Hirata 80e2c58749 [clang] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
2022-01-09 00:19:51 -08:00
Kazu Hirata 17d4bd3d78 [clang] Fix bugprone argument comments (NFC)
Identified with bugprone-argument-comment.
2022-01-09 00:19:49 -08:00
Kazu Hirata 40446663c7 [clang] Use true/false instead of 1/0 (NFC)
Identified with modernize-use-bool-literals.
2022-01-09 00:19:47 -08:00
Johannes Doerfert 37639b72a1 [OpenMP][FIX] Emit debug declares only if debug info is available
The `EmitDeclareOfAutoVariable` introduced in D114504 and D115510 has a
precondition that cannot be violated. It is unclear if we should call it
directly given the sparse usage in clang but for now we should at least
not crash if the debug info kind is too low.

Fixes #52938.

Differential Revision: https://reviews.llvm.org/D116865
2022-01-08 17:01:19 -06:00
Craig Topper db4cb4668b [docs] Fix documentation of -fno-strict-float-cast-overflow after D115804.
Previously this was documented as having the behavior of the
"target's native float-to-int conversion". After D115804, clang
uses saturating FP cast intrinsics which have the same behavior
on all targets.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D116856
2022-01-08 12:12:44 -08:00
Kazu Hirata d1b127b5b7 [clang] Remove unused forward declarations (NFC) 2022-01-08 11:56:40 -08:00
Simon Pilgrim 6ee589e2f5 [CGObjCMac] Use castAs<> instead of getAs<> to avoid dereference of nullptr inside BuildRCBlockVarRecordLayout
This will assert the cast is correct instead of returning nullptr (UnionType is a subtype of RecordType so this should be clean).
2022-01-08 16:18:55 +00:00
Simon Pilgrim 06e9733fec [CGExpr] Use castAs<> instead of getAs<> to avoid dereference of nullptr
This will assert the cast is correct instead of returning nullptr
2022-01-08 14:26:09 +00:00
owenca d97025ad3a [clang-format][NFC] Fix a bug in getPreviousToken() in the parser
Differential Revision: https://reviews.llvm.org/D116318
2022-01-07 21:12:18 -08:00
Jun Zhang 5be131922c
[NFC] Test commit.
This is just a test commit to check whether the permission I got is
correct or not.
2022-01-08 10:36:09 +08:00
Amy Huang 28d2977ff2 [-fms-extensions] Make some exception specification warnings/errors compatible with what cl.exe does
Make clang-cl error when a function definition is missing 'noexcept',
and succeed without warnings when missing '__declspec(nothrow)' or 'throw'.

Fixes pr52860

Differential Revision: https://reviews.llvm.org/D116256
2022-01-07 14:42:16 -08:00
Nick Desaulniers 3a604fdbcd [Clang][CFG] check children statements of asm goto
When performing CFG based analyses, don't forget to check the child
statements of an asm goto, such as the expressions used for
inputs+outputs.

Fixes: https://github.com/llvm/llvm-project/issues/51024
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1439

Reviewed By: void, jyknight, jyu2, efriedma

Differential Revision: https://reviews.llvm.org/D116059
2022-01-07 14:11:08 -08:00
John Ericson 44e3365775 [CMake] Factor out config prefix finding logic
See the docs in the new function for details.

 I think I found every instance of this copy pasted code. Polly could
 also use it, but currently does something different, so I will save the
 behavior change for a future revision.

We get the shared, non-installed CMake modules following the pattern
established in D116472.

It might be good to have LLD and Flang also use this, but that would be
a functional change and so I leave it as future work.

Reviewed By: beanz, lebedev.ri

Differential Revision: https://reviews.llvm.org/D116521
2022-01-07 20:16:18 +00:00
Jun Zhang b2ed9f3f44
[Clang] Implement the rest of __builtin_elementwise_* functions.
The patch implement the rest of __builtin_elementwise_* functions
specified in D111529, including:
* __builtin_elementwise_floor
* __builtin_elementwise_roundeven
* __builtin_elementwise_trunc

Signed-off-by: Jun <jun@junz.org>

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D115429
2022-01-07 15:11:36 +00:00
Marek Kurdej 4681ae9353 [clang-format] Use range-for loops. NFC.
* Avoid if check on every element of the loop when printing symbols.
2022-01-07 16:06:11 +01:00
Archibald Elliott 3aec4b3d34 Revert "Unaligned Access Warning Added"
This reverts commits:
- 2cd2600aba
- 11c67e5a4e

Due to test failures on Windows.
2022-01-07 13:07:30 +00:00
Archibald Elliott 11c67e5a4e [clang][driver] Don't pass -Wunaligned-access to cc1as
This is to fix some failing assembler tests.
2022-01-07 10:45:26 +00:00
Marek Kurdej 359b4e6cdb [clang-format] Use prefix increment and decrement. NFC. 2022-01-07 11:19:53 +01:00
Mubashar Ahmad 2cd2600aba Unaligned Access Warning Added
Added warning for potential cases of
unaligned access when option
-mno-unaligned-access has been specified
2022-01-07 09:54:20 +00:00
Egor Zhdan c033f0d9b1 [Clang][Sema] Avoid crashing for va_arg expressions with bool argument
This change fixes a compiler crash that was introduced in https://reviews.llvm.org/D103611: `Sema::BuildVAArgExpr` attempted to retrieve a corresponding signed type for `bool` by calling `ASTContext::getCorrespondingSignedType`.

rdar://86580370

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D116272
2022-01-07 10:41:45 +01:00
Marek Kurdej 91b9e6729c [clang-format] Fix `BraceWrapping: AfterFunction` affecting synchronized blocks in Java.
Fixes https://github.com/llvm/llvm-project/issues/32031.

Before this change, BraceWrapping: AfterFunction would affect synchronized blocks in Java, but they should be formatted w.r.t. BraceWrapping: AfterControlStatement.

Using the config:
```
BreakBeforeBraces: Custom
BraceWrapping:
  AfterControlStatement: false
  AfterFunction: true
```

would result in misformatted code like:
```
class Foo {
  void bar()
  {
    synchronized (this)
    {
      a();
      a();
    }
  }
}
```

instead of:
```
class Foo {
  void bar()
  {
    synchronized (this) {
      a();
      a();
    }
  }
}
```

Reviewed By: MyDeveloperDay, owenpan

Differential Revision: https://reviews.llvm.org/D116767
2022-01-07 10:06:49 +01:00
Marek Kurdej 01f355fe95 [clang-format] Use range-for loops. NFC.
Reviewed By: MyDeveloperDay, owenpan

Differential Revision: https://reviews.llvm.org/D116795
2022-01-07 10:01:09 +01:00
Qiu Chaofan c2cc70e4f5 [NFC] Fix endif comments to match with include guard 2022-01-07 15:52:59 +08:00
Alexandre Ganea a5af260d3e Silence warning with MSVC compiler.
D:\git\llvm-project\clang\unittests\Analysis\FlowSensitive\MultiVarConstantPropagationTest.cpp(104) : warning C4715: 'clang::dataflow::`anonymous namespace'::operator<<': not all control paths return a value
2022-01-06 16:51:37 -05:00
Michael Spencer 37e6e022d2 Re-land "[Clang][ScanDeps] Use the virtual path for module maps"
This re-lands:
- 04192422c4
- 015e08c6ba

Which I reverted in ea83517138 in error.

Differential Revision: https://reviews.llvm.org/D114206
2022-01-06 21:05:05 +00:00
mydeveloperday 031d3ece3f [clang-format] Fix a crash (assertion) in qualifier alignment when matching template closer is null
https://github.com/llvm/llvm-project/issues/53008

```
template <class Id> using A = quantity /**/<kind<Id>, 1>;
```

the presence of the comment between identifier and template opener seems to be causing the qualifier alignment to fail

Reviewed By: curdeius

Fixes: #53008

Differential Revision: https://reviews.llvm.org/D116726
2022-01-06 19:40:39 +00:00
Evgeny Mandrikov 2ccf0b76bc Fix build failure with GCC 11 in C++20 mode
See https://wg21.link/cwg2237

Reviewed By: shafik, dexonsmith

Differential Revision: https://reviews.llvm.org/D115355
2022-01-06 17:20:26 +01:00
Simon Pilgrim e3e8799beb [AST] ASTContext::mergeTypes - pull out repeated getAs<> calls. NFC.
Avoids static-analyzer null dereference warnings.
2022-01-06 16:04:36 +00:00
David Goldman f558acf492 Reland "[clang][ObjC] Add fix it for missing methods in impl"
This reverts commit 37be74885946f18dbeb70343ad659924c61d2549/
relands https://reviews.llvm.org/D116417 now that the internal
issue has been fixed.
2022-01-06 10:55:02 -05:00
Jan Svoboda d5ba066cb6 [clang][lex] NFC: Move some HeaderSearch functions to .cpp file 2022-01-06 16:32:02 +01:00
Chuanqi Xu bbce75e352 Update Bug report URL to Github Issues
Although we moved to Github Issues. The bug report message refers to
Bugzilla still. This patch tries to update these URLs.

Reviewed By: MaskRay, Quuxplusone, jhenderson, libunwind, libc++

Differential Revision: https://reviews.llvm.org/D116351
2022-01-06 17:33:25 +08:00
Nikita Popov e8b98a5216 [CodeGen] Emit elementtype attributes for indirect inline asm constraints
This implements the clang side of D116531. The elementtype
attribute is added for all indirect constraints (*) and tests are
updated accordingly.

Differential Revision: https://reviews.llvm.org/D116666
2022-01-06 09:29:22 +01:00
mydeveloperday 49d311874e [clang-format] Missing space after cast in a macro
https://github.com/llvm/llvm-project/issues/52979

Though SpaceAfterCStyleCast is set to true, clang-format 13 does not add a space after (void *) here:

```
```

This patch addresses that

Fixes: #52979

Reviewed By: curdeius, HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D116592
2022-01-06 08:07:03 +00:00
Egor Zhdan 809c6a5a1d [Clang] Extract availability mapping from VersionMap for watchOS/tvOS
This change makes it possible to extract iOS-to-another-platform version mappings from `VersionMap` in the `SDKSettings.json` file in Darwin SDKs, for example, `iOS_watchOS` and `iOS_tvOS`.

This code was originally authored by Alex Lorenz.

rdar://81491680

Differential Revision: https://reviews.llvm.org/D116615
2022-01-05 17:00:03 -08:00
Collin Baker 7e08a12088 [clang] Fall back on Android triple w/o API level for runtimes search
Clang searches for runtimes (e.g. libclang_rt*) first in a
subdirectory named for the target triple (corresponding to
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON), then if it's not found uses
.../lib/<os>/libclang_rt* with a suffix corresponding to the arch and
environment name.

Android triples optionally include an API level indicating the minimum
Android version to be run on
(e.g. aarch64-unknown-linux-android21). When compiler-rt is built with
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON this API level is part of the
output path.

Linking code built for a later API level against a runtime built for
an earlier one is safe. In projects with several API level targets
this is desireable to avoid re-building the same runtimes many
times. This is difficult with the current runtime search method: if
the API levels don't exactly match Clang gives up on the per-target
runtime directory path.

To enable this more simply, this change tries target triple without
the API level before falling back on the old layout.

Another option would be to try every API level in the triple,
e.g. check aarch-64-unknown-linux-android21, then ...20, then ...19,
etc.

Differential Revision: https://reviews.llvm.org/D115049
2022-01-05 16:00:48 -05:00
Nico Weber 085f078307 Revert "Revert D109159 "[amdgpu] Enable selection of `s_cselect_b64`.""
This reverts commit 859ebca744.
The change contained many unrelated changes and e.g. restored
unit test failes for the old lld port.
2022-01-05 13:10:25 -05:00
David Salinas 859ebca744 Revert D109159 "[amdgpu] Enable selection of `s_cselect_b64`."
This reverts commit 640beb38e7.

That commit caused performance degradtion in Quicksilver test QS:sGPU and a functional test failure in (rocPRIM rocprim.device_segmented_radix_sort).
Reverting until we have a better solution to s_cselect_b64 codegen cleanup

Change-Id: Ibf8e397df94001f248fba609f072088a46abae08

Reviewed By: kzhuravl

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

Change-Id: Id169459ce4dfffa857d5645a0af50b0063ce1105
2022-01-05 17:57:32 +00:00
David Pagan 7df2371bc6 Add codegen for allocate directive's 'align' clause 2022-01-05 12:40:58 -05:00
Markus Böck 782791ee84 [clang][#52782] Bail on incomplete parameter type in stdcall name mangling
stdcall name mangling requires a suffix with the number equal to the sum of the byte count of all parameter types. In the case of a function prototype that has a parameter type of an incomplete type it is impossible to get the size of the type. While such a function is not callable or able to be defined in the TU, it may still be mangled when generating debug info, which would previously lead to a crash.
This patch fixes that by simply bailing out of the loop and using the so far accumulated byte count. This matches GCCs behaviour as well: bc8d6c6013/gcc/config/i386/winnt.c (L203)

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

Differential Revision: https://reviews.llvm.org/D116020
2022-01-05 17:58:24 +01:00
Jino Park 319971ca95 [clang-format][NFC] Fix typo in comment
Fix typo (leftt -> left)

Reviewed By: curdeius

Differential Revision: https://reviews.llvm.org/D116658
2022-01-05 17:33:16 +01:00
Jan Svoboda 32c2ea5c33 [clang][lex] NFC: Simplify loop 2022-01-05 14:40:47 +01:00
Benjamin Kramer afc14a0d17 Retire llvm::make_reverse_iterator in favor of std::make_reverse_iterator
std::make_reverse_iterator is a C++14 feature, gcc has it since GCC 5.1.
2022-01-05 14:07:08 +01:00
Marek Kurdej 5109737c92 [clang-format] Fix indentation for array variables with alignment of consecutive assignments and declarations.
Fixes https://github.com/llvm/llvm-project/issues/52914.

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D116527
2022-01-05 13:52:45 +01:00
Marek Kurdej 46db030188 [clang-format] Simplify raw string regex. NFC.
Introduced in https://reviews.llvm.org/D115168.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D116647
2022-01-05 13:39:28 +01:00
Archibald Elliott ea83517138 Revert "[Clang][ScanDeps] Use the virtual path for module maps"
This reverts commits:
- 04192422c4.
- 015e08c6ba

D114206 was landed before it was approved - and was landed knowing that
the test crashed on windows, without an xfail. The promised follow-up
commit with fixes has not appeared since it was promised on December 14th.
2022-01-05 12:17:06 +00:00
Nikita Popov 3dc1907d06 [ConstantFold] Use ConstantFoldLoadFromUniformValue() in more places
In particular, this also preserves undef when loading from padding,
rather than converting it to zero through a different codepath.

This is the remaining part of D115924.
2022-01-05 12:47:50 +01:00
Björn Schäpers 8f6af1d468 [clang-format][NFC] Put all state change into the for statement
Differential Revision: https://reviews.llvm.org/D116563
2022-01-05 12:31:36 +01:00
Björn Schäpers 1da96f7449 [clang-format][NFC] Right.Previous is Left
Use that name. Also remove the one check for its existence, that is
given.

Differential Revision: https://reviews.llvm.org/D116562
2022-01-05 12:31:36 +01:00
Björn Schäpers 2ab5d29f55 [clang-format][NFC] Use Prev instead of Current->Previous
Differential Revision: https://reviews.llvm.org/D116561
2022-01-05 12:31:35 +01:00
Björn Schäpers 29d8535e2b [clang-format][NFC] TokenAnnotator: Use range based for
Differential Revision: https://reviews.llvm.org/D116560
2022-01-05 12:31:35 +01:00
Björn Schäpers 918c977dc1 [clang-format][NFC] Early return in TokenAnnotator::next
Differential Revision: https://reviews.llvm.org/D116559
2022-01-05 12:31:35 +01:00
Björn Schäpers a1db435390 [clang-format][NFC] Don't pass member by argument
And then use the argument and member.

Differential Revision: https://reviews.llvm.org/D116558
2022-01-05 12:31:34 +01:00
Björn Schäpers c2257fe236 [clang-format] Fix SeparateDefinitionBlocks docs and ...
the Style's equality operator.

This amends 6f6f88ffda

Differential Revision: https://reviews.llvm.org/D116557
2022-01-05 12:31:34 +01:00
Björn Schäpers 35493b4560 [clang-format][NFC] Replace deque with vector
I think the deque was chosen because of a better push_front, but in
combination with llvm::reverse the push_back'ed vector should be the
better choice.

Differential Revision: https://reviews.llvm.org/D115064
2022-01-05 12:31:34 +01:00
Archibald Elliott 015e08c6ba [clang][scandeps] Update Module Cache Path in Test
This fixes the test introduced in D114206 so it no longer writes to the current working directory.

Reviewed By: simon_tatham

Differential Revision: https://reviews.llvm.org/D116611
2022-01-05 10:42:38 +00:00
serge-sans-paille 491984c4e6 Document __builtin_trap and __builtin_debugtrap
Differential Revision: https://reviews.llvm.org/D116598
2022-01-05 03:10:17 -05:00