clang
9.0.0
|
Executes given frontend actions on all files/TUs in the compilation database. More...
#include "clang/Tooling/AllTUsExecution.h"
Public Member Functions | |
AllTUsToolExecutor (const CompilationDatabase &Compilations, unsigned ThreadCount, std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >()) | |
Init with CompilationDatabase . More... | |
AllTUsToolExecutor (CommonOptionsParser Options, unsigned ThreadCount, std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >()) | |
Init with CommonOptionsParser . More... | |
StringRef | getExecutorName () const override |
Returns the name of a specific executor. More... | |
bool | isSingleProcess () const override |
Should return true iff executor runs all actions in a single process. More... | |
llvm::Error | execute (llvm::ArrayRef< std::pair< std::unique_ptr< FrontendActionFactory >, ArgumentsAdjuster >> Actions) override |
Executes each action with a corresponding arguments adjuster. More... | |
ExecutionContext * | getExecutionContext () override |
Returns a reference to the execution context. More... | |
ToolResults * | getToolResults () override |
Returns a reference to the result container. More... | |
void | mapVirtualFile (StringRef FilePath, StringRef Content) override |
Map a virtual file to be used while running the tool. More... | |
![]() | |
virtual | ~ToolExecutor () |
llvm::Error | execute (std::unique_ptr< FrontendActionFactory > Action) |
Convenient functions for the above execute . More... | |
llvm::Error | execute (std::unique_ptr< FrontendActionFactory > Action, ArgumentsAdjuster Adjuster) |
Executes an action with an argument adjuster. More... | |
Static Public Attributes | |
static const char * | ExecutorName = "AllTUsToolExecutor" |
Executes given frontend actions on all files/TUs in the compilation database.
Definition at line 25 of file AllTUsExecution.h.
clang::tooling::AllTUsToolExecutor::AllTUsToolExecutor | ( | const CompilationDatabase & | Compilations, |
unsigned | ThreadCount, | ||
std::shared_ptr< PCHContainerOperations > | PCHContainerOps = std::make_shared<PCHContainerOperations>() |
||
) |
Init with CompilationDatabase
.
This uses ThreadCount
threads to exececute the actions on all files in parallel. If ThreadCount
is 0, this uses llvm::hardware_concurrency
.
Definition at line 62 of file AllTUsExecution.cpp.
clang::tooling::AllTUsToolExecutor::AllTUsToolExecutor | ( | CommonOptionsParser | Options, |
unsigned | ThreadCount, | ||
std::shared_ptr< PCHContainerOperations > | PCHContainerOps = std::make_shared<PCHContainerOperations>() |
||
) |
Init with CommonOptionsParser
.
This is expected to be used by createExecutorFromCommandLineArgs
based on commandline options.
The executor takes ownership of Options
.
Definition at line 68 of file AllTUsExecution.cpp.
|
overridevirtual |
Executes each action with a corresponding arguments adjuster.
Implements clang::tooling::ToolExecutor.
Definition at line 76 of file AllTUsExecution.cpp.
References clang::tooling::ClangTool::appendArgumentsAdjuster(), clang::tooling::ExecutorConcurrency(), clang::tooling::Filter, clang::tooling::CompilationDatabase::getAllFiles(), clang::tooling::getDefaultArgumentsAdjusters(), clang::tooling::make_string_error(), clang::tooling::ClangTool::mapVirtualFile(), and clang::tooling::ClangTool::run().
Referenced by isSingleProcess().
|
inlineoverridevirtual |
Returns a reference to the execution context.
This should be passed to tool callbacks, and tool callbacks should report results via the returned context.
Implements clang::tooling::ToolExecutor.
Definition at line 56 of file AllTUsExecution.h.
|
inlineoverridevirtual |
Returns the name of a specific executor.
Implements clang::tooling::ToolExecutor.
Definition at line 45 of file AllTUsExecution.h.
References ExecutorName.
|
inlineoverridevirtual |
Returns a reference to the result container.
NOTE: This should only be used after the execution finishes. Tool callbacks should report results via ExecutionContext
instead.
Implements clang::tooling::ToolExecutor.
Definition at line 58 of file AllTUsExecution.h.
|
inlineoverridevirtual |
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.
Implements clang::tooling::ToolExecutor.
Definition at line 47 of file AllTUsExecution.h.
References clang::Error, execute(), and clang::tooling::ToolExecutor::execute().
|
inlineoverridevirtual |
Map a virtual file to be used while running the tool.
FilePath | The path at which the content will be mapped. |
Content | A buffer of the file's content. |
Implements clang::tooling::ToolExecutor.
Definition at line 60 of file AllTUsExecution.h.
References clang::tooling::Filter.
|
static |
Definition at line 27 of file AllTUsExecution.h.
Referenced by getExecutorName().