Wmsvc-not-found was added in r297851 to help diagnose why link.exe can't be
executed. However, it's emitted even when using -fuse-ld=lld, and in cross
builds there's no way to get rid of the warning other than disabling it.
Instead, emit it when we look up link.exe and it ends up not being executable.
That way, when passing -fuse-ld=lld it will never be printed.
It will also not be printed if we find link.exe on PATH.
(We might want to eventually default to lld one day, at least when running on a
non-Win host, but that's for another day.)
Fixes PR38016.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337290
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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);
+
#ifdef _WIN32
// When cross-compiling with VS2017 or newer, link.exe expects to have
// its containing bin directory at the top of PATH, followed by the
}
Tool *MSVCToolChain::buildLinker() const {
- if (VCToolChainPath.empty())
- getDriver().Diag(clang::diag::warn_drv_msvc_not_found);
return new tools::visualstudio::Linker(*this);
}
void printVerboseInfo(raw_ostream &OS) const override;
+ bool FoundMSVCInstall() const { return !VCToolChainPath.empty(); }
+
protected:
void AddSystemIncludeWithSubfolder(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,