[clang] [clang][Driver] Fix triple config loading for clang-cl (PR #111397)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 13 07:04:58 PST 2024


================
@@ -1286,6 +1299,16 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
           appendOneArg(Args, Opt, nullptr);
         }
     }
+
+    // The config file may have changed the architecture so apply it.
+    if (HasConfigFile && Args.hasArg(options::OPT__SLASH_arm64EC)) {
+      llvm::Triple T(TargetTriple);
+      if (T.getArch() != llvm::Triple::aarch64 ||
+          T.getSubArch() != llvm::Triple::AArch64SubArch_arm64ec) {
+        T.setArch(llvm::Triple::aarch64, llvm::Triple::AArch64SubArch_arm64ec);
+        TargetTriple = T.str();
----------------
zmodem wrote:

Thanks for explaining. I haven't looked at this code in a long time, and TargetTriple vs. computeTargetTriple() is pretty confusing.

It seems `/arm64EC` is not handled in `computeTargetTriple()`(?) so I suppose it needs to be handled somewhere :)

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


More information about the cfe-commits mailing list