105320 Commits

Author SHA1 Message Date
Owen Pan
768118d1ad [clang-format] Fix a bug in formatting goto labels in macros (#92494)
Fixes #92300.

(cherry picked from commit d89f20058b45e3836527e816af7ed7372e1d554d)
2024-06-05 14:56:32 -07:00
Owen Pan
8c0fe0d65e
release/18.x: [clang-format] Don't always break before << between str… (#94091)
…ing literals (#92214)
2024-06-05 14:55:50 -07:00
John Ericson
48c1364200 [clang] Don't assume location of compiler-rt for OpenBSD (#92183)
If the `/usr/lib/...` path where compiler-rt is conventionally installed
on OpenBSD does not exist, fall back to the regular logic to find it.

This is a minimal change to allow OpenBSD cross compilation from a
toolchain that doesn't adopt all of OpenBSD's monorepo's conventions.

(cherry picked from commit be10746f3a4381456eb5082a968766201c17ab5d)
2024-05-17 16:26:37 -07:00
Craig Topper
be23965314 [RISCV] Add canonical ISA string as Module metadata in IR. (#80760)
In an LTO build, we don't set the ELF attributes to indicate what
extensions were compiled with. The target CPU/Attrs in
RISCVTargetMachine do not get set for an LTO build. Each function gets a
target-cpu/feature attribute, but this isn't usable to set ELF attributs
since we wouldn't know what function to use. We can't just once since it
might have been compiler with an attribute likes target_verson.

This patch adds the ISA as Module metadata so we can retrieve it in the
backend. Individual translation units can still be compiled with
different strings so we need to collect the unique set when Modules are
merged.

The backend will need to combine the unique ISA strings to produce a
single value for the ELF attributes. This will be done in a separate
patch.
2024-05-14 12:58:46 -07:00
Owen Pan
f1491c7460 [clang-format] Fix a crash with AlignArrayOfStructures option (#86420)
Fixes #86109.

(cherry picked from commit cceedc939a43c7c732a5888364251775bffc2dba)
2024-05-13 17:55:32 -07:00
Younan Zhang
8d65f14cb6 [Clang][Sema] Revise the transformation of CTAD parameters of nested class templates (#91628)
This fixes a regression introduced by bee78b88f.

When we form a deduction guide for a constructor, basically, we do the
following work:
- Collect template parameters from the constructor's surrounding class
template, if present.
- Collect template parameters from the constructor.
- Splice these template parameters together into a new template
parameter list.
- Turn all the references (e.g. the function parameter list) to the
invented parameter list by applying a `TreeTransform` to the function
type.

In the previous fix, we handled cases of nested class templates by
substituting the "outer" template parameters (i.e. those not declared at
the surrounding class template or the constructor) with the
instantiating template arguments. The approach per se makes sense, but
there was a flaw in the following case:

```cpp
template <typename U, typename... Us> struct X {
  template <typename V> struct Y {
    template <typename T> Y(T) {}
  };

  template <typename T> Y(T) -> Y<T>;
};

X<int>::Y y(42);
```

While we're transforming the parameters for `Y(T)`, we first attempt to
transform all references to `V` and `T`; then, we handle the references
to outer parameters `U` and `Us` using the template arguments from
`X<int>` by transforming the same `ParamDecl`. However, the first step
results in the reference `T` being `<template-param-0-1>` because the
invented `T` is the last of the parameter list of the deduction guide,
and what we're substituting with is a corresponding parameter pack
(which is `Us`, though empty). Hence we're messing up the substitution.

I think we can resolve it by reversing the substitution order, which
means handling outer template parameters first and then the inner
parameters.

There's no release note because this is a regression in 18, and I hope
we can catch up with the last release.

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

(cherry picked from commit 8c852ab57932a5cd954cb0d050c3d2ab486428df)
2024-05-13 17:53:00 -07:00
Vassil Vassilev
c5b3fa491f Reland "[clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (#89031)"
Original commit message: "

Clang's CodeGen is designed to work with a single llvm::Module. In many cases
for convenience various CodeGen parts have a reference to the llvm::Module
(TheModule or Module) which does not change when a new module is pushed.
However, the execution engine wants to take ownership of the module which does
not map well to CodeGen's design. To work this around we clone the module and
pass it down.

With some effort it is possible to teach CodeGen to ask the CodeGenModule for
its current module and that would have an overall positive impact on CodeGen
improving the encapsulation of various parts but that's not resilient to future
regression.

This patch takes a more conservative approach and keeps the first llvm::Module
empty intentionally and does not pass it to the Jit. That's also not bullet
proof because we have to guarantee that CodeGen does not write on the
blueprint. However, we have inserted some assertions to catch accidental
additions to that canary module.

This change will fixes a long-standing invalid memory access reported by
valgrind when we enable the TBAA optimization passes. It also unblock progress
on https://github.com/llvm/llvm-project/pull/84758.
"

This patch reverts adc4f6233df734fbe3793118ecc89d3584e0c90f and removes
the check of `named_metadata_empty` of the first llvm::Module because on darwin
clang inserts some harmless metadata which we can ignore.

(cherry picked from commit a3f07d36cbc9e3a0d004609d140474c1d8a25bb6)
2024-05-13 17:19:22 -07:00
Owen Pan
0abb89a80f [clang-format] Don't remove parentheses of fold expressions (#91045)
Fixes #90966.

(cherry picked from commit db0ed5533368414b1c4e1c884eef651c66359da2)
2024-05-09 12:16:32 -07:00
Tom Stellard
b7e2397c54 [CMake][Release] Enable CMAKE_POSITION_INDEPENDENT_CODE (#90139)
Set this in the cache file directly instead of via the test-release.sh
script so that the release builds can be reproduced with just the cache
file.

(cherry picked from commit 53ff002c6f7ec64a75ab0990b1314cc6b4bb67cf)
2024-05-08 19:47:50 -07:00
Tom Stellard
ce88e86e42 [CMake][Release] Refactor cache file and use two stages for non-PGO builds (#89812)
Completely refactor the cache file to simplify it and remove unnecessary
variables. The main functional change here is that the non-PGO builds
now use two stages, so `ninja -C build stage2-package` can be used with
both PGO and non-PGO builds.

(cherry picked from commit 6473fbf2d68c8486d168f29afc35d3e8a6fabe69)
2024-05-08 19:47:50 -07:00
Tom Stellard
f2c5a10e1f [CMake][Release] Add stage2-package target (#89517)
This target will be used to generate the release binary package for
uploading to GitHub.

(cherry picked from commit a38f201f1ec70c2b1f3cf46e7f291c53bb16753e)
2024-05-08 19:47:50 -07:00
Eli Friedman
617a15a9ea [clang codegen] Fix MS ABI detection of user-provided constructors. (#90151)
In the context of determining whether a class counts as an "aggregate",
a constructor template counts as a user-provided constructor.

Fixes #86384

(cherry picked from commit 3ab4ae9e58c09dfd8203547ba8916f3458a0a481)
2024-05-01 15:56:33 -07:00
Wentao Zhang
aea091b70e [clang][CoverageMapping] do not emit a gap region when either end doesn't have valid source locations (#89564)
Fixes #86998

(cherry picked from commit c1b6cca1214e7a9c14a30b81585dd8b81baeaa77)
2024-04-30 11:10:27 -07:00
Bill Wendling
f341c76b94 [Clang] Handle structs with inner structs and no fields (#89126)
A struct that declares an inner struct, but no fields, won't have a
field count. So getting the offset of the inner struct fails. This
happens in both C and C++:

  struct foo {
    struct bar {
      int Quantizermatrix[];
    };
  };

Here 'struct foo' has no fields.

Closes: https://github.com/llvm/llvm-project/issues/88931
2024-04-29 15:49:15 -07:00
Hugo Melder
ee5bb0c956 Fix Objective-C++ Sret of non-trivial data types on Windows ARM64 (#88671)
Linked to https://github.com/gnustep/libobjc2/pull/289.

More information can be found in issue: #88273.

My solution involves creating a new message-send function for this
calling convention when targeting MSVC. Additional information is
available in the libobjc2 pull request.

I am unsure whether we should check for a runtime version where
objc_msgSend_stret2_np is guaranteed to be present or leave it as is,
considering it remains a critical bug. What are your thoughts about this
@davidchisnall?

(cherry picked from commit 3dcd2cca7777b338d87deb1ca506df1376123667)
2024-04-29 15:45:36 -07:00
Owen Pan
6dbaa89433 [clang-format] Fix a regression in ContinuationIndenter (#88414)
Commit d06b92391513 caused a regression that breaks after a block
comment adjacent to a function paramter that follows.

Fixes #86573.

(cherry picked from commit d61edecbfd099143e0e2617505fec921524938f8)
2024-04-26 16:58:03 -07:00
Owen Pan
51ff7f38b6 [clang-format] Fix a regression in annotating TrailingReturnArrow (#86624)
Fixes #86559.

(cherry picked from commit a7f4576ff4e296ff42b16d9d91aadf82b5ea325c)
2024-04-26 16:56:54 -07:00
Owen Pan
35fea10327 release/18.x: [clang-format] Correctly annotate braces in macros (#87953)
Backport 58323de2e5ed
2024-04-25 08:31:16 -07:00
Owen Pan
c0b48372d8 release/18.x: [clang-format] Revert breaking stream operators to previous default (#89016)
Backport 29ecd6d50f14
2024-04-24 21:29:46 -07:00
NagyDonat
3b4ba7277b [analyzer] Fix performance of getTaintedSymbolsImpl() (#89606)
Previously the function
```
std::vector<SymbolRef> taint::getTaintedSymbolsImpl(ProgramStateRef State,
                                                    const MemRegion *Reg,
                                                    TaintTagType K,
                                                    bool returnFirstOnly)
```
(one of the 4 overloaded variants under this name) was handling element
regions in a highly inefficient manner: it performed the "also examine
the super-region" step twice. (Once in the branch for element regions,
and once in the more general branch for all `SubRegion`s -- note that
`ElementRegion` is a subclass of `SubRegion`.)

As pointer arithmetic produces `ElementRegion`s, it's not too difficult
to get a chain of N nested element regions where this inefficient
recursion would produce 2^N calls.

This commit is essentially NFC, apart from the performance improvements
and the removal of (probably irrelevant) duplicate entries from the
return value of `getTaintedSymbols()` calls.

Fixes #89045

(cherry picked from commit ce763bff081f8e97c7c3610ed0f15f14d60e875f)
2024-04-24 20:24:46 -07:00
Owen Pan
7699b341b7 release/18.x: [clang-format] Fix a regression in annotating BK_BracedInit (#87450)
Backport 7c9c38eaa9b7
2024-04-24 20:19:30 -07:00
Balazs Benics
4ddac856c5 [analyzer] Fix a security.cert.env.InvalidPtr crash
Fixes #88181

(cherry picked from commit e096c144921daba59963f15e89d2ca6fb32d3a78)
2024-04-23 08:52:08 -07:00
Tom Stellard
e6c3289804
[CMake][Release] Disable PGO (#88465) (#89000)
Running the test-release.sh script with PGO enabled causes build errors
like:

ld.lld: error: Function Import: link error: linking module flags
'ProfileSummary': IDs have conflicting values

I believe this a build system bug due to the PGO profile data being
generated unconditionally. If you run `ninja check-all` and then `ninja
install` like we do in test-release.sh, then the profile data is
regenerated during `ninja install` and some of the clang tools which are
not test dependencies get build during the ninja install step with
different profile data. When these tools link against the LLVM
libraries, like libSupport, we end up with these errors.

(cherry picked from commit 0d2bb7f017f13ceae793fab7d83d3e67e8d8d8f8)
2024-04-16 17:21:15 -07:00
Giuliano Belinassi
e3c832b37b Fix override keyword being print to the left side
Previously, the `override` keyword in C++ was being print in the left
side of a method decl, which is unsupported by C++ standard. This commit
fixes that by setting the `CanPrintOnLeft` field to 0, forcing it to be
print on the right side of the decl.

Signed-off-by: Giuliano Belinassi <gbelinassi@suse.de>
2024-04-16 16:09:49 -07:00
Owen Pan
3ceccbdb19 [clang-format] Correctly annotate braces of empty ctors/dtors (#82097)
Also reformat Polly.

Fixes #79834.

(cherry picked from commit 8de230093f585b64fcd642b46e6560131e95b394)
2024-04-10 15:00:37 -07:00
Ian Anderson
429d628725 [Headers] Don't declare unreachable() from stddef.h in C++ (#86748)
Even if __need_unreachable is set, stddef.h should not declare
unreachable() in C++ because it conflicts with the declaration in
\<utility>.

(cherry picked from commit df69a305253f1d1b4a4066055a07101a4cc03e55)
2024-04-10 14:59:00 -07:00
Mariya Podchishchaeva
c13b7485b8 [clang] Avoid -Wshadow warning when init-capture named same as class field (#74512)
Shadowing warning doesn't make much sense since field is not available
in lambda's body without capturing this.

Fixes https://github.com/llvm/llvm-project/issues/71976
2024-04-02 15:10:59 -07:00
Younan Zhang
76c721994a [clang][Sema] Fix a CTAD regression after 42239d2e9 (#86914)
The most recent declaration of a template as a friend can introduce a
different template parameter depth compared to what we anticipate from a
CTAD guide.

Fixes https://github.com/llvm/llvm-project/issues/86769
2024-04-01 14:47:15 -07:00
Antonio Frighetto
98a15dd2d7 [clang][CodeGen] Allow memcpy replace with trivial auto var init
When emitting the storage (or memory copy operations) for constant
initializers, the decision whether to split a constant structure or
array store into a sequence of field stores or to use `memcpy` is
based upon the optimization level and the size of the initializer.
In afe8b93ffdfef5d8879e1894b9d7dda40dee2b8d, we extended this by
allowing constants to be split when the array (or struct) type does
not match the type of data the address to the object (constant) is
expected to contain. This may happen when `emitStoresForConstant` is
called by `EmitAutoVarInit`, as the element type of the address gets
shrunk. When this occurs, let the initializer be split into a bunch
of stores only under `-ftrivial-auto-var-init=pattern`.

Fixes: https://github.com/llvm/llvm-project/issues/84178.
2024-03-27 15:53:00 -07:00
Chuanqi Xu
0bf7ff1028 [C++20] [Moduls] Avoid computing odr hash for functions from comparing constraint expression
Previously we disabled to compute ODR hash for declarations from the
global module fragment. However, we missed the case that the functions
lives in the concept requiments (see the attached the test files for
example). And the mismatch causes the potential crashment.

Due to we will set the function body as lazy after we deserialize it and
we will only take its body when needed. However, we don't allow to take
the body during deserializing. So it is actually potentially problematic
if we set the body as lazy first and computing the hash value of the
function, which requires to deserialize its body. So we will meet a
crash here.

This patch tries to solve the issue by not taking the body of the
function from GMF. Note that we can't skip comparing the constraint
expression from the GMF directly since it is an key part of the
function selecting and it may be the reason why we can't return 0
directly for `FunctionDecl::getODRHash()` from the GMF.
2024-03-19 14:03:55 -07:00
Alex Crichton
b1f1effacf [WebAssembly] Change the default linker for wasm32-wasip2 (#84569)
This commit changes the default linker in the WebAssembly toolchain for
the `wasm32-wasip2` target. This target is being added to the
WebAssembly/wasi-sdk and WebAssembly/wasi-libc projects to target the
Component Model by default, in contrast with the preexisting
`wasm32-wasi` target (in the process of being renamed to
`wasm32-wasip1`) which outputs a core WebAssembly module by default.

The `wasm-component-ld` project currently lives in my GitHub account at
https://github.com/alexcrichton/wasm-component-ld and isn't necessarily
"official" yet, but it's expected to continue to evolve as the
`wasm32-wasip2` target continues to shape up and evolve.

(cherry picked from commit d66121d74a458e098511b9de920d815440acaa1b)
2024-03-19 12:42:53 -07:00
Ian Anderson
a649e0a6e8 [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (#84127)
On Apple platforms, some of the stddef.h types are also declared in
system headers. In particular NULL has a conflicting declaration in
<sys/_types/_null.h>. When that's in a different module from
<__stddef_null.h>, redeclaration errors can occur.

Make the \_\_stddef_ headers be non-modular in
-fbuiltin-headers-in-system-modules and restore them back to not
respecting their header guards. Still define the header guards though.
__stddef_max_align_t.h was in _Builtin_stddef_max_align_t prior to the
addition of _Builtin_stddef, and it needs to stay in a module because
struct's can't be type merged. __stddef_wint_t.h didn't used to have a
module, but leave it in it current module since it doesn't really belong
to stddef.h.

(cherry picked from commit f50d3582b4844b86ad86372028e44b52c560ec7d)
2024-03-15 17:06:34 -07:00
Jonas Paulsson
33c6b20276
SystemZ release notes for 18.x. (#84560) 2024-03-13 16:27:21 -07:00
wanglei
9b9aee16d4 [Clang][LoongArch] Fix wrong return value type of __iocsrrd_h (#84100)
relate:
https://gcc.gnu.org/pipermail/gcc-patches/2024-February/645016.html
(cherry picked from commit 2f479b811274fede36535e34ecb545ac22e399c3)
2024-03-12 22:01:13 -07:00
wanglei
a9ba36c7e7 [Clang][LoongArch] Precommit test for fix wrong return value type of __iocsrrd_h. NFC
(cherry picked from commit aeda1a6e800e0dd6c91c0332b4db95094ad5b301)
2024-03-12 22:01:13 -07:00
Exile
1de8ea75d9 [analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (#83585)
Fixes #78810
Thanks for Snape3058 's comment

---------

Co-authored-by: miaozhiyuan <miaozhiyuan@feysh.com>
(cherry picked from commit d4687fe7d1639ea5d16190c89a54de1f2c6e2a9a)
2024-03-12 21:53:55 -07:00
Sirraide
d8352e93c1 [Clang] [Sema] Handle placeholders in '.*' expressions (#83103)
When analysing whether we should handle a binary expression as an
overloaded operator call or a builtin operator, we were calling
`checkPlaceholderForOverload()`, which takes care of any placeholders
that are not overload sets—which would usually make sense since those
need to be handled as part of overload resolution.

Unfortunately, we were also doing that for `.*`, which is not
overloadable, and then proceeding to create a builtin operator anyway,
which would crash if the RHS happened to be an unresolved overload set
(due hitting an assertion in `CreateBuiltinBinOp()`—specifically, in one
of its callees—in the `.*` case that makes sure its arguments aren’t
placeholders).

This pr instead makes it so we check for *all* placeholders early if the
operator is `.*`.

It’s worth noting that,
1. In the `.*` case, we now additionally also check for *any*
placeholders (not just non-overload-sets) in the LHS; this shouldn’t
make a difference, however—at least I couldn’t think of a way to trigger
the assertion with an overload set as the LHS of `.*`; it is worth
noting that the assertion in question would also complain if the LHS
happened to be of placeholder type, though.
2. There is another case in which we also don’t perform overload
resolution—namely `=` if the LHS is not of class or enumeration type
after handling non-overload-set placeholders—as in the `.*` case, but
similarly to 1., I first couldn’t think of a way of getting this case to
crash, and secondly, `CreateBuiltinBinOp()` doesn’t seem to care about
placeholders in the LHS or RHS in the `=` case (from what I can tell,
it, or rather one of its callees, only checks that the LHS is not a
pseudo-object type, but those will have already been handled by the call
to `checkPlaceholderForOverload()` by the time we get to this function),
so I don’t think this case suffers from the same problem.

This fixes #53815.

---------

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-03-12 17:38:40 -07:00
Paul Kirth
16ab0812d2 [clang][fat-lto-objects] Make module flags match non-FatLTO pipelines (#83159)
In addition to being rather hard to follow, there isn't a good reason
why FatLTO shouldn't just share the same code for setting module flags
for (Thin)LTO. This patch simplifies the logic and makes sure we use set
these flags in a consistent way, independent of FatLTO.

Additionally, we now test that output in the .llvm.lto section actually
matches the output from Full and Thin LTO compilation.

(cherry picked from commit 7d8b50aaab8e0f935e3cb1f3f397e98b9e3ee241)
2024-03-11 12:47:52 -07:00
YunQiang Su
461274b81d MIPS: Fix asm constraints "f" and "r" for softfloat (#79116)
This include 2 fixes:
        1. Disallow 'f' for softfloat.
        2. Allow 'r' for softfloat.

Currently, 'f' is accpeted by clang, then LLVM meets an internal error.

'r' is rejected by LLVM by: couldn't allocate input reg for constraint
'r'.

Fixes: #64241, #63632

---------

Co-authored-by: Fangrui Song <i@maskray.me>
(cherry picked from commit c88beb4112d5bbf07d76a615ab7f13ba2ba023e6)
2024-02-27 09:18:54 -08:00
Philipp Tomsich
83283342c3 [AArch64] Add the Ampere1B core (#81297)
The Ampere1B is Ampere's third-generation core implementing a
superscalar, out-of-order microarchitecture with nested virtualization,
speculative side-channel mitigation and architectural support for
defense against ROP/JOP style software attacks.

Ampere1B is an ARMv8.7+ implementation, adding support for the FEAT
WFxT, FEAT CSSC, FEAT PAN3 and FEAT AFP extensions. It also includes all
features of the second-generation Ampere1A, such as the Memory Tagging
Extension and SM3/SM4 cryptography instructions.

(cherry picked from commit fbba818a78f591d89f25768ba31783714d526532)
2024-02-26 17:38:41 -08:00
Anatoly Trosinenko
b4b76bdbf1 [AArch64] Make +pauth enabled in Armv8.3-a by default (#78027)
Add AEK_PAUTH to ARMV8_3A in TargetParser and let it propagate to
ARMV8R, as it aligns with GCC defaults.

After adding AEK_PAUTH, several tests from TargetParserTest.cpp crashed
when trying to format an error message, thus update a format string in
AssertSameExtensionFlags to account for bitmask being pre-formatted as
std::string.

The CHECK-PAUTH* lines in aarch64-target-features.c are updated to
account for the fact that FEAT_PAUTH support and pac-ret can be enabled
independently and all four combinations are possible.

(cherry picked from commit a52eea66795018550e95c4b060165a7250899298)
2024-02-26 17:38:41 -08:00
cor3ntin
a7a74ece1d [Clang] Fixes to immediate-escalating functions (#82281)
* Consider that immediate escalating function can appear at global
scope, fixing a crash

* Lambda conversion to function pointer was sometimes not performed in
an immediate function context when it should be.

Fixes #82258

(cherry picked from commit baf6bd303bd58a521809d456dd9b179636982fc5)
2024-02-26 17:03:46 -08:00
Wentao Zhang
9274829eb6 [clang][CodeGen] Keep processing the rest of AST after encountering unsupported MC/DC expressions (#82464)
Currently, upon seeing unsupported decisions (more than 6 conditions, or
split nesting), the post-visitor hook dataTraverseStmtPost() returns a
false. As a result, in the rest of tree even supported decisions will
be skipped as well. Like in the below code:

{ // CompoundStmt
  a && b;           // 1: BinaryOperator (supported)
  a && foo(b && c); // 2: BinaryOperator (not yet supported due to split
                    //                    nesting)
  a && b;           // 3: BinaryOperator (supported)
}

Decision 3 will not be processed at all. And only one "Decision" region
will be emitted. Compiler explorer example:
https://godbolt.org/z/Px61sesoo

We hope to process such cases and emit two "Decision" regions (1 and 3)
in the above example.

(cherry picked from commit d4bfca3b2e673789f7c278d46a199ae8910ddd37)
2024-02-26 15:09:20 -08:00
h-vetinari
cd2ca7f3f9
fix links on clang 18.1.0rc release page (#82739)
Looking at the [release
notes](https://prereleases.llvm.org/18.1.0/rc3/tools/clang/docs/ReleaseNotes.html)
for clang 18.1.0rc, there's some broken links, and many issue numbers
mis-formatted with an extra colon. Aside from being used inconsistently
(with/without colon), I think it should be uncontroversial that `See
(#62707).` is better than `See (#62707:).`

CC @tstellar @AaronBallman

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-02-26 15:06:56 +01:00
Fangrui Song
1ea6a98142
ReleaseNotes: mention -mtls-dialect=desc (#82731) 2024-02-23 12:43:55 -08:00
Chuanqi Xu
66351a501e [Serialization] Record whether the ODR is skipped (#82302)
Close https://github.com/llvm/llvm-project/issues/80570.

In

a0b6747804,
we skipped ODR checks for decls in GMF. Then it should be natural to
skip storing the ODR values in BMI.

Generally it should be fine as long as the writer and the reader keep
consistent.

However, the use of preamble in clangd shows the tricky part.

For,

```
// test.cpp
module;

// any one off these is enough to crash clangd
// #include <iostream>
// #include <string_view>
// #include <cmath>
// #include <system_error>
// #include <new>
// #include <bit>
// probably many more

// only ok with libc++, not the system provided libstdc++ 13.2.1

// these are ok

export module test;
```

clangd will store the headers as preamble to speedup the parsing and the
preamble reuses the serialization techniques. (Generally we'd call the
preamble as PCH. However it is not true strictly. I've tested the PCH
wouldn't be problematic.) However, the tricky part is that the preamble
is not modules. It literally serialiaze and deserialize things. So
before clangd parsing the above test module, clangd will serialize the
headers into the preamble. Note that there is no concept like GMF now.
So the ODR bits are stored. However, when clangd parse the file
actually, the decls from preamble are thought as in GMF literally, then
hte ODR bits are skipped. Then mismatch happens.

To solve the problem, this patch adds another bit for decls to record
whether or not the ODR bits are skipped.

(cherry picked from commit 49775b1dc0cdb3a9d18811f67f268e3b3a381669)
2024-02-20 16:41:33 -08:00
Zixu Wang
ddc2a5ff4e
[18.x][Docs] Add release note about Clang-defined target OS macros (#80044)
The change is included in the 18.x release. Move the release note to the
release branch and reformat.

(cherry picked from commit b40d5b1b08564d23d5e0769892ebbc32447b2987)
2024-02-16 05:36:18 -08:00
Balazs Benics
c90f200b1e
[analyzer][docs] Admit that the cleanup attribute is not supported (#81834)
In fact, the cleanup attribute is only added to the CFG, but still
unhandled by CSA.
I propose dropping this false "support" statement from the docs.
2024-02-15 22:16:19 -08:00
Maryam Moghadas
e3c6d5abb1
[PowerPC] Update V18.1.0 release notes (#81631)
Adding PowerPC updates for clang and llvm into the V18.1.0 release
notes.

---------

Co-authored-by: Maryam Moghadas <maryammo@ca.ibm.com>
2024-02-15 22:01:26 -08:00
Matthew Devereau
8b7b3fbe29 [AArch64][SME] Implement inline-asm clobbers for za/zt0 (#79276)
This enables specifing "za" or "zt0" to the clobber list for inline asm.
This complies with the acle SME addition to the asm extension here:
https://github.com/ARM-software/acle/pull/276

(cherry picked from commit d9c20e437fe110fb79b5ca73a52762e5b930b361)
2024-02-15 21:58:29 -08:00