[clang][Sema] Fix crash when checking scalar type with excess braces (#192471)
`InitListChecker::CheckScalarType()` crashed with multiple nested braces
in scalar initializers (e.g., `int v = {{}, {}, {}};`) due to
out-of-bounds access when retrieving diagnostic location from
uninitialized StructuredList.
Add bounds checking before `getInit(0)` access and add regression test
Fix #137845. Fix #69213. Fix #198767. Fix #207566. Fix #106180.
[clang][bytecode] Make `SourceMap` a proper class (#215760)
Instead of a typedef. Save offsets and infos separately to speed up the
binary search a bit.
[CIR] Implement PromotableRegionOpInterface for cir.scope
Same treatment as cir.if: a slot read inside a cir.scope no longer needs
the CFG flattened before mem2reg can promote it. The scope region is
entered directly from before the operation, so it sees the reaching
definition unchanged.
cir.scope yields at most one value and may already be using it for the
scope's own result, so regions that store to the slot are refused.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
[CIR] Implement PromotableRegionOpInterface for cir.if
mem2reg gives up on a memory slot as soon as one of its uses lives in a
nested region whose parent op does not implement
PromotableRegionOpInterface. Since no CIR op implements it, promoting a
slot read inside a cir.if required running cir-flatten-cfg first, which
is why clang/test/CIR/Transforms/mem2reg.cir has to flatten before it can
promote anything.
Implement the interface for cir.if. Both regions are entered directly
from before the operation, so both see the same reaching definition.
A definition created inside a region has to leave the operation through
one of its results, and cir.if has none, so isRegionPromotable refuses
regions that store to the slot. Supporting those requires giving cir.if
results and is left for later.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
clang/SPIRV: Respect __launch_bounds__ for AMDHIP case
Follow the somewhat dodgy logic for packing amdgpu_flat_work_group_size
into the X field of max_work_group_size if the value is provided
to __launch_bounds__. The explicit amdgpu_flat_work_group_size takes
precedence, like in the AMDGPU case.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
clang/AMDGPU: Respect __launch_bounds__ attribute
Currently the HIP headers manually implement this with a
macro setting amdgpu attributes, and the proper clang attribute
is silently ignored. Directly map the proper attribute into
the target IR attributes. The first argument sets
"amdgpu-flat-work-group-size" and the second (reinterpreted by HIP
as minimum waves per EU) sets "amdgpu-waves-per-eu". An explicit
amdgpu_flat_work_group_size / amdgpu_waves_per_eu attribute takes
precedence. This matches the launch_bounds macro in the HIP headers,
which can now be dropped.
The 3rd maxclusterrank argument is only handled for NVPTX, so restrict
the sm_90 arch check to NVPTX targets and ignore the third argument on
other targets.
Fixes #91468
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[ci] Add apple emoji for Darwin build reports (#215287)
GitHub has two apples, :apple: which is red and :green_apple: which is
green. Red might be mistaken for a failure at a glance if the report has
no listed failures, so I chose green.
Also added a fallback path for unhandled systems.
[CodeGen][CGObjCGNU] Fix assertion failure for negative ivar offsets (#215753)
Ivars can have negative offsets, for example if an ivar from a derived
class is placed inside the super classes padding.
Currently, the offset is computed as an `uint64_t`, which results in an
integer wraparound for negative offsets.
The wrapped offset is then written to a global value to be parsed by
libobjc2. When libobjc2 reads the value as a truncated signed `int`, it
is again implicitly converted correct negative number. However, with
assertions enabled we hit an assertion failure in LLVM when creating the
global value. See https://godbolt.org/z/Yb7cvWTqP.
[lldb][AArch64][Linux] Add function to get size of register set
Another one to be used in a generic read/write function later.
Replaces all the Get<thing>Size() methods.