[lldb] Remember server's primary stop thread on gdb-remote stops (#207020)
This is a reland of https://github.com/llvm/llvm-project/pull/203525,
which was reverted because it introduced a test failure on macOS. The
primary thread was unconditionally selected, which was causing
`TestRealDefinition.py` to fail. The fix is to only call
SetSelectedThreadByID when the server's primary tid differs from the
currently-selected thread.
---
The client kept the previously-selected thread across stops, ignoring
the primary tid from the server in `T<sig>thread:<tid>`.
On Windows, lldb-server halts the inferior by injecting a thread called
`DbgUiRemoteBreakin` whose only job is to execute an int 3. After an
interrupt, the process has `N+1` threads and the new one is what caused
the stop. The server reports that thread as primary, but the client
ignored it and stayed on whichever thread was selected before. In
`TestExpressionInSyscall` that thread is main, paused just past
[9 lines not shown]
Implemented MVT::changeElementType based on EVT::changeElementType (#206783)
Implemented MVT::changeElementType based on EVT::changeElementType
Fixes #206726
[libfuzzer] Improve error message for file not found (#207081)
We're seeing many instances of this issue on ClusterFuzz. This PR adds
more information to help debug the cause of the problem.
See https://crbug.com/529865766 for more context.
[clang] fix error recovery for invalid member specializations (#207068)
Recover from invalid member specializations as if it wasn't declared.
This undoes the change introduced in #201506 for a more robust approach
which keeps the AST valid.
There are no release notes since this fixes a regression which was never
released.
Fixes #201490
Fixes #205971
[LV] Return widening kind from memoryInstructionCanBeWidened (NFC). (#207056)
Make memoryInstructionCanBeWidened return the InstWidening decision
(CM_Widen or CM_Widen_Reverse) as a std::optional instead of a bool.
This avoids computing and checking for consecutive strides multiple
times.
[libc++] Remove projection from __lower_bound_onesided (#206676)
The projection argument isn't made use of very much, since it's only
ever called with an identity. We can remove it to simplify the code a
bit.
[flang][OpenMP][docs] add missing features to support page (NFC) (#207078)
Adds more rows for 5.x features not captured in new OpenMP Support page
for Flang.
[RISCV] Report all near-miss reasons in the AsmParser (#205721)
Set ReportMultipleNearMisses and switch RISCVAsmParser to the shared
near-miss reporting used by ARM, so a failed match lists every reason
instead of just the first one.
Assisted-by: claude-opus
[MCP] Add test case to demonstrate issue with spill copy elimination (NFC) (#207065)
This is a reapply of #206855 with added expensive_checks restriction. It
turned out that the problem may get caught with expensive checks. The
restriction is to be removed with the follow up patch.
[flang][OpenMP] Semantic checks for metadirective loop nests
A loop-associated metadirective variant (`do`, `simd`, ...) is only
resolved during lowering, so it is never checked as a loop construct
during semantic analysis. A malformed or non-canonical associated nest
therefore reaches lowering, which assumes a canonical nest.
This patch validates the nest that follows such a variant (the next
executable construct) during semantics, reusing the diagnostics of a real
loop-associated construct. Each applicable variant is checked against it:
* Canonical loop: the affected loop must be a canonical DO loop, so a
`DO WHILE`, a pre-6.0 `DO CONCURRENT`, or a `DO` without loop control
is rejected.
* Nest depth: `collapse(n)` and `ordered(n)` must not exceed the depth
of the associated loop nest.
* Rectangularity: loops that must be rectangular (e.g. under `tile`) may
not have bounds that depend on an outer loop's variable.
[13 lines not shown]
[IndVars] Refine tests for evaluating final value pointer AddRecs (NFC). (#207076)
Update tests for evaluating final value of pointer AddRecs. Add missing
cases and add some brief clarifying comments to some test cases.
[Registry] Support static clang registries (#206750)
The plugin Registry macros hard-code `LLVM_ABI_EXPORT` (unconditional
dllexport) on `getRegistryLinkListInstance`. When clang is built
statically (`CLANG_LINK_CLANG_DYLIB=OFF`) and embedded into
`libclang.dll`, that forces the accessor into the DLL's export table,
where it collides with the same symbol from the static clang libraries
on any tool linking both.
Summary of changes:
* Add `LLVM_{DECLARE,DEFINE,INSTANTIATE}_REGISTRY_EX` variants taking
the export annotation as a parameter.
* Add `CLANG_ABI_EXPORT` macro as an equivalent to `LLVM_ALWAYS_EXPORT`
for libclang.
* Route clang's registries through the `*_EX` macros with
`CLANG_ABI_EXPORT`.
As a result, the static clang build no longer exports the accessor and
the clang dylib build is unaffected.
[2 lines not shown]
[flang][OpenMP][NFC] Move variant-matching context to semantics
Move FlangOMPContext from lowering into semantics as the MLIR-independent
OmpVariantMatchContext. This lets an upcoming semantic check reuse the
matcher to skip the loop-nest checks for a metadirective variant that cannot
be selected on the current target, such as a `device={kind(nohost)}` variant
in a host compilation. No functional change to metadirective lowering.
Assisted with copilot.
[Clang] Rebuild lambda captures in default member initializers while skipping body (#196597)
Fixes https://github.com/llvm/llvm-project/issues/196469
Since the CWG1815 implementation, `InitListChecker` rebuilds a default
member initializer at its point of use in aggregate initialization. The
rebuild uses the `EnsureImmediateInvocationInDefaultArgs` tree
transform, where `TransformCXXBindTemporaryExpr` strips
`CXXBindTemporaryExpr` nodes, relying on the subexpression's rebuild to
re-create the temporary binding: every `Rebuild*` path funnels through
`Sema::MaybeBindToTemporary`, which also re-registers the cleanup in the
current evaluation context.
However, the transform overrides `TransformLambdaExpr` to return the
closure unchanged (the body is not a subexpression), skipping the
`MaybeBindToTemporary` call that `BuildLambdaExpr` ends with. The
rebuilt initializer then lacks both the `CXXBindTemporaryExpr` around
the closure and the `ExprWithCleanups` marker, so CodeGen never emits
the closure's destructor and init-captured members leak.
[12 lines not shown]
[LAA] Fall back to starting AddRec if replacing strides fails. (#207054)
replaceSymbolicStrideSCEV may not return an AddRec after applying
predicates (871990a01ea72 /
https://github.com/llvm/llvm-project/pull/203787)
Fall back to AddRec without strides replaced, to avoid crashing.
[clang] fix error recovery for invalid member specializations
Recover from invalid member specializations as if it wasn't declared.
This undoes the change introduced in #201506 for a more robust approach which
keeps the AST valid.
There are no release notes since this fixes a regression which was never
released.
Fixes #201490
Fixes #205971
[clang][deps] Only disable app extension without PCHs (#207049)
PR #200041 disabled application extension during scanning to increase
module cache reuse. To keep the build semantics intact, the setting was
preserved for the compile steps. When scanning with an explicitly-built
PCH, this triggers a mismatch error in `ASTReader`:
```
error: Objective-C App Extension was enabled in precompiled file 'X.pch' but is currently disabled
```
This PR fixes this by only performing the optimization for non-PCH
compiles, adds a test, and a FIXME outlining how this optimization could
be applied even for compiles with PCHs.
rdar://180978125
[clang] fix error recovery for invalid member specializations
Recover from invalid member specializations as if it wasn't declared.
This undoes the change introduced in #201506 for a more robust approach which
keeps the AST valid.
There are no release notes since this fixes a regression which was never
released.
Fixes #201490
Fixes #205971
[clang][ssaf] Add `MultiArchStaticLibrary` data structure (#206148)
This change introduces `MultiArchStaticLibrary` that wraps
per-architecture `StaticLibrary` instances. It is the SSAF analogue of a
fat static library (the result of lipo -create over per-arch .a files).
Like `StaticLibrary` we don't need the fully decoded variant of this
data structure as it will be produced and read by the linker that does
not require the concrete summary data schema. Support for constructing
and consuming this data structure will be added in separate PRs.
rdar://181066557
[Clang] Rebuild lambda capture initializers in default member initializers
Fixes https://github.com/llvm/llvm-project/issues/196469
Since the CWG1815 implementation, InitListChecker rebuilds a default member initializer at its point of use in aggregate initialization. The rebuild uses the EnsureImmediateInvocationInDefaultArgs tree transform, where TransformCXXBindTemporaryExpr strips CXXBindTemporaryExpr nodes, relying on the subexpression's rebuild to recreate the temporary binding and re-register cleanups in the current evaluation context.
However, the transform overrides TransformLambdaExpr because the lambda body is not a subexpression. Returning the original lambda unchanged skips the MaybeBindToTemporary call that BuildLambdaExpr would normally perform, so the rebuilt initializer can lack the closure temporary binding and cleanup marker. CodeGen then misses the closure destructor and init-captured members can leak.
Lambda init-capture initializers are evaluated in the enclosing context and can also contain immediate invocations or source-location expressions that need to be rebuilt at the default-initializer use site. Rebuild those initializer expressions without rebuilding the closure type, capture declarations, or body, so body references to init-capture declarations remain valid. When a capture initializer changes, create a replacement LambdaExpr that shares the existing closure and body, then bind the lambda temporary explicitly to restore cleanup emission.
Co-Authored-By: GPT-5.5 <noreply at openai.com>
[libc++] Add a size-based representation for `vector` in the unstable ABI (#155330)
This commit adds an alternative representation for `std::vector` in a similar
manner to `__split_buffer` in #139632. This alternative representation was
measured to provide significant performance gains over the classic representation.
To do so, we introduce a layout type that tracks implementation details that
differ between the pointer-based vector and size-based vector representations.
`vector` does not parameterise its layout type, unlike `__split_buffer`.
`__split_buffer` is used by both `vector` and `deque`, and being able to take
an ABI break on `vector` doesn't automatically mean that users can also tolerate
a break on `deque`.
This new vector representation can be opted into by defining the
_LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED macro when configuring the
library's ABI.
This change was the target of this RFC: https://discourse.llvm.org/t/adding-a-size-based-vector-to-libc-s-unstable-abi
[flang][OpenMP] Compute the set of loop directives in parser, NFC (#206748)
Use the constexpr functions for association and source language to
compute the set of loop-associated directives instead of listing them
individually.
[Flang][MIF] Adding support of intrinsics with coarray argument (#192944)
Added support for intrinsics that query the coarray in argument:
- Adding lowering and operation in MIF Dialect for UCOBOUND, LCOBOUND,
COSHAPE and IMAGE_INDEX
- Adding support of coarray argument for THIS_IMAGE in MIF Dialect (and
the lowering)
---------
Co-authored-by: Dan Bonachea <dobonachea at lbl.gov>
Co-authored-by: jeanPerier <jean.perier.polytechnique at gmail.com>