[PATCH] D22426: Fix automatic detection of ARM MSVC toolset in clang.exe

Dave Bartolomeo via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 26 16:57:15 PDT 2016


DaveBartolomeo updated this revision to Diff 65633.
DaveBartolomeo added a comment.
Herald added a subscriber: samparker.

Updated the selection algorithm based on review feedback. Now, if clang.exe itself is x64-hosted, we'll look for the x64-hosted MSVC toolset if it exists. If clang.exe is not x64-hosted, or if the x64-hosted MSVC toolset is not found, we fall back to x86-hosted MSVC toolset.


https://reviews.llvm.org/D22426

Files:
  lib/Driver/MSVCToolChain.cpp

Index: lib/Driver/MSVCToolChain.cpp
===================================================================
--- lib/Driver/MSVCToolChain.cpp
+++ lib/Driver/MSVCToolChain.cpp
@@ -454,19 +454,33 @@
   if (BinDir.empty())
     return false;
 
+  SmallString<128> X64BinDir = BinDir;
   switch (getArch()) {
   case llvm::Triple::x86:
+    llvm::sys::path::append(X64BinDir, "amd64_x86");
     break;
   case llvm::Triple::x86_64:
-    llvm::sys::path::append(BinDir, "amd64");
+    llvm::sys::path::append(BinDir, "x86_amd64");
+    llvm::sys::path::append(X64BinDir, "amd64");
     break;
   case llvm::Triple::arm:
-    llvm::sys::path::append(BinDir, "arm");
+    llvm::sys::path::append(BinDir, "x86_arm");
+    llvm::sys::path::append(X64BinDir, "amd64_arm");
     break;
   default:
     // Whatever this is, Visual Studio doesn't have a toolchain for it.
     return false;
   }
+
+#if defined(_M_X64)
+  // If running x64-hosted Clang, choose the x64-hosted version of the MSVC
+  // toolset, if it exists.
+  if (llvm::sys::fs::exists(X64BinDir)) {
+    path = X64BinDir.str();
+    return true;
+  }
+#endif
+
   path = BinDir.str();
   return true;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22426.65633.patch
Type: text/x-patch
Size: 1191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160726/771ec276/attachment-0001.bin>


More information about the cfe-commits mailing list