From 8c3ef08f8a4eb40609af55d541e5135856fde086 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Tue, 22 Sep 2020 00:10:07 +0300 Subject: [PATCH] Revert "[clang-cl] Always interpret the LIB env var as separated with semicolons" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This reverts commit 4d85444b317a00a3e15da63cdb693d272c99a0cc. This commit broke building lldb's NativeProcessProtocolTest.cpp, with errors like these: In file included from include/llvm/Support/Process.h:32:0, from tools/lldb/unittests/Host/NativeProcessProtocolTest.cpp:12: include/llvm/Support/Program.h:39:11: error: reference to ‘pid_t’ is ambiguous typedef pid_t procid_t; /usr/include/sched.h:38:17: note: candidates are: typedef __pid_t pid_t typedef __pid_t pid_t; tools/lldb/include/lldb/lldb-types.h:85:18: note: typedef uint64_t lldb::pid_t typedef uint64_t pid_t; --- clang/lib/Driver/Driver.cpp | 2 +- clang/test/Driver/cl-inputs.c | 4 +--- llvm/include/llvm/Support/Process.h | 7 ++----- llvm/lib/Support/Process.cpp | 11 +++++------ 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 69336f6..65b4459 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -2085,7 +2085,7 @@ bool Driver::DiagnoseInputExistence(const DerivedArgList &Args, StringRef Value, if (IsCLMode()) { if (!llvm::sys::path::is_absolute(Twine(Value)) && - llvm::sys::Process::FindInEnvPath("LIB", Value, ';')) + llvm::sys::Process::FindInEnvPath("LIB", Value)) return true; if (Args.hasArg(options::OPT__SLASH_link) && Ty == types::TY_Object) { diff --git a/clang/test/Driver/cl-inputs.c b/clang/test/Driver/cl-inputs.c index 59455a0..c67fc24 100644 --- a/clang/test/Driver/cl-inputs.c +++ b/clang/test/Driver/cl-inputs.c @@ -32,9 +32,7 @@ // WARN-NOT: note // MSYS2_ARG_CONV_EXCL tells MSYS2 to skip conversion of the specified argument. -// Add a dummy "other" entry to the path as well, to check that it's split -// around semicolons even on unix. -// RUN: env LIB="other;%S/Inputs/cl-libs" MSYS2_ARG_CONV_EXCL="/TP;/c" %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s +// RUN: env LIB=%S/Inputs/cl-libs MSYS2_ARG_CONV_EXCL="/TP;/c" %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s // TPlib: warning: cl-test.lib: 'linker' input unused // TPlib: warning: argument unused during compilation: '/TP' // TPlib-NOT: cl-test.lib diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h index af5091a..0ba6d58 100644 --- a/llvm/include/llvm/Support/Process.h +++ b/llvm/include/llvm/Support/Process.h @@ -29,7 +29,6 @@ #include "llvm/Support/Chrono.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/Error.h" -#include "llvm/Support/Program.h" #include namespace llvm { @@ -108,12 +107,10 @@ public: /// considered. static Optional FindInEnvPath(StringRef EnvName, StringRef FileName, - ArrayRef IgnoreList, - char Separator = EnvPathSeparator); + ArrayRef IgnoreList); static Optional FindInEnvPath(StringRef EnvName, - StringRef FileName, - char Separator = EnvPathSeparator); + StringRef FileName); // This functions ensures that the standard file descriptors (input, output, // and error) are properly mapped to a file descriptor before we use any of diff --git a/llvm/lib/Support/Process.cpp b/llvm/lib/Support/Process.cpp index 9f0b689..9e6e233 100644 --- a/llvm/lib/Support/Process.cpp +++ b/llvm/lib/Support/Process.cpp @@ -28,22 +28,21 @@ using namespace sys; //=== independent code. //===----------------------------------------------------------------------===// -Optional -Process::FindInEnvPath(StringRef EnvName, StringRef FileName, char Separator) { - return FindInEnvPath(EnvName, FileName, {}, Separator); +Optional Process::FindInEnvPath(StringRef EnvName, + StringRef FileName) { + return FindInEnvPath(EnvName, FileName, {}); } Optional Process::FindInEnvPath(StringRef EnvName, StringRef FileName, - ArrayRef IgnoreList, - char Separator) { + ArrayRef IgnoreList) { assert(!path::is_absolute(FileName)); Optional FoundPath; Optional OptPath = Process::GetEnv(EnvName); if (!OptPath.hasValue()) return FoundPath; - const char EnvPathSeparatorStr[] = {Separator, '\0'}; + const char EnvPathSeparatorStr[] = {EnvPathSeparator, '\0'}; SmallVector Dirs; SplitString(OptPath.getValue(), Dirs, EnvPathSeparatorStr); -- 2.7.4