[libc] Add a placeholder for swprintf function (#200895)
Add a declaration and stub implementation for the `swprintf` function.
Only enable it when `LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS` is
specified to clarify that the implementation is not ready yet.
We're singling out `swprintf` among the other wide-character formatting
functions because it's used in libc++ to implement `std::to_wstring` for
floating point values
(https://github.com/llvm/llvm-project/blob/2a2e45257b8277ae6dbd3bce1627a9b07d1a301d/libcxx/src/string.cpp#L366),
and is the last remaining piece of functionality preventing us from
turning on wide character support in libc++ built against llvm-libc.
Adding the stub function would allow us to test the compilation with
`_LIBCPP_HAS_WIDE_CHARACTERS` enabled, and start keeping track of what
tests from libc++ test suite are working / not working yet.
[clang] fix getTemplateInstantiationArgs
This implements a new strategy for collecting the template arguments, by
relying on the qualifiers and template parameter lists to navigate the template
context of out-of-line definitions.
This greatly simplifies the signature of that function, by removing a bunch
of workarounds, and simpliffying a couple that weren't removed yet.
Since this now relies on qualifiers and template parameter lists,
this patch expends most of its effort making sure these are placed,
transformed and propagated to template instantiations.
Also makes the explicit specialization AST nodes stop abusing the template
parameter lists by storing it's own template parameter list, creating a
dedicated field for them, similar to partial specializations.
[clang] fix transformation of SubstNonTypeTemplateParmExpr nodes from type alias templates and concepts (#200850)
This makes sure SubstNonTypeTemplateParmExpr produced from
non-specialization decls (Type alias templates and concepts) are
correctly transformed.
This makes the SubstNonTypeTemplateParmExpr store the parameter type
directly, and uses that instead of relying on the AssociatedDecl.
Fixes #191738
Fixes #196375
[RISCV] Use sspush/sspopchk mnemonics for shadow stack codegen (#200182)
After PR #178609, SSPUSH/SSPOPCHK/C_SSPUSH became encodable under the
Zimop/Zcmop predicates alone (old Zicfiss requirement was relaxed to
Zimop).
Before that, the hw-shadow-stack codegen path introduced in PR #152251
needed PseudoMOP_* wrappers that expand to the base
MOP_RR_7/MOP_R_28/C_MOP_1, because the real SSPUSH/SSPOPCHK/C_SSPUSH
were gated by Zicfiss while the codegen path only required Zimop.
As a side effect, the assembler printed `mop.rr.7 zero, zero,
ra`/`mop.r.28 zero, ra` for hw-shadow-stack functions instead of the
proper `sspush ra`/`sspopchk ra` mnemonics from the CFI RISC-V spec
(while the disassembler already printed proper sspush/sspopchk.
With predicates now aligned, the pseudos are just plain wrappers with
identical predicates to the real instructions, so they became redundant.
This patch removes them and emits SSPUSH/SSPOPCHK/C_SSPUSH directly.
[Object][DirectX] Fix UB when parsing a DXContainer from a null buffer (#200865)
Adds an additional check that `Src != nullptr` before doing other
operations on it, which caused a UB in one test with #200413.
[lldb] Skip libc++ category tests on Darwin when no in-tree libc++ is built (#199262)
`canRunLibcxxTests()` previously short-circuited with "libc++ always
present" for all Darwin targets, meaning the "libc++" test category was
never skipped on macOS — even when `LLDB_HAS_LIBCXX` is `OFF` and no
`--libcxx-include-dir` / `--libcxx-library-dir` are passed to dotest.
The tests would silently run against the system libc++ instead of an
in-tree build, producing results inconsistent with what the suite is
designed to validate.
This fixes `canRunLibcxxTests()` to apply the same `libcxx_include_dir`
/ `libcxx_library_dir` guard on `Darwin` that `Linux` already uses. When
those dirs are absent (i.e. no in-tree libc++ was built), the function
returns `False` and `checkLibcxxSupport()` appends `libc++` to
`skip_categories` — skipping those tests exactly as Linux does.
On the CMake side, the `SEND_ERROR` for `LLDB_HAS_LIBCXX=OFF` is
downgraded to a `WARNING` so downstreams that intentionally skip the
runtimes build can keep `LLDB_INCLUDE_TESTS=ON` for the tests they
[5 lines not shown]
[lldb/test] Fix variant double-expansion in LLDBTestCaseFactory (#200943)
LLDBTestCaseFactory generates the actual test methods that get run: for
every `test*` method on a TestBase subclass, it stamps out one copy per
debug-info format (dwarf, dsym, ...) and, if a variant like
swift_clang's clang/noclang is registered, one copy per variant value on
top. When two test methods in the same class have names that share a
prefix and the longer one is declared first in the file, the shorter
method's expansion ends up re-stamping every copy already produced for
the longer one.
The variant-expansion helper decides what to copy by name-prefix match:
when processing `test_expr`, it grabs `test_expr`, `test_expr_dwarf`,
`test_expr_dsym`, ... and produces a clang/noclang suffix for each one.
The factory was handing it the full running dict of already-synthesized
methods, so by the time `test_expr`'s turn came, the dict also held
`test_expr_stripped_dwarf` and `test_expr_stripped_dsym` from
`test_expr_stripped`. Those names start with `test_expr_` too, so they
pick up a second clang/noclang suffix and inherit `test_expr`'s
[29 lines not shown]
[Polly] Remove unused DenseMapInfo::getTombstoneKey (#200963)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[clang] fix transformation of SubstNonTypeTemplateParmExpr nodes from typealiases and concepts
This makes sure SubstNonTypeTemplateParmExpr produced from non-specialization
decls (Type alias templates and concepts) are correctly transformed.
This makes the SubstNonTypeTemplateParmExpr store the parameter type directly,
and uses that instead of relying on the AssociatedDecl.
Fixes #191738
Fixes #196375
[RISCV] Improve shrinkDemandedConstant. (#196585)
Teach shrinkDemandedConstant to restore a constant that can be
materialized as:
lui a0, hi20
addi(w) a0, a0, lo12
slli a1, a0, 32
add a0, a0, a1
or:
lui a0, hi20
addi(w) a0, a0, lo12
pack a0, a0, a0
This fixes a regression between clang 18 and 19 on this test case
https://godbolt.org/z/Ma746a8xP
[OpenMP] Introduce the ompx_name clause for kernel naming
This adds support for the ompx_name clause that allows users to specify
custom kernel names for OpenMP target offloading regions. The clause
accepts a string literal and overrides the default compiler-generated
kernel names.
Example usage:
#pragma omp target ompx_name("my_kernel")
{ ... }
Kernel names need to be unique or they are diagnosed at compile or link
time as errors.
Co-Authored-By: Claude (claude-sonnet-4.5) <noreply at anthropic.com>
[NVPTX][clang] Remove nvvm scoped atomic intrinsics; use atomicrmw/cmpxchg (#200735)
The
`llvm.nvvm.atomic.{add,exch,max,min,inc,dec,and,or,xor,cas}.gen.{i,f}.{cta,sys}`
intrinsics are redundant; we can use atomicrmw / cmpxchg with a syncscope.
Moreover, the nvvm atomics are problematic because they don't have
unsigned min/max opcodes. Clang uses these intrinsics and currently emits
signed min/max for what should be unsigned operations!
Fix by doing the following.
- Remove the nvvm intrinsics.
- Auto-upgrade the removed intrinsics to atomicrmw/cmpxchg.
- Make clang Clang emits atomicrmw/cmpxchg directly.
[libc] Renaming Float128 (DyadicFloat<128>) to DFloat128 (#200907)
This is to be able to use the `Float128` for emulated float128 type.
[#200565 ](https://github.com/llvm/llvm-project/pull/200565)
[libc] Add FENV_ACCESS pragma with CMake compiler feature detection (#200268)
Related to https://github.com/llvm/llvm-project/pull/199009
Added compiler feature detection for _STDC FENV_ACCESS_ pragma. It is
used to conditionally add function-scoped `#pragma STDC FENV_ACCESS ON`
to `libc/src/__support/FPUtil/FEnvAccess.h`, whenever functions from the
`<fenv.h>` header are called and the target supports the pragma.
[X86] Remove extra MOV after widening atomic store (#197619)
This change adds patterns to optimize out an extra MOV present after
widening the atomic store. Covers `<2 x i8>` (SSE4.1+), `<2 x i16>`,
`<4 x i8>`, `<2 x i32>`, `<2 x float>`, `<4 x i16>`,
`<2 x ptr addrspace(270)>`.
Store-side counterpart to #148898. Stacked on top of #197618; and below
of #197860.
[mlir] Remove unused DenseMapInfo::getTombstoneKey (#200633)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[flang] Remove unused DenseMapInfo::getTombstoneKey (#200632)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[BOLT] Remove unused DenseMapInfo::getTombstoneKey (#200637)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[lldb] Remove unused DenseMapInfo::getTombstoneKey (#200635)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[lld] Remove unused DenseMapInfo::getTombstoneKey (#200636)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.