[clang] [HIP] Fix distro HIP headers shadowing ROCm includes (PR #238058)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 6 07:47:48 PST 2026


================
@@ -1183,6 +1183,12 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
     CmdArgs.push_back(Args.MakeArgString(P));
   }
 
+  // Add HIP toolkit include paths after C++ stdlib but before system headers.
+  // This ensures the selected ROCm headers beat distro-installed HIP headers
+  // in /usr/include without breaking C++ #include_next chains.
+  if (JA.isOffloading(Action::OFK_HIP))
----------------
yxsamliu wrote:

Could we keep the `-foffload-via-llvm` guard here? The early hook skips this mode, but the late hook now adds vendor HIP headers to Linux host jobs. Please add a test for this mode.

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


More information about the cfe-commits mailing list