]> granicus.if.org Git - clang/commit
[Driver] Recognize DevDiv internal builds of MSVC, with a different directory structure.
authorStephan T. Lavavej <stl@exchange.microsoft.com>
Mon, 21 Aug 2017 22:19:33 +0000 (22:19 +0000)
committerStephan T. Lavavej <stl@exchange.microsoft.com>
Mon, 21 Aug 2017 22:19:33 +0000 (22:19 +0000)
commit19989eba4f019e3502f5c3f397336dd6aa8acc01
treecb5d923b17beee6a83c28ed49102090051458030
parent987a86cd11acedca411f9e4e8d16f3649b61fa5f
[Driver] Recognize DevDiv internal builds of MSVC, with a different directory structure.

This is a reasonably non-intrusive change, which I've verified
works for both x86 and x64 DevDiv-internal builds.

The idea is to change `bool IsVS2017OrNewer` into a 3-state
`ToolsetLayout VSLayout`. Either a build is DevDiv-internal,
released VS 2017 or newer, or released VS 2015 or older. When looking at
the directory structure, if instead of `"VC"` we see `"x86ret"`, `"x86chk"`,
`"amd64ret"`, or `"amd64chk"`, we recognize this as a DevDiv-internal build.

After we get past the directory structure validation, we use this knowledge
to regenerate paths appropriately. `llvmArchToDevDivInternalArch()` knows how
we use `"i386"` subdirectories, and `MSVCToolChain::getSubDirectoryPath()`
uses that. It also knows that DevDiv-internal builds have an `"inc"`
subdirectory instead of `"include"`.

This may still not be the "right" fix in any sense, but I believe that it's
non-intrusive in the sense that if the special directory names aren't found,
no codepaths are affected. (`ToolsetLayout::OlderVS` and
`ToolsetLayout::VS2017OrNewer` correspond to `IsVS2017OrNewer` being `false`
or `true`, respectively.) I searched for all references to `IsVS2017OrNewer`,
which are places where Clang cares about VS's directory structure, and the
only one that isn't being patched is some logic to deal with
cross-compilation. I'm fine with that not working for DevDiv-internal builds
for the moment (we typically test the native compilers), so I added a comment.

Fixes D36860.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311391 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Driver/ToolChains/MSVC.cpp
lib/Driver/ToolChains/MSVC.h