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

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 08:48:51 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)
----------------
jhuber6 wrote:

I could probably use `Triple::parseArch(Str) == Triple::ArchType::UnknownArch)` instead, I think that's as close as we have.

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


More information about the cfe-commits mailing list