clang 20.0.0git
Public Member Functions | List of all members
clang::tooling::ToolExecutor Class Referenceabstract

Interface for executing clang frontend actions. More...

#include "clang/Tooling/Execution.h"

Inheritance diagram for clang::tooling::ToolExecutor:
Inheritance graph
[legend]

Public Member Functions

virtual ~ToolExecutor ()
 
virtual StringRef getExecutorName () const =0
 Returns the name of a specific executor.
 
virtual llvm::Error execute (llvm::ArrayRef< std::pair< std::unique_ptr< FrontendActionFactory >, ArgumentsAdjuster > > Actions)=0
 Executes each action with a corresponding arguments adjuster.
 
llvm::Error execute (std::unique_ptr< FrontendActionFactory > Action)
 Convenient functions for the above execute.
 
llvm::Error execute (std::unique_ptr< FrontendActionFactory > Action, ArgumentsAdjuster Adjuster)
 Executes an action with an argument adjuster.
 
virtual ExecutionContextgetExecutionContext ()=0
 Returns a reference to the execution context.
 
virtual ToolResultsgetToolResults ()=0
 Returns a reference to the result container.
 
virtual void mapVirtualFile (StringRef FilePath, StringRef Content)=0
 Map a virtual file to be used while running the tool.
 

Detailed 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.

Definition at line 111 of file Execution.h.

Constructor & Destructor Documentation

◆ ~ToolExecutor()

virtual clang::tooling::ToolExecutor::~ToolExecutor ( )
inlinevirtual

Definition at line 113 of file Execution.h.

Member Function Documentation

◆ execute() [1/3]

virtual llvm::Error clang::tooling::ToolExecutor::execute ( llvm::ArrayRef< std::pair< std::unique_ptr< FrontendActionFactory >, ArgumentsAdjuster > >  Actions)
pure virtual

Executes each action with a corresponding arguments adjuster.

Implemented in clang::tooling::AllTUsToolExecutor, clang::tooling::StandaloneToolExecutor, clang::tooling::AllTUsToolExecutor, and clang::tooling::StandaloneToolExecutor.

Referenced by execute().

◆ execute() [2/3]

llvm::Error clang::tooling::ToolExecutor::execute ( std::unique_ptr< FrontendActionFactory Action)

Convenient functions for the above execute.

Definition at line 43 of file Execution.cpp.

References execute().

◆ execute() [3/3]

llvm::Error clang::tooling::ToolExecutor::execute ( std::unique_ptr< FrontendActionFactory Action,
ArgumentsAdjuster  Adjuster 
)

Executes an action with an argument adjuster.

Definition at line 47 of file Execution.cpp.

References execute().

◆ getExecutionContext()

virtual ExecutionContext * clang::tooling::ToolExecutor::getExecutionContext ( )
pure virtual

Returns a reference to the execution context.

This should be passed to tool callbacks, and tool callbacks should report results via the returned context.

Implemented in clang::tooling::AllTUsToolExecutor, and clang::tooling::StandaloneToolExecutor.

◆ getExecutorName()

virtual StringRef clang::tooling::ToolExecutor::getExecutorName ( ) const
pure virtual

Returns the name of a specific executor.

Implemented in clang::tooling::AllTUsToolExecutor, and clang::tooling::StandaloneToolExecutor.

◆ getToolResults()

virtual ToolResults * clang::tooling::ToolExecutor::getToolResults ( )
pure virtual

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.

Implemented in clang::tooling::AllTUsToolExecutor, and clang::tooling::StandaloneToolExecutor.

◆ mapVirtualFile()

virtual void clang::tooling::ToolExecutor::mapVirtualFile ( StringRef  FilePath,
StringRef  Content 
)
pure virtual

Map a virtual file to be used while running the tool.

Parameters
FilePathThe path at which the content will be mapped.
ContentA buffer of the file's content.

Implemented in clang::tooling::AllTUsToolExecutor, and clang::tooling::StandaloneToolExecutor.


The documentation for this class was generated from the following files: