diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Tooling/JSONCompilationDatabase.cpp | 4 |
2 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp b/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp index bb519277dfa..84936ba05b2 100644 --- a/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp +++ b/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #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" @@ -47,12 +48,6 @@ 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()); @@ -64,7 +59,8 @@ private: continue; llvm::BumpPtrAllocator Alloc; llvm::StringSaver Saver(Alloc); - llvm::cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, *FS); + llvm::cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, *FS, + llvm::StringRef(Cmd.Directory)); Cmd.CommandLine.assign(Argv.begin(), Argv.end()); } return Cmds; diff --git a/clang/lib/Tooling/JSONCompilationDatabase.cpp b/clang/lib/Tooling/JSONCompilationDatabase.cpp index 8dd46083902..04dd4dbf624 100644 --- a/clang/lib/Tooling/JSONCompilationDatabase.cpp +++ b/clang/lib/Tooling/JSONCompilationDatabase.cpp @@ -29,6 +29,7 @@ #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> @@ -169,8 +170,7 @@ class JSONCompilationDatabasePlugin : public CompilationDatabasePlugin { JSONDatabasePath, ErrorMessage, JSONCommandLineSyntax::AutoDetect); return Base ? inferTargetAndDriverMode( inferMissingCompileCommands(expandResponseFiles( - std::move(Base), - llvm::vfs::createPhysicalFileSystem().release()))) + std::move(Base), llvm::vfs::getRealFileSystem()))) : nullptr; } }; |