class ToolExecutor
Declaration
class ToolExecutor { /* full declaration omitted */ };
Description
Interface for executing clang frontend actions. This can be extended to support running tool actions in different execution mode, e.g. on a specific set of TUs or many TUs in parallel. New executors can be registered as ToolExecutorPlugins via the `ToolExecutorPluginRegistry`. CLI tools can use `createExecutorFromCommandLineArgs` to create a specific registered executor according to the command-line arguments.
Declared at: clang/include/clang/Tooling/Execution.h:111
Method Overview
- public virtual llvm::Error execute(llvm::ArrayRef<std::pair<std::unique_ptr<FrontendActionFactory>, ArgumentsAdjuster>> Actions)
- public llvm::Error execute(std::unique_ptr<FrontendActionFactory> Action)
- public llvm::Error execute(std::unique_ptr<FrontendActionFactory> Action, clang::tooling::ArgumentsAdjuster Adjuster)
- public virtual clang::tooling::ExecutionContext * getExecutionContext()
- public virtual llvm::StringRef getExecutorName() const
- public virtual clang::tooling::ToolResults * getToolResults()
- public virtual void mapVirtualFile(llvm::StringRef FilePath, llvm::StringRef Content)
- public virtual ~ToolExecutor()
Methods
¶virtual llvm::Error execute(
llvm::ArrayRef<std::pair<
std::unique_ptr<FrontendActionFactory>,
ArgumentsAdjuster>> Actions)
virtual llvm::Error execute(
llvm::ArrayRef<std::pair<
std::unique_ptr<FrontendActionFactory>,
ArgumentsAdjuster>> Actions)
Description
Executes each action with a corresponding arguments adjuster.
Declared at: clang/include/clang/Tooling/Execution.h:120
Parameters
- llvm::ArrayRef<std::pair< std::unique_ptr<FrontendActionFactory>, ArgumentsAdjuster>> Actions
¶llvm::Error execute(
std::unique_ptr<FrontendActionFactory> Action)
llvm::Error execute(
std::unique_ptr<FrontendActionFactory> Action)
Description
Convenient functions for the above `execute`.
Declared at: clang/include/clang/Tooling/Execution.h:125
Parameters
- std::unique_ptr<FrontendActionFactory> Action
¶llvm::Error execute(
std::unique_ptr<FrontendActionFactory> Action,
clang::tooling::ArgumentsAdjuster Adjuster)
llvm::Error execute(
std::unique_ptr<FrontendActionFactory> Action,
clang::tooling::ArgumentsAdjuster Adjuster)
Description
Executes an action with an argument adjuster.
Declared at: clang/include/clang/Tooling/Execution.h:127
Parameters
- std::unique_ptr<FrontendActionFactory> Action
- clang::tooling::ArgumentsAdjuster Adjuster
¶virtual clang::tooling::ExecutionContext*
getExecutionContext()
virtual clang::tooling::ExecutionContext*
getExecutionContext()
Description
Returns a reference to the execution context. This should be passed to tool callbacks, and tool callbacks should report results via the returned context.
Declared at: clang/include/clang/Tooling/Execution.h:134
¶virtual llvm::StringRef getExecutorName() const
virtual llvm::StringRef getExecutorName() const
Description
Returns the name of a specific executor.
Declared at: clang/include/clang/Tooling/Execution.h:116
¶virtual clang::tooling::ToolResults*
getToolResults()
virtual clang::tooling::ToolResults*
getToolResults()
Description
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.
Declared at: clang/include/clang/Tooling/Execution.h:140
¶virtual void mapVirtualFile(
llvm::StringRef FilePath,
llvm::StringRef Content)
virtual void mapVirtualFile(
llvm::StringRef FilePath,
llvm::StringRef Content)
Description
Map a virtual file to be used while running the tool.
Declared at: clang/include/clang/Tooling/Execution.h:146
Parameters
- llvm::StringRef FilePath
- The path at which the content will be mapped.
- llvm::StringRef Content
- A buffer of the file's content.
¶virtual ~ToolExecutor()
virtual ~ToolExecutor()
Declared at: clang/include/clang/Tooling/Execution.h:113