================
@@ -614,20 +614,36 @@ void RocmInstallationDetector::AddHIPIncludeArgs(const 
ArgList &DriverArgs,
     return;
   }
 
-  CC1Args.push_back("-idirafter");
-  CC1Args.push_back(DriverArgs.MakeArgString(getIncludePath()));
-  SmallString<128> LibHipCxxPath(getIncludePath());
-  llvm::sys::path::append(LibHipCxxPath, "libhipcxx");
-  if (D.getVFS().exists(LibHipCxxPath)) {
-    CC1Args.push_back("-idirafter");
-    CC1Args.push_back(DriverArgs.MakeArgString(LibHipCxxPath));
-  }
+  // The ROCm toolkit include path (e.g. /opt/rocm/include) is added later
+  // by AddHIPIncludeArgsLate, which is called after C++ stdlib headers but
+  // before C system headers. This positional ordering ensures ROCm headers
+  // beat distro-installed HIP headers in /usr/include without breaking
+  // C++ #include_next chains.
   if (UsesRuntimeWrapper)
     CC1Args.append({"-include", "__clang_hip_runtime_wrapper.h"});
   if (HasHipStdPar)
     HandleHipStdPar();
 }
 
+void RocmInstallationDetector::AddHIPIncludeArgsLate(
----------------
yxsamliu wrote:

Could we update MSVC, MinGW, FreeBSD and Darwin too? They still call the early 
hook and do not implement the late hook, so host jobs now lose the HIP and 
libhipcxx include paths. Please add a host preprocessing test.

https://github.com/llvm/llvm-project/pull/238058
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to