summaryrefslogtreecommitdiffstats
path: root/lib/Tooling
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2012-04-09 18:08:23 +0000
committerManuel Klimek <klimek@google.com>2012-04-09 18:08:23 +0000
commit4f5b3ac46402e4e0ad8b4faceb1c071d53cd07b3 (patch)
treed837e67440b67e75cb7beb25dfe59a8e7d93680f /lib/Tooling
parent561d62280aecff3168097086425a7da0442d0de4 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154330 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling')
-rw-r--r--lib/Tooling/Tooling.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp
index 4fa98aa2bf..fa2374f5e3 100644
--- a/lib/Tooling/Tooling.cpp
+++ b/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));