[PATCH] D49398: clang-cl: Postpone Wmsvc-not-found emission until link.exe gets used.

Zachary Turner via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 17 07:47:20 PDT 2018


Lgtm. I also have a hard time saying which is best, we’re basically trying
to help people who have already strayed from the path, so there’s probably
no objectively correct answer
On Tue, Jul 17, 2018 at 7:26 AM Nico Weber via Phabricator <
reviews at reviews.llvm.org> wrote:

> thakis updated this revision to Diff 155885.
> thakis added a comment.
>
> address comment
>
>
> https://reviews.llvm.org/D49398
>
> Files:
>   lib/Driver/ToolChains/MSVC.cpp
>   lib/Driver/ToolChains/MSVC.h
>
>
> Index: lib/Driver/ToolChains/MSVC.h
> ===================================================================
> --- lib/Driver/ToolChains/MSVC.h
> +++ lib/Driver/ToolChains/MSVC.h
> @@ -123,6 +123,8 @@
>
>    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,
> Index: lib/Driver/ToolChains/MSVC.cpp
> ===================================================================
> --- lib/Driver/ToolChains/MSVC.cpp
> +++ lib/Driver/ToolChains/MSVC.cpp
> @@ -469,6 +469,9 @@
>      // 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
> @@ -684,8 +687,6 @@
>  }
>
>  Tool *MSVCToolChain::buildLinker() const {
> -  if (VCToolChainPath.empty())
> -    getDriver().Diag(clang::diag::warn_drv_msvc_not_found);
>    return new tools::visualstudio::Linker(*this);
>  }
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180717/7803d9ba/attachment.html>


More information about the cfe-commits mailing list