[clang] fix crash with c-style casts involving dependent member-pointer types
A dependent member-pointer type doesn't necessarily have a class declaration.
This simplifies the check performed in a helper for diagnosing a cast which removes qualifiers,
so it doesn't rely on this assumption.
Fixes #194524
[HIP][MacOS] Mach-O support and Darwin toolchain fixes (#183991)
This PR adds support for HIP on macOS: Mach-O section naming, Darwin
host toolchain initialization guards, and HIPSPV behavior when Darwin is
the host.
This has been verified using chipStar on MacOS via the PoCL OpenCL
implementation.
## Uninitialized target workaround
Darwin’s toolchain is only initialized when its own TranslateArgs runs.
For HIP/CUDA device jobs, Darwin is used as the HostTC and never gets
its args translated, so its target stays uninitialized. The new checks
avoid asserting on that uninitialized state. A better long-term fix is
to initialize Darwin earlier (see the FIXME in Driver.cpp
BuildJobsForAction).
- [ ] Initialize Darwin toolchain during construction instead of lazily
in TranslateArgs. See Driver.cpp BuildJobsForAction FIXME.
[2 lines not shown]
[BOLT][AArch64] Refuse to run IndirectCallPromotion pass (#194363)
`--icp=<value>`/`--indirect-call-promotion=<value>` results in an
`UNIMPLEMENTED` crash when invoked as it is unimplemented in AArch64.
- Guard IndirectCallPromotion for non-X86
- Update unsupported-passes.test with expected error
[clang] [fixit] Properly apply warning options during fixit-recompile (#190280)
Fixes https://github.com/llvm/llvm-project/issues/18707
During fixit recompile, the frontend was not reapplying command-line
diagnostic options, so the second pass could lose -Wno-* suppressions
and other warning configuration.
Added regression test to make sure that diagnostic options are properly
applied in the fixit-recompile path.
[LLVM] Fix use-after-free in AlwaysInliner flatten worklist (#194485)
Functions with both `alwaysinline` and `flatten` attributes were
collected into the `NeedFlattening` worklist, then erased during
always-inline processing, leaving dangling pointers. Fix by collecting
flatten functions after the always-inline loop, and eliminate the
separate worklist by iterating the module directly.
[Support] Mark string-returning sys::path::native nodiscard (#194675)
To make it clear that it doesn't modify the path in place like the other
overloads. Follow-up to #193228
[flang][NFC] Converted five tests from old lowering to new lowering (part 52) (#194525)
Converted Lower/user-defined-operators.f90,
Lower/variable-inquiries.f90, Lower/where-allocatable-assignments.f90,
Lower/where.f90, and Transforms/constant-argument-globalisation.fir from
legacy lowering (-hlfir=false / -flang-deprecated-no-hlfir) to new
lowering (-emit-hlfir or no flag for FIR-input tests).
[LLVM] Disable IO sandbox in symbolizeAddresses (#194597)
The function `symbolizeAddresses` is used by debugify to symbolize
addresses captured in the current invocation of LLVM, which it does by
executing llvm-symbolizer with temporary input and output files.
Creating the temporary files has an explicit sandbox exclusion, as
temporary files are necessarily not part of the compiler's formal
output, but attempting to read back the output file via MemoryBuffer
triggers a sandbox violation. Since we are always only operating on
temporary files within symbolizeAddresses, this patch disables the IO
sandbox in that function.
[TableGen] Emit constexpr versions of some directive/clause functions (#194633)
A variant of https://github.com/llvm/llvm-project/pull/176253 with a
change to reduce compile-time impact.
Since "llvm_unreachable" is actually allowed in constexpr functions,
simply emit the bodies of the selected functions in the header file.
In the previous PR the `isAllowedClauseForDirective` function was made
constexpr, but since it was very long it had a significant impact on
compilation time. In this PR that function is no longer constexpr.
[CIR] Avoid duplicate name collisions in LoweringPrepare (#194469)
This fixes a bug in the CIR LoweringPrepare pass where we were creating
multiple constant initializer global values with the same name, causing
references to them (specifically cir.get_global) to get the wrong value.
Assisted-by: Cursor / claude-4.7-opus-xhigh
[OpenMPIRBuilder] Cast device num_threads to i32 for __kmpc_parallel_60 (#194634)
I observed a crash in device OpenMP lowering when compiling with
`-fdefault-integer-8`. In `targetParallelCallback`, `NumThreads` can be
`i64`, but `__kmpc_parallel_60` expects an `i32` `num_threads`
parameter, which caused a bad-signature assertion during call creation.
The fix is to use `CreateZExtOrTrunc(..., Int32)` for the `num_threads`
argument before building the runtime call. This matches the handling
used in clang in `CGOpenMPRuntimeGPU::emitParallelCall`.
The problem can be seen with the following testcase whe compiled with
`flang -fopenmp --offload-arch=gfx90a test.f90 -fdefault-integer-8``
```
program test
implicit none
integer :: nthreads
integer :: i
[6 lines not shown]