summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-07-12 14:54:25 +0000
committerEric Liu <ioeric@google.com>2018-07-12 14:54:25 +0000
commit0fbeae7a2efb301d790f116f78893841a8b40259 (patch)
tree2f126bc2ec0a768665326641a524c35e9e4ed1cd
parent6316e0d32293413a131b3124f31c0bbae4abd4ea (diff)
downloadbcm5719-llvm-0fbeae7a2efb301d790f116f78893841a8b40259.tar.gz
bcm5719-llvm-0fbeae7a2efb301d790f116f78893841a8b40259.zip
[Tooling] Get working directory properly without assuming real file system.
llvm-svn: 336910
-rw-r--r--clang/lib/Tooling/Tooling.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp
index c22ad93c760..a106154f4b2 100644
--- a/clang/lib/Tooling/Tooling.cpp
+++ b/clang/lib/Tooling/Tooling.cpp
@@ -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.
OpenPOWER on IntegriCloud