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

Manuel Klimek klimek at google.com
Tue Apr 10 01:02:12 PDT 2012


On Mon, Apr 9, 2012 at 11:48 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> Manuel, sorry for inconvenience.
>
> I think PathV2 would be aware also of $PWD, rather.
>
> eg) current_path(smallstring, bool honor_pwd=True);
> To check $PWD points cwd, then show $PWD as result.

To make sure I'm understanding what you're saying correctly:
Are you proposing that we should add the bool honor_pwd to
current_path in FileSystem.h?

Thanks,
/Manuel


> Thanks!
>
> ...Takumi
>
> 2012/4/10 Manuel Klimek <klimek at google.com>:
>> 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