forked from OSchip/llvm-project
Tooling.cpp: Don't refer to $ENV{PWD}. Use llvm::sys::fs instead.
$ENV{PWD} is not expected to be set on all hosts. llvm-svn: 154015
This commit is contained in:
parent
e1fd20172b
commit
f0c8779db4
|
@ -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 @@ void ToolInvocation::addFileMappingsTo(SourceManager &Sources) {
|
|||
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));
|
||||
|
|
Loading…
Reference in New Issue