[clang-cl] Add a /diasdkdir flag and make /winsysroot imply it
authorNico Weber <thakis@chromium.org>
Thu, 16 Sep 2021 11:42:32 +0000 (07:42 -0400)
committerNico Weber <thakis@chromium.org>
Thu, 16 Sep 2021 11:42:32 +0000 (07:42 -0400)
commit951f362e2560fe1c9c05f487107fd9882d45d867
tree86e844a1da9730db74690de077b71a1ec2c2b877
parent99ece01a0f571f0df129a55bf679f7fbd0b01b75
[clang-cl] Add a /diasdkdir flag and make /winsysroot imply it

D109708 added "DIA SDK" to our win sysroot for hermetic builds
that use LLVM_ENABLE_DIA_SDK. But the build system still has to
manually pass flags pointing to it.

Since we have a /winsysroot flag, make it look at DIA SDK in
the sysroot.

With this, the following is enough to compile the DIA2Dump example:

out\gn\bin\clang-cl ^
  "sysroot\DIA SDK\Samples\DIA2Dump\DIA2Dump.cpp" ^
  "sysroot\DIA SDK\Samples\DIA2Dump\PrintSymbol.cpp" ^
  "sysroot\DIA SDK\Samples\DIA2Dump\regs.cpp" ^
  /diasdkdir "sysroot\DIA SDK" ^
  ole32.lib oleaut32.lib diaguids.lib

Differential Revision: https://reviews.llvm.org/D109828
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/MSVC.cpp
clang/test/Driver/cl-sysroot.cpp