diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2018-08-24 09:03:29 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2018-08-24 09:03:29 +0000 |
commit | dbdd8e5238d5ba7f23c8d1a525bc640628bc9a97 (patch) | |
tree | c2c8dab9ae2041710b6ad647369dd5f4c76b0165 | |
parent | 411e710074db74ce3430543e1399a45813952f85 (diff) | |
download | bcm5719-llvm-dbdd8e5238d5ba7f23c8d1a525bc640628bc9a97.tar.gz bcm5719-llvm-dbdd8e5238d5ba7f23c8d1a525bc640628bc9a97.zip |
[Tooling] Add a isSingleProcess() helper to ToolExecutor
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
llvm-svn: 340599
-rw-r--r-- | clang/include/clang/Tooling/AllTUsExecution.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Tooling/Execution.h | 7 | ||||
-rw-r--r-- | clang/include/clang/Tooling/StandaloneExecution.h | 2 | ||||
-rw-r--r-- | clang/unittests/Tooling/ExecutionTest.cpp | 2 |
4 files changed, 13 insertions, 0 deletions
diff --git a/clang/include/clang/Tooling/AllTUsExecution.h b/clang/include/clang/Tooling/AllTUsExecution.h index f199365dc81..ee3843398ed 100644 --- a/clang/include/clang/Tooling/AllTUsExecution.h +++ b/clang/include/clang/Tooling/AllTUsExecution.h @@ -45,6 +45,8 @@ public: StringRef getExecutorName() const override { return ExecutorName; } + bool isSingleProcess() const override { return true; } + using ToolExecutor::execute; llvm::Error diff --git a/clang/include/clang/Tooling/Execution.h b/clang/include/clang/Tooling/Execution.h index 68aef53cb58..7f4b145773e 100644 --- a/clang/include/clang/Tooling/Execution.h +++ b/clang/include/clang/Tooling/Execution.h @@ -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< diff --git a/clang/include/clang/Tooling/StandaloneExecution.h b/clang/include/clang/Tooling/StandaloneExecution.h index 572330e4cc2..d787267b6ca 100644 --- a/clang/include/clang/Tooling/StandaloneExecution.h +++ b/clang/include/clang/Tooling/StandaloneExecution.h @@ -52,6 +52,8 @@ public: StringRef getExecutorName() const override { return ExecutorName; } + bool isSingleProcess() const override { return true; } + using ToolExecutor::execute; llvm::Error diff --git a/clang/unittests/Tooling/ExecutionTest.cpp b/clang/unittests/Tooling/ExecutionTest.cpp index 26db8c6d0ea..e5dc98d228d 100644 --- a/clang/unittests/Tooling/ExecutionTest.cpp +++ b/clang/unittests/Tooling/ExecutionTest.cpp @@ -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 { |