diff options
Diffstat (limited to 'clang/lib/Tooling')
-rw-r--r-- | clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Tooling/JSONCompilationDatabase.cpp | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp b/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp index 84936ba..bb51927 100644 --- a/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp +++ b/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "clang/Tooling/CompilationDatabase.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ConvertUTF.h" @@ -48,6 +47,12 @@ public: private: std::vector<CompileCommand> expand(std::vector<CompileCommand> Cmds) const { for (auto &Cmd : Cmds) { + // FIXME: we should rather propagate the current directory into + // ExpandResponseFiles as well in addition to FS. + if (std::error_code EC = FS->setCurrentWorkingDirectory(Cmd.Directory)) { + llvm::consumeError(llvm::errorCodeToError(EC)); + continue; + } bool SeenRSPFile = false; llvm::SmallVector<const char *, 20> Argv; Argv.reserve(Cmd.CommandLine.size()); @@ -59,8 +64,7 @@ private: continue; llvm::BumpPtrAllocator Alloc; llvm::StringSaver Saver(Alloc); - llvm::cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, *FS, - llvm::StringRef(Cmd.Directory)); + llvm::cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, *FS); Cmd.CommandLine.assign(Argv.begin(), Argv.end()); } return Cmds; diff --git a/clang/lib/Tooling/JSONCompilationDatabase.cpp b/clang/lib/Tooling/JSONCompilationDatabase.cpp index 04dd4db..8dd4608 100644 --- a/clang/lib/Tooling/JSONCompilationDatabase.cpp +++ b/clang/lib/Tooling/JSONCompilationDatabase.cpp @@ -29,7 +29,6 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include "llvm/Support/StringSaver.h" -#include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/YAMLParser.h" #include "llvm/Support/raw_ostream.h" #include <cassert> @@ -170,7 +169,8 @@ class JSONCompilationDatabasePlugin : public CompilationDatabasePlugin { JSONDatabasePath, ErrorMessage, JSONCommandLineSyntax::AutoDetect); return Base ? inferTargetAndDriverMode( inferMissingCompileCommands(expandResponseFiles( - std::move(Base), llvm::vfs::getRealFileSystem()))) + std::move(Base), + llvm::vfs::createPhysicalFileSystem().release()))) : nullptr; } }; |