Reapply: [clang-cl] Always interpret the LIB env var as separated with semicolons
authorMartin Storsjö <martin@martin.st>
Sun, 20 Sep 2020 20:19:12 +0000 (23:19 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 22 Sep 2020 07:51:25 +0000 (10:51 +0300)
commit3fec6ddc276a595e4409f04dabdd50c84f5f2a2d
treeb931a7adfb8d5dbee151995b0ebb3c3d64f6c92d
parent6fa38de071f0993be81ea090c4a307b1d146c179
Reapply: [clang-cl] Always interpret the LIB env var as separated with semicolons

When cross compiling with clang-cl, clang splits the INCLUDE env
variable around semicolons (clang/lib/Driver/ToolChains/MSVC.cpp,
MSVCToolChain::AddClangSystemIncludeArgs) and lld splits the
LIB variable similarly (lld/COFF/Driver.cpp,
LinkerDriver::addLibSearchPaths). Therefore, the consensus for
cross compilation with clang-cl and lld-link seems to be to use
semicolons, despite path lists normally being separated by colons
on unix and EnvPathSeparator being set to that.

Therefore, handle the LIB variable similarly in Clang, when
handling lib file arguments when driving linking via Clang.

This fixes commands like "clang-cl test.c -Fetest.exe kernel32.lib" in
a cross compilation setting. Normally, most users call (lld-)link
directly, but meson happens to use this command syntax for
has_function() tests.

Reapply: Change Program.h to define procid_t as ::pid_t. When included
in lldb/unittests/Host/NativeProcessProtocolTest.cpp, it is included
after an lldb namespace containing an lldb::pid_t typedef, followed
later by a "using namespace lldb;". Previously, Program.h wasn't
included in this translation unit, but now it ends up included
transitively from Process.h.

Differential Revision: https://reviews.llvm.org/D88002
clang/lib/Driver/Driver.cpp
clang/test/Driver/cl-inputs.c
llvm/include/llvm/Support/Process.h
llvm/include/llvm/Support/Program.h
llvm/lib/Support/Process.cpp