[PATCH] D33258: clang-cl: Fix path-based MSVC version detection

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 17 08:41:07 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL303267: clang-cl: Fix path-based MSVC version detection (authored by hans).

Changed prior to commit:
  https://reviews.llvm.org/D33258?vs=99213&id=99310#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33258

Files:
  cfe/trunk/lib/Driver/ToolChains/MSVC.cpp


Index: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
@@ -125,8 +125,15 @@
         continue;
 
       // whatever/VC/bin --> old toolchain, VC dir is toolchain dir.
-      if (llvm::sys::path::filename(PathEntry) == "bin") {
-        llvm::StringRef ParentPath = llvm::sys::path::parent_path(PathEntry);
+      llvm::StringRef TestPath = PathEntry;
+      bool IsBin = llvm::sys::path::filename(TestPath).equals_lower("bin");
+      if (!IsBin) {
+        // Strip any architecture subdir like "amd64".
+        TestPath = llvm::sys::path::parent_path(TestPath);
+        IsBin = llvm::sys::path::filename(TestPath).equals_lower("bin");
+      }
+      if (IsBin) {
+        llvm::StringRef ParentPath = llvm::sys::path::parent_path(TestPath);
         if (llvm::sys::path::filename(ParentPath) == "VC") {
           Path = ParentPath;
           IsVS2017OrNewer = false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33258.99310.patch
Type: text/x-patch
Size: 1025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170517/0ec4f67b/attachment.bin>


More information about the cfe-commits mailing list