Skip to content

Commit

Permalink
Revert "[clang-cl] Always interpret the LIB env var as separated with…
Browse files Browse the repository at this point in the history
… 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;
  • Loading branch information
mstorsjo committed Sep 21, 2020
1 parent 2c768c7 commit 8c3ef08
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 1 addition & 3 deletions clang/test/Driver/cl-inputs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions llvm/include/llvm/Support/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <system_error>

namespace llvm {
Expand Down Expand Up @@ -108,12 +107,10 @@ class Process {
/// considered.
static Optional<std::string> FindInEnvPath(StringRef EnvName,
StringRef FileName,
ArrayRef<std::string> IgnoreList,
char Separator = EnvPathSeparator);
ArrayRef<std::string> IgnoreList);

static Optional<std::string> 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
Expand Down
11 changes: 5 additions & 6 deletions llvm/lib/Support/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,21 @@ using namespace sys;
//=== independent code.
//===----------------------------------------------------------------------===//

Optional<std::string>
Process::FindInEnvPath(StringRef EnvName, StringRef FileName, char Separator) {
return FindInEnvPath(EnvName, FileName, {}, Separator);
Optional<std::string> Process::FindInEnvPath(StringRef EnvName,
StringRef FileName) {
return FindInEnvPath(EnvName, FileName, {});
}

Optional<std::string> Process::FindInEnvPath(StringRef EnvName,
StringRef FileName,
ArrayRef<std::string> IgnoreList,
char Separator) {
ArrayRef<std::string> IgnoreList) {
assert(!path::is_absolute(FileName));
Optional<std::string> FoundPath;
Optional<std::string> OptPath = Process::GetEnv(EnvName);
if (!OptPath.hasValue())
return FoundPath;

const char EnvPathSeparatorStr[] = {Separator, '\0'};
const char EnvPathSeparatorStr[] = {EnvPathSeparator, '\0'};
SmallVector<StringRef, 8> Dirs;
SplitString(OptPath.getValue(), Dirs, EnvPathSeparatorStr);

Expand Down

0 comments on commit 8c3ef08

Please sign in to comment.