[clang] [AMDGPU] Use the AMDGPUToolChain when targeting C/C++ directly (PR #99687)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 04:54:49 PST 2024


================
@@ -6405,7 +6424,12 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
       TC = std::make_unique<toolchains::NVPTXToolChain>(*this, Target, Args);
       break;
     case llvm::Triple::AMDHSA:
-      TC = std::make_unique<toolchains::ROCMToolChain>(*this, Target, Args);
+      TC =
+          llvm::any_of(Inputs,
+                       [](auto &Input) { return types::isOpenCL(Input.first); })
+              ? std::make_unique<toolchains::ROCMToolChain>(*this, Target, Args)
----------------
jhuber6 wrote:

The Toolchain doesn't have source file information, I could put it in the constructor but it would be pretty much the same thing.  I can't disable the ROCm device libs because that would then break OpenCL. I could make it an error instead, but I figured the differences are pretty minor so it's not worthwhile.

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


More information about the cfe-commits mailing list