]> granicus.if.org Git - clang/commitdiff
[Tooling] Add a isSingleProcess() helper to ToolExecutor
authorIlya Biryukov <ibiryukov@google.com>
Fri, 24 Aug 2018 09:03:29 +0000 (09:03 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Fri, 24 Aug 2018 09:03:29 +0000 (09:03 +0000)
Summary:
Used in clangd's symbol builder to optimize for the common
shared-memory executor case.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D51164

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340599 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Tooling/AllTUsExecution.h
include/clang/Tooling/Execution.h
include/clang/Tooling/StandaloneExecution.h
unittests/Tooling/ExecutionTest.cpp

index f199365dc8153de3b9558ac577effc49d633eb53..ee3843398ed4101871be61faf5ff416f8d2d8cfb 100644 (file)
@@ -45,6 +45,8 @@ public:
 
   StringRef getExecutorName() const override { return ExecutorName; }
 
+  bool isSingleProcess() const override { return true; }
+
   using ToolExecutor::execute;
 
   llvm::Error
index 68aef53cb58f3195ae879c5a03a13377d50ffd34..7f4b145773e17378aa47271c0b28debf0ec629b0 100644 (file)
@@ -114,6 +114,13 @@ public:
   /// Returns the name of a specific executor.
   virtual StringRef getExecutorName() const = 0;
 
+  /// Should return true iff executor runs all actions in a single process.
+  /// Clients can use this signal to find out if they can collect results
+  /// in-memory (e.g. to avoid serialization costs of using ToolResults).
+  /// The single-process executors can still run multiple threads, but all
+  /// executions are guaranteed to share the same memory.
+  virtual bool isSingleProcess() const = 0;
+
   /// Executes each action with a corresponding arguments adjuster.
   virtual llvm::Error
   execute(llvm::ArrayRef<
index 572330e4cc220d557fd820f9e7aabde31089a7f7..d787267b6caa5f8be332c76e6db83fecf96836e3 100644 (file)
@@ -52,6 +52,8 @@ public:
 
   StringRef getExecutorName() const override { return ExecutorName; }
 
+  bool isSingleProcess() const override { return true; }
+
   using ToolExecutor::execute;
 
   llvm::Error
index 26db8c6d0ea85da8e8b9c96e0d37e6ae023d61fc..e5dc98d228d9308025d0a838590b6147e0dd8a65 100644 (file)
@@ -96,6 +96,8 @@ public:
 
   StringRef getExecutorName() const override { return ExecutorName; }
 
+  bool isSingleProcess() const override { return true; }
+
   llvm::Error
   execute(llvm::ArrayRef<std::pair<std::unique_ptr<FrontendActionFactory>,
                                    ArgumentsAdjuster>>) override {