Skip to content

Commit 8c3ef08

Browse files
committed
Revert "[clang-cl] Always interpret the LIB env var as separated with semicolons"
This reverts commit 4d85444. 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;
1 parent 2c768c7 commit 8c3ef08

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2085,7 +2085,7 @@ bool Driver::DiagnoseInputExistence(const DerivedArgList &Args, StringRef Value,
20852085

20862086
if (IsCLMode()) {
20872087
if (!llvm::sys::path::is_absolute(Twine(Value)) &&
2088-
llvm::sys::Process::FindInEnvPath("LIB", Value, ';'))
2088+
llvm::sys::Process::FindInEnvPath("LIB", Value))
20892089
return true;
20902090

20912091
if (Args.hasArg(options::OPT__SLASH_link) && Ty == types::TY_Object) {

clang/test/Driver/cl-inputs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
// WARN-NOT: note
3333

3434
// MSYS2_ARG_CONV_EXCL tells MSYS2 to skip conversion of the specified argument.
35-
// Add a dummy "other" entry to the path as well, to check that it's split
36-
// around semicolons even on unix.
37-
// 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
35+
// 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
3836
// TPlib: warning: cl-test.lib: 'linker' input unused
3937
// TPlib: warning: argument unused during compilation: '/TP'
4038
// TPlib-NOT: cl-test.lib

llvm/include/llvm/Support/Process.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "llvm/Support/Chrono.h"
3030
#include "llvm/Support/DataTypes.h"
3131
#include "llvm/Support/Error.h"
32-
#include "llvm/Support/Program.h"
3332
#include <system_error>
3433

3534
namespace llvm {
@@ -108,12 +107,10 @@ class Process {
108107
/// considered.
109108
static Optional<std::string> FindInEnvPath(StringRef EnvName,
110109
StringRef FileName,
111-
ArrayRef<std::string> IgnoreList,
112-
char Separator = EnvPathSeparator);
110+
ArrayRef<std::string> IgnoreList);
113111

114112
static Optional<std::string> FindInEnvPath(StringRef EnvName,
115-
StringRef FileName,
116-
char Separator = EnvPathSeparator);
113+
StringRef FileName);
117114

118115
// This functions ensures that the standard file descriptors (input, output,
119116
// and error) are properly mapped to a file descriptor before we use any of

llvm/lib/Support/Process.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,21 @@ using namespace sys;
2828
//=== independent code.
2929
//===----------------------------------------------------------------------===//
3030

31-
Optional<std::string>
32-
Process::FindInEnvPath(StringRef EnvName, StringRef FileName, char Separator) {
33-
return FindInEnvPath(EnvName, FileName, {}, Separator);
31+
Optional<std::string> Process::FindInEnvPath(StringRef EnvName,
32+
StringRef FileName) {
33+
return FindInEnvPath(EnvName, FileName, {});
3434
}
3535

3636
Optional<std::string> Process::FindInEnvPath(StringRef EnvName,
3737
StringRef FileName,
38-
ArrayRef<std::string> IgnoreList,
39-
char Separator) {
38+
ArrayRef<std::string> IgnoreList) {
4039
assert(!path::is_absolute(FileName));
4140
Optional<std::string> FoundPath;
4241
Optional<std::string> OptPath = Process::GetEnv(EnvName);
4342
if (!OptPath.hasValue())
4443
return FoundPath;
4544

46-
const char EnvPathSeparatorStr[] = {Separator, '\0'};
45+
const char EnvPathSeparatorStr[] = {EnvPathSeparator, '\0'};
4746
SmallVector<StringRef, 8> Dirs;
4847
SplitString(OptPath.getValue(), Dirs, EnvPathSeparatorStr);
4948

0 commit comments

Comments
 (0)