diff options
Diffstat (limited to 'clang/lib/Driver/ToolChains/MSVC.cpp')
| -rw-r--r-- | clang/lib/Driver/ToolChains/MSVC.cpp | 14 | 
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp index e3801c55a98..3a789627c55 100644 --- a/clang/lib/Driver/ToolChains/MSVC.cpp +++ b/clang/lib/Driver/ToolChains/MSVC.cpp @@ -488,8 +488,18 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,      // their own link.exe which may come first.      linkPath = FindVisualStudioExecutable(TC, "link.exe"); -    if (!TC.FoundMSVCInstall() && !llvm::sys::fs::can_execute(linkPath)) -      C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found); +    if (!TC.FoundMSVCInstall() && !llvm::sys::fs::can_execute(linkPath)) { +      llvm::SmallString<128> ClPath; +      ClPath = TC.GetProgramPath("cl.exe"); +      if (llvm::sys::fs::can_execute(ClPath)) { +        linkPath = llvm::sys::path::parent_path(ClPath); +        llvm::sys::path::append(linkPath, "link.exe"); +        if (!llvm::sys::fs::can_execute(linkPath)) +          C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found); +      } else { +        C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found); +      } +    }  #ifdef _WIN32      // When cross-compiling with VS2017 or newer, link.exe expects to have  | 

