[clang] Remove Linux search paths on Windows (PR #113628)

David Salinas via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 15 12:59:43 PST 2024


================
@@ -6440,7 +6440,8 @@ 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 = std::make_unique<toolchains::ROCMToolChain>(*this, Target, Args,
+                                                       Target.isOSWindows());
----------------
david-salinas wrote:

  "_I need to wrap my head around this more_"
Yup, the class hierarchy we have created for our tool chains is ... frustrating, for this case.  And I've tried a few different variations just to be able to tell the Device's ToolChain's RocmInstallationDetector to hold off on adding these search paths.

"_what's stopping you from just saving that triple inside the class and using it when we do our detection_"

That was one of my attempts.  I first tried just adding it to the RocmInstallationDetector (RID) class.  But because we use the LazyDetector template, I couldn't change the RID constructor without changing the LazyDetector template, and I didn't want to mess around with any of the other Detectors.

So, then I tried just adding a Triple member to the ROCMToolChain class for the Host Triple, and initializing it in its constructor. Which works.  But it is essentially ends up being the same (or nearly the same) as just passing a flag, and doing the "work" in the ROCMToolChain constructor.   If I use a member Triple for Host, I would still need to check it in the ROCMToolChain ctor, and tell its RID that the Host is Windows, before having the RID generate the search paths.


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


More information about the cfe-commits mailing list