aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Driver/ToolChains/MSVC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Driver/ToolChains/MSVC.cpp')
-rw-r--r--lib/Driver/ToolChains/MSVC.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Driver/ToolChains/MSVC.cpp b/lib/Driver/ToolChains/MSVC.cpp
index a09304814ca6..6f5f54165b3b 100644
--- a/lib/Driver/ToolChains/MSVC.cpp
+++ b/lib/Driver/ToolChains/MSVC.cpp
@@ -125,8 +125,15 @@ static bool findVCToolChainViaEnvironment(std::string &Path,
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;