[clang] [Clang][NFC] Clean up fetching the offloading toolchain (PR #125095)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 11:37:06 PST 2025


================
@@ -6601,6 +6573,72 @@ std::string Driver::GetClPchPath(Compilation &C, StringRef BaseName) const {
   return std::string(Output);
 }
 
+const ToolChain &Driver::getOffloadToolChain(
+    const llvm::opt::ArgList &Args, const Action::OffloadKind Kind,
+    const llvm::Triple &Target, const llvm::Triple &AuxTarget) const {
+  auto &TC = ToolChains[Target.str() + "/" + AuxTarget.str()];
+  auto &HostTC = ToolChains[AuxTarget.str()];
----------------
Artem-B wrote:

I think it would be useful here to spell out the type `std::unique_ptr<ToolChain>`. Otherwise, the `if(!TC)` and `TC= ...` blow look *very* suspicious.


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


More information about the cfe-commits mailing list