Try to fix clang/test/Driver/cl-include.c failure

Somewhat speculative. Example failures:
https://lab.llvm.org/buildbot/#/builders/5/builds/8857/steps/9/logs/stdio
https://lab.llvm.org/buildbot/#/builders/123/builds/4621/steps/8/logs/stdio
This commit is contained in:
Hans Wennborg 2021-06-21 17:18:00 +02:00
parent eab1fd389b
commit 5958dc75ce
1 changed files with 5 additions and 4 deletions

View File

@ -1244,8 +1244,8 @@ void MSVCToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
addSystemInclude(DriverArgs, CC1Args, Path);
auto AddSystemIncludesFromEnv = [&](StringRef Var) -> bool {
SmallVector<StringRef, 8> Dirs;
if (auto Val = llvm::sys::Process::GetEnv(Var)) {
SmallVector<StringRef, 8> Dirs;
StringRef(*Val).split(Dirs, ";", /*MaxSplit=*/-1, /*KeepEmpty=*/false);
if (!Dirs.empty()) {
addSystemIncludes(DriverArgs, CC1Args, Dirs);
@ -1268,8 +1268,9 @@ void MSVCToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
// paths set by vcvarsall.bat. Skip if the user expressly set a vctoolsdir.
if (!DriverArgs.getLastArg(options::OPT__SLASH_vctoolsdir,
options::OPT__SLASH_winsysroot)) {
if (AddSystemIncludesFromEnv("INCLUDE") |
AddSystemIncludesFromEnv("EXTERNAL_INCLUDE"))
bool Found = AddSystemIncludesFromEnv("INCLUDE");
Found |= AddSystemIncludesFromEnv("EXTERNAL_INCLUDE");
if (Found)
return;
}
@ -1292,7 +1293,7 @@ void MSVCToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
}
std::string WindowsSDKDir;
int major;
int major = 0;
std::string windowsSDKIncludeVersion;
std::string windowsSDKLibVersion;
if (getWindowsSDKDir(getVFS(), DriverArgs, WindowsSDKDir, major,