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

Manuel Klimek klimek at google.com
Mon Apr 9 10:44:15 PDT 2012


This unfortunately breaks one of the current use cases when working
from a symlinked directory.
I'll fix this by checking the output of getenv("PWD") and only use it
if it's available...

On Wed, Apr 4, 2012 at 3:59 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> Author: chapuni
> Date: Wed Apr  4 08:59:36 2012
> New Revision: 154015
>
> URL: http://llvm.org/viewvc/llvm-project?rev=154015&view=rev
> Log:
> Tooling.cpp: Don't refer to $ENV{PWD}. Use llvm::sys::fs instead.
>
> $ENV{PWD} is not expected to be set on all hosts.
>
> 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=154015&r1=154014&r2=154015&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Tooling/Tooling.cpp (original)
> +++ cfe/trunk/lib/Tooling/Tooling.cpp Wed Apr  4 08:59:36 2012
> @@ -24,6 +24,7 @@
>  #include "clang/Frontend/FrontendAction.h"
>  #include "clang/Frontend/FrontendDiagnostic.h"
>  #include "clang/Frontend/TextDiagnosticPrinter.h"
> +#include "llvm/Support/FileSystem.h"
>
>  namespace clang {
>  namespace tooling {
> @@ -235,7 +236,8 @@
>  ClangTool::ClangTool(const CompilationDatabase &Compilations,
>                      ArrayRef<std::string> SourcePaths)
>     : Files((FileSystemOptions())) {
> -  StringRef BaseDirectory(::getenv("PWD"));
> +  llvm::SmallString<1024> BaseDirectory;
> +  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