Author: ibiryukov Date: Fri Aug 24 02:03:29 2018 New Revision: 340599 URL: http://llvm.org/viewvc/llvm-project?rev=340599&view=rev Log: [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 Modified: cfe/trunk/include/clang/Tooling/AllTUsExecution.h cfe/trunk/include/clang/Tooling/Execution.h cfe/trunk/include/clang/Tooling/StandaloneExecution.h cfe/trunk/unittests/Tooling/ExecutionTest.cpp Modified: cfe/trunk/include/clang/Tooling/AllTUsExecution.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/AllTUsExecution.h?rev=340599&r1=340598&r2=340599&view=diff ============================================================================== --- cfe/trunk/include/clang/Tooling/AllTUsExecution.h (original) +++ cfe/trunk/include/clang/Tooling/AllTUsExecution.h Fri Aug 24 02:03:29 2018 @@ -45,6 +45,8 @@ public: StringRef getExecutorName() const override { return ExecutorName; } + bool isSingleProcess() const override { return true; } + using ToolExecutor::execute; llvm::Error Modified: cfe/trunk/include/clang/Tooling/Execution.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Execution.h?rev=340599&r1=340598&r2=340599&view=diff ============================================================================== --- cfe/trunk/include/clang/Tooling/Execution.h (original) +++ cfe/trunk/include/clang/Tooling/Execution.h Fri Aug 24 02:03:29 2018 @@ -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< Modified: cfe/trunk/include/clang/Tooling/StandaloneExecution.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/StandaloneExecution.h?rev=340599&r1=340598&r2=340599&view=diff ============================================================================== --- cfe/trunk/include/clang/Tooling/StandaloneExecution.h (original) +++ cfe/trunk/include/clang/Tooling/StandaloneExecution.h Fri Aug 24 02:03:29 2018 @@ -52,6 +52,8 @@ public: StringRef getExecutorName() const override { return ExecutorName; } + bool isSingleProcess() const override { return true; } + using ToolExecutor::execute; llvm::Error Modified: cfe/trunk/unittests/Tooling/ExecutionTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/ExecutionTest.cpp?rev=340599&r1=340598&r2=340599&view=diff ============================================================================== --- cfe/trunk/unittests/Tooling/ExecutionTest.cpp (original) +++ cfe/trunk/unittests/Tooling/ExecutionTest.cpp Fri Aug 24 02:03:29 2018 @@ -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 { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits