diff options
author | Manuel Klimek <klimek@google.com> | 2012-04-09 18:08:23 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2012-04-09 18:08:23 +0000 |
commit | 3521ae95805fca90993847c40f5309a4f1dfd235 (patch) | |
tree | b77c15da00a3edd48e350287251e99c4cf2f7c4c /clang/lib/Tooling/Tooling.cpp | |
parent | 132a998331aeb8d1930f90a5ad251357cb2b0d63 (diff) | |
download | bcm5719-llvm-3521ae95805fca90993847c40f5309a4f1dfd235.tar.gz bcm5719-llvm-3521ae95805fca90993847c40f5309a4f1dfd235.zip |
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
Diffstat (limited to 'clang/lib/Tooling/Tooling.cpp')
-rw-r--r-- | clang/lib/Tooling/Tooling.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp index 4fa98aa2bfe..fa2374f5e30 100644 --- a/clang/lib/Tooling/Tooling.cpp +++ b/clang/lib/Tooling/Tooling.cpp @@ -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)); |