<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang-cl detection of Visual Studio version (VS2017)"
   href="https://bugs.llvm.org/show_bug.cgi?id=35105">35105</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang-cl detection of Visual Studio version (VS2017)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alastair@transfinite.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
<a href="https://blogs.msdn.microsoft.com/vcblog/2016/11/16/open-any-folder-with-c-sources-in-visual-studio-2017-rc/">https://blogs.msdn.microsoft.com/vcblog/2016/11/16/open-any-folder-with-c-sources-in-visual-studio-2017-rc/</a>
- 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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>