[clang][driver][darwin] DarwinSDKInfo doesn't match sufficiently modified triples, doesn't warn for unsupported architectures (#204061)
DarwinSDKInfo::getPlatformPrefix(...) is passed the effective target
triple which has undergone modifications from the original -target
value, which can sometimes even include changes to the triple's
environment. That will cause it to fail to match the platform infos, not
get a platform prefix, and get incorrect default search paths. In the
case where a triple doesn't match, check all platform infos, and if they
all have the same platform prefix, then use that.
DarwinSDKInfo::supportsTriple(...) doesn't try to match the architecture
of the triple. That makes it not emit -Wincompatible-sysroot e.g. when
trying to use arm64 against a sufficiently old macOS SDK or when still
trying to build i386 for macOS. Instead of parsing values from
SDKSettings.json into a Triple, storing the probably-relevant
components, and then comparing those against a full Triple, just store
the parsed triple and get rid of the custom comparison code. While this
does make the matching problem above a little more fragile, in practice
that's well mitigated by treating thumb* and arm* as equivalent, and it
[6 lines not shown]
AMDGPU: Avoid default subtarget in generated codegen tests (2/9) (#205785)
Continue migrating away from testing the dummy target, and use
real targets approximating the old behavior. Performed by script.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
AMDGPU: Avoid using default subtarget in generated codegen tests (1/9) (#205784)
Fix codegen tests using amdgcn triples without a target-cpu. The dummy
default subtarget has always been an irritating edge case to deal with.
For unknown/mesa3d/amdpal triples, this has been a gfx600-like result
and gfx700-like result for amdhsa. Convert tests to use the explicit
target. This was performed by vibe-coded script, and covers tests
using update_{llc|mir}_test_checks. There are some minor codegen
differences to be expected, mostly due to now having a scheduling
model.
In the future we should forbid trying to codegen the default target.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
zbookmark_compare: handle "marker" bookmarks with negative levels
"Marker" bookmarks (those with zb_level == ZB_ROOT_LEVEL, ZB_ZIL_LEVEL
or ZB_DNODE_LEVEL) represent valid blocks, but are associated with a
dataset directly rather than with a specific object within it. They end
up on bookmark lists during scan prefetch, and so need to be sorted
ahead of any "true" object blocks.
The problem is that for negative levels, BP_SPANB produces a negative
shift, which is not legal C. Fortunately the results are used only for
comparison, so the worst possible behaviour in a forgiving compilation
environment is a mis-sort, which for the scan/traverse cases, means that
we haven't prefetched certain metadata before we actually need it. But
there _is_ UB in there, and UBSAN does rightly complain.
Here we fix all this by handling these bookmarks directly - sorting them
ahead of "true" object blocks, which is usually what scan/traverse will
prefer. And we don't do any interesting math on these bookmarks, so we
sidestep the whole UB thing.
[6 lines not shown]
[MLIR] Fix broken 'Successor<CPred<...>>' functionality in mlir-tblgen (#205375)
Previously, mlir-tblgen would generate incorrect C++ code when
passing a custom constraint to `Successor<...>`. The code would fail
to compile. We lacked end-to-end tests for this functionality and all
in-tree dialects only use `AnySuccessor` for their successors.
Custom C++ predicates for an Operation's successor(s) can be useful
in order to generate verification for certain conditions (e.g. that the
successor is the "next" block). This commit fixes the mlir-tblgen
functionality and adds end-to-end tests in the Test dialect for single
and variadic successors.
Assisted-by: Claude
[NFC][CIR] Fix test that used 'DAG-SAME' (#205867)
'DAG-SAME' isn't a thing in file-check, so these lines weren't being
checked. This patch just puts them all on teh same line as they should
be.
graphics/R-cran-venn: New port
A close to zero dependency package to draw and display Venn diagrams up
to 7 sets, and any Boolean union of set intersections.
[lldb][gdb-remote] Send QSetSTDIOWindowSize for a 0x0 size (#205772)
The client uses a 0x0 STDIO window size as a deliberate signal to the
server that there is no client terminal, so the server should redirect
the inferior's stdio over anonymous pipes instead of a ConPTY (on
Windows).
This is a follow up to https://github.com/llvm/llvm-project/pull/203562.
rdar://178725958
[MemProf] Make ICP test check compared target more strictly (#201656)
We intend to check that we are comparing to the original uncloned
target, but weren't checking for EOL. Add the EOL check.
vmd(8): prevent virtio scsi DoS from bad descriptor length.
A guest can construct a looping, zero-length descriptor chain that
spins forever when processing a READ_10 command. Check for zero
length scenario and abort the read with a warning.
Reported by Frank Denis.
Discussed with and "go for it" from mlarkin@
[Clang-tools-extra] Add missing values to CharacteristicKindStrings (#205455)
Static analysis flagged that we were indexing CharacteristicKindStrings
in PPCallbacksTracker::FileChanged based on the values of
SrcMgr::CharacteristicKind which would access outside array bounds for
some values of the enum. As far I can see all value of the enum are
possible when calling FileChanged and so the array should indeed cover
all values. So I added the missing values to the array.
[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>
[CIR] Fix lost catch clauses on EH landing pads (#205638)
A throw caught by an enclosing handler could call std::terminate instead of
entering the handler. The smallest trigger is a try that destroys a local and
throws a new-expression whose type has a throwing constructor: two cleanups
then sit on the path to the handler and produce two cir.eh.initiate operations
that funnel into one cir.eh.dispatch. The same bug also asserted on ordinary
nested try/catch and dropped the outer handler's catch clause from the inner
landing pad on a nested throw.
ItaniumEHLowering::lowerEhInitiate derived each landing pad's catch clauses
while destructively walking the eh_token graph, tying a correctness property
to lowering order: whichever initiate lowered first tore down the shared cir.br
edges, so the other reached no dispatch and kept an empty catch_type_list -- a
cleanup-only landing pad that resumes past the handler.
lowerFunc now does a read-only walk first. For each initiate it collects every
dispatch the exception can reach (innermost first, preserving nested catch
order) and records the catch_type_list, plus the cleanup clause when a cleanup
[4 lines not shown]
[CIR] Lower __atomic_is_lock_free / __c11_atomic_is_lock_free (#205862)
`__atomic_is_lock_free` and `__c11_atomic_is_lock_free` were routed to
`errorNYI` in CIRGen, so `std::atomic<T>::is_lock_free()` failed to
compile under `-fclangir` whenever the query wasn't constant-folded --
which is what the libcxx atomics lock-free tests hit.
This mirrors classic CodeGen (`CGBuiltin.cpp`): emit a call to the
runtime entry `bool __atomic_is_lock_free(size_t size, void *ptr)`.
`__atomic_is_lock_free` forwards its pointer argument;
`__c11_atomic_is_lock_free` passes a null pointer, since an `_Atomic`
object is always suitably aligned. `__atomic_test_and_set` /
`__atomic_clear` stay NYI.
The lowered call omits the `noundef`/`zeroext` argument and return
attributes classic emits, and the declaration picks up `dso_local`.
That's the existing CIR libcall attribute gap, so the test uses split
`LLVMCIR`/`OGCG` prefixes where the two diverge and a shared skeleton
where they match.