Detecting MSVC version and location used by Clang


1. Include MSVC version in the target triplet reported by -dumpmachine.

2. Include MSVC and Platform SDK bin/ directories in the 'programs' value
   reported by -print-search-dirs.

Long version:

We are working[1] on adding "Clang-targeting-MSVC" support to build2 and
the problem we ran into is determining (1) which MSVC version Clang is
targeting and (2) the location of the MSVC toolchain.

For (1) the natural place to discover this would be the -dumpmachine
output. I see that internally Clang includes the compiler version:

clang++.exe -cc1 -triple x86_64-pc-windows-msvc19.11.25547 [...]

However, the version is omitted from the -dumpmachine output:

clang++.exe -dumpmachine

Would it be possible to preserve the version here?

For (2), we need to find the bin/ directories of MSVC itself (for
lib.exe and link.exe) as well as of Platform SDK (for rc.exe,
mt.exe, etc).

Again, the natural place to include these paths would be the
'programs' value in -print-search-dirs output. Currently it looks
like this:

programs: =C:\LLVM\build\bin
libraries: =C:\LLVM\build\lib\clang\6.0.0

[1] [build2] Using build2 with clang 6 (trunk) on windows


No, nobody has any thoughts on this?