]> granicus.if.org Git - clang/commitdiff
[Tooling] Make standalone executor support user-provided vfs.
authorEric Liu <ioeric@google.com>
Thu, 12 Jul 2018 18:32:11 +0000 (18:32 +0000)
committerEric Liu <ioeric@google.com>
Thu, 12 Jul 2018 18:32:11 +0000 (18:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336928 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Tooling/StandaloneExecution.h
lib/Tooling/StandaloneExecution.cpp

index 7d1d0d68a40c43ac88772f60bcdefa4eb1d4ba3e..572330e4cc220d557fd820f9e7aabde31089a7f7 100644 (file)
@@ -37,6 +37,7 @@ public:
   StandaloneToolExecutor(
       const CompilationDatabase &Compilations,
       llvm::ArrayRef<std::string> SourcePaths,
+      IntrusiveRefCntPtr<vfs::FileSystem> BaseFS = vfs::getRealFileSystem(),
       std::shared_ptr<PCHContainerOperations> PCHContainerOps =
           std::make_shared<PCHContainerOperations>());
 
index eea8e39d134c2b7ad46e1604720c0141daaddefc..7312baf9dc77c8dabf100f6ff22ba8a78079a79f 100644 (file)
@@ -30,9 +30,11 @@ static ArgumentsAdjuster getDefaultArgumentsAdjusters() {
 StandaloneToolExecutor::StandaloneToolExecutor(
     const CompilationDatabase &Compilations,
     llvm::ArrayRef<std::string> SourcePaths,
+    IntrusiveRefCntPtr<vfs::FileSystem> BaseFS,
     std::shared_ptr<PCHContainerOperations> PCHContainerOps)
-    : Tool(Compilations, SourcePaths), Context(&Results),
-      ArgsAdjuster(getDefaultArgumentsAdjusters()) {
+    : Tool(Compilations, SourcePaths, std::move(PCHContainerOps),
+           std::move(BaseFS)),
+      Context(&Results), ArgsAdjuster(getDefaultArgumentsAdjusters()) {
   // Use self-defined default argument adjusters instead of the default
   // adjusters that come with the old `ClangTool`.
   Tool.clearArgumentsAdjusters();
@@ -43,7 +45,7 @@ StandaloneToolExecutor::StandaloneToolExecutor(
     std::shared_ptr<PCHContainerOperations> PCHContainerOps)
     : OptionsParser(std::move(Options)),
       Tool(OptionsParser->getCompilations(), OptionsParser->getSourcePathList(),
-           PCHContainerOps),
+           std::move(PCHContainerOps)),
       Context(&Results), ArgsAdjuster(getDefaultArgumentsAdjusters()) {
   Tool.clearArgumentsAdjusters();
 }