[llvm-bugs] [Bug 35105] New: Clang-cl detection of Visual Studio version (VS2017)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 27 02:12:33 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=35105

            Bug ID: 35105
           Summary: Clang-cl detection of Visual Studio version (VS2017)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alastair at transfinite.com
                CC: llvm-bugs at lists.llvm.org

When compiling with Clang within VS2017 I am not seeing the version of VS
detected correctly which is causing issues when using /fallback as the path to
cl.exe isn't set correctly.

Looking at FindVCToolChainViaEnvironment(VCToolChainPath, VSLayout)

It first looks for "VCToolsInstallDir" - this environment variable is not set
if you simply launch VS2017 

(as per
https://blogs.msdn.microsoft.com/vcblog/2016/11/16/open-any-folder-with-c-sources-in-visual-studio-2017-rc/
- Note: %WindowsSdkDir% and %VCToolsInstallDir% are not set as global
environment variables so make sure you start devenv.exe from a “Developer
Command Prompt for VS 2017” that defines these variables)

It then looks for VCINSTALLDIR which if found it assumes VSLayout =
MSVCToolChain::ToolsetLayout::OlderVS; and problems ensue.

Issue is my Visual Assist plugin is seemingly setting this environment variable
to c:\program files (x86)\microsoft visual
studio\2017\professional\common7\ide\vc\ on my system.

Disable this plugin and all works as expected (VCINSTALLDIR is not set) as then
findVCToolChainViaSetupConfig correctly detects VS2017.

I am not sure Visual Assist should be setting this enviroment variable but it
would seem to be sensible given VCToolChainViaSetupConfig  states "This is the
preferred way to discover new Visual Studios, as they're no longer listed in
the registry" that is function call is possibly called first in
MSVCToolChain::MSVCToolChain

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171027/9be75665/attachment.html>


More information about the llvm-bugs mailing list