[cfe-commits] r154330 - /cfe/trunk/lib/Tooling/Tooling.cpp

Manuel Klimek klimek at google.com
Mon Apr 9 11:08:24 PDT 2012


Author: klimek
Date: Mon Apr  9 13:08:23 2012
New Revision: 154330

URL: http://llvm.org/viewvc/llvm-project?rev=154330&view=rev
Log:
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.


Modified:
    cfe/trunk/lib/Tooling/Tooling.cpp

Modified: cfe/trunk/lib/Tooling/Tooling.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=154330&r1=154329&r2=154330&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Tooling.cpp (original)
+++ cfe/trunk/lib/Tooling/Tooling.cpp Mon Apr  9 13:08:23 2012
@@ -237,7 +237,10 @@
                      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));





More information about the cfe-commits mailing list