[PATCH] D51164: [Tooling] Add a isSingleProcess() helper to ToolExecutor

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 24 02:04:20 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC340599: [Tooling] Add a isSingleProcess() helper to ToolExecutor (authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51164?vs=162182&id=162345#toc

Repository:
  rC Clang

https://reviews.llvm.org/D51164

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


Index: unittests/Tooling/ExecutionTest.cpp
===================================================================
--- unittests/Tooling/ExecutionTest.cpp
+++ unittests/Tooling/ExecutionTest.cpp
@@ -96,6 +96,8 @@
 
   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 {
Index: include/clang/Tooling/StandaloneExecution.h
===================================================================
--- include/clang/Tooling/StandaloneExecution.h
+++ include/clang/Tooling/StandaloneExecution.h
@@ -52,6 +52,8 @@
 
   StringRef getExecutorName() const override { return ExecutorName; }
 
+  bool isSingleProcess() const override { return true; }
+
   using ToolExecutor::execute;
 
   llvm::Error
Index: include/clang/Tooling/Execution.h
===================================================================
--- include/clang/Tooling/Execution.h
+++ include/clang/Tooling/Execution.h
@@ -114,6 +114,13 @@
   /// 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: include/clang/Tooling/AllTUsExecution.h
===================================================================
--- include/clang/Tooling/AllTUsExecution.h
+++ include/clang/Tooling/AllTUsExecution.h
@@ -45,6 +45,8 @@
 
   StringRef getExecutorName() const override { return ExecutorName; }
 
+  bool isSingleProcess() const override { return true; }
+
   using ToolExecutor::execute;
 
   llvm::Error


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51164.162345.patch
Type: text/x-patch
Size: 2159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180824/31e7c7f7/attachment-0001.bin>


More information about the cfe-commits mailing list