[clang] [LinkerWrapper] Fix `-Xoffload-linker a=b` in offloading (PR #100270)

Shilei Tian via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 24 08:53:37 PDT 2024


================
@@ -1214,7 +1214,13 @@ DerivedArgList getLinkerArgs(ArrayRef<OffloadFile> Input,
   // Forward '-Xoffload-linker' options to the appropriate backend.
   for (StringRef Arg : Args.getAllArgValues(OPT_device_linker_args_EQ)) {
     auto [Triple, Value] = Arg.split('=');
-    if (Value.empty())
+    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)
----------------
shiltian wrote:

should it be `TT.getArch() >= Triple::ArchType::LastArchType` as the last arch type is valid, which is `ve`?

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


More information about the cfe-commits mailing list