[clang] [LinkerWrapper] Make `-Xoffload-linker` match `-Xlinker` semantics (PR #101032)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 08:45:39 PDT 2024


================
@@ -1236,6 +1238,23 @@ DerivedArgList getLinkerArgs(ArrayRef<OffloadFile> Input,
                        Args.MakeArgString(Value));
   }
 
+  // Forward '-Xoffload-compiler' options to the appropriate backend.
+  for (StringRef Arg : Args.getAllArgValues(OPT_device_compiler_args_EQ)) {
+    auto [Triple, Value] = Arg.split('=');
+    llvm::Triple TT(Triple);
+    // If this isn't a recognized triple then it's an `arg=value` option.
+    if (TT.getArch() <= Triple::ArchType::UnknownArch ||
+        TT.getArch() > Triple::ArchType::LastArchType)
----------------
arsenm wrote:

I'd expect Triple to have an isvalid or operator bool or something instead of needing to do this range check 

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


More information about the cfe-commits mailing list