================
@@ -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(
----------------
david-salinas wrote:

done

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