Summary:
We can't resolve this (if it's a symlink) without further refactoring, but the
current behaviour is just incorrect.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82011
// First, eliminate relative paths.
std::string Storage;
if (!llvm::sys::path::is_absolute(Driver)) {
+ // If it's working-dir relative like bin/clang, we can't resolve it.
+ // FIXME: we could if we had the working directory here.
+ // Let's hope it's not a symlink.
+ if (llvm::any_of(Driver,
+ [](char C) { return llvm::sys::path::is_separator(C); }))
+ return Driver.str();
// If the driver is a generic like "g++" with no path, add clang dir.
if (ClangPath &&
(Driver == "clang" || Driver == "clang++" || Driver == "gcc" ||
Cmd = {"foo/unknown-binary", "foo.cc"};
Mangler.adjust(Cmd);
- EXPECT_EQ(testPath("fake/unknown-binary"), Cmd.front());
+ EXPECT_EQ("foo/unknown-binary", Cmd.front());
}
// Only run the PATH/symlink resolving test on unix, we need to fiddle