[clang] [llvm] [HIP][MacOS] Mach-O support and Darwin toolchain fixes (PR #183991)

Paulius Velesko via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 09:00:28 PDT 2026


================
@@ -1248,6 +1296,11 @@ void DarwinClang::addClangWarningOptions(ArgStringList &CC1Args) const {
   CC1Args.push_back("-Werror=undef-prefix");
 
   // For modern targets, promote certain warnings to errors.
+  // Lazily initialize the target if needed (e.g. when Darwin is used as
+  // a host toolchain for device offloading).
+  ensureTargetInitialized();
----------------
pvelesko wrote:

Darwin's AddDeploymentTarget() runs inside TranslateArgs(), which early-returns when BoundArch is empty. In the HIP offloading path, the host Darwin toolchain is created without a bound arch, so AddDeploymentTarget() never runs and TargetInitialized stays false.

Then addClangWarningOptions() calls isTargetWatchOSBased(), which hits the assert(TargetInitialized) in Darwin::isTargetInitialized().



https://github.com/llvm/llvm-project/pull/183991


More information about the llvm-commits mailing list