forked from OSchip/llvm-project
[Tooling] Get working directory properly without assuming real file system.
llvm-svn: 336910
This commit is contained in:
parent
6316e0d322
commit
0fbeae7a2e
|
@ -411,10 +411,14 @@ int ClangTool::run(ToolAction *Action) {
|
|||
// This just needs to be some symbol in the binary.
|
||||
static int StaticSymbol;
|
||||
|
||||
llvm::SmallString<128> InitialDirectory;
|
||||
if (std::error_code EC = llvm::sys::fs::current_path(InitialDirectory))
|
||||
std::string InitialDirectory;
|
||||
if (llvm::ErrorOr<std::string> CWD =
|
||||
OverlayFileSystem->getCurrentWorkingDirectory()) {
|
||||
InitialDirectory = std::move(*CWD);
|
||||
} else {
|
||||
llvm::report_fatal_error("Cannot detect current path: " +
|
||||
Twine(EC.message()));
|
||||
Twine(CWD.getError().message()));
|
||||
}
|
||||
|
||||
// First insert all absolute paths into the in-memory VFS. These are global
|
||||
// for all compile commands.
|
||||
|
|
Loading…
Reference in New Issue