]> granicus.if.org Git - clang/commit
[Tooling] A new framework for executing clang frontend actions.
authorEric Liu <ioeric@google.com>
Thu, 26 Oct 2017 10:38:14 +0000 (10:38 +0000)
committerEric Liu <ioeric@google.com>
Thu, 26 Oct 2017 10:38:14 +0000 (10:38 +0000)
commite7a10639e3b56be55f7fa5bf89d82d7b42e6fe3c
tree9f6ba36aa382414e7c4bdfbc13420e727e0c3a14
parent9bc9ee5d23d2b0b3c18dd86ce6b8aeae0aeb1bde
[Tooling] A new framework for executing clang frontend actions.

Summary:
This defines a `clang::tooling::ToolExecutor` interface that can be extended to support different execution plans including standalone execution on a given set of TUs or parallel execution on all TUs in a codebase.

In order to enable multiprocessing execution, tool actions are expected to output result into a `ToolResults` interface provided by executors. The `ToolResults` interface abstracts how results are stored e.g. in-memory for standalone executions or on-disk for large-scale execution.

New executors can be registered as `ToolExecutorPlugin`s via the `ToolExecutorPluginRegistry`. CLI tools can use `createExecutorFromCommandLineArgs` to create a specific registered executor according to the command-line arguments.

This patch also implements `StandaloneToolExecutor` which has the same behavior as the current `ClangTool` interface, i.e. execute frontend actions on a given set of TUs. At this point, it's simply a wrapper around `ClangTool` at this point.

This is still experimental but expected to replace the existing `ClangTool` interface so that specific tools would not need to worry about execution.

Reviewers: klimek, arphaman, hokein, sammccall

Reviewed By: klimek

Subscribers: cfe-commits, djasper, mgorny, omtcyfz

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316653 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
include/clang/Tooling/CommonOptionsParser.h
include/clang/Tooling/Execution.h [new file with mode: 0644]
include/clang/Tooling/StandaloneExecution.h [new file with mode: 0644]
include/clang/Tooling/ToolExecutorPluginRegistry.h [new file with mode: 0644]
include/clang/Tooling/Tooling.h
lib/Tooling/ArgumentsAdjusters.cpp
lib/Tooling/CMakeLists.txt
lib/Tooling/CommonOptionsParser.cpp
lib/Tooling/Execution.cpp [new file with mode: 0644]
lib/Tooling/StandaloneExecution.cpp [new file with mode: 0644]
lib/Tooling/Tooling.cpp
unittests/Tooling/CMakeLists.txt
unittests/Tooling/ExecutionTest.cpp [new file with mode: 0644]