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

Jordan Rose jediknil at belkadan.com
Mon Apr 9 11:12:09 PDT 2012


Test case? Even if you don't want to put symlinks in the repository, you could still override PWD manually using env. (Which is important because the test harness now wipes out PWD anyway.)


On Apr 9, 2012, at 14:08, Manuel Klimek wrote:

> 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));
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list