Fixes a fix to finding the current directory:

We currently want to look whether PWD is available - if PWD is available it will
get us the non-resolved current path, while fs::current_path will resolve
symlinks. The long term fix is to not rely on that behavior any more.

llvm-svn: 154330
This commit is contained in:
Manuel Klimek 2012-04-09 18:08:23 +00:00
parent 132a998331
commit 3521ae9580
1 changed files with 4 additions and 1 deletions

View File

@ -237,7 +237,10 @@ ClangTool::ClangTool(const CompilationDatabase &Compilations,
ArrayRef<std::string> SourcePaths)
: Files((FileSystemOptions())) {
llvm::SmallString<1024> BaseDirectory;
llvm::sys::fs::current_path(BaseDirectory);
if (const char *PWD = ::getenv("PWD"))
BaseDirectory = PWD;
else
llvm::sys::fs::current_path(BaseDirectory);
for (unsigned I = 0, E = SourcePaths.size(); I != E; ++I) {
llvm::SmallString<1024> File(getAbsolutePath(
SourcePaths[I], BaseDirectory));