clang 20.0.0git
Public Member Functions | Static Public Attributes | List of all members
clang::tooling::AllTUsToolExecutor Class Reference

Executes given frontend actions on all files/TUs in the compilation database. More...

#include "clang/Tooling/AllTUsExecution.h"

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

Public Member Functions

 AllTUsToolExecutor (const CompilationDatabase &Compilations, unsigned ThreadCount, std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >())
 Init with CompilationDatabase.
 
 AllTUsToolExecutor (CommonOptionsParser Options, unsigned ThreadCount, std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >())
 Init with CommonOptionsParser.
 
StringRef getExecutorName () const override
 Returns the name of a specific executor.
 
llvm::Error execute (llvm::ArrayRef< std::pair< std::unique_ptr< FrontendActionFactory >, ArgumentsAdjuster > > Actions) override
 Executes each action with a corresponding arguments adjuster.
 
ExecutionContextgetExecutionContext () override
 Returns a reference to the execution context.
 
ToolResultsgetToolResults () override
 Returns a reference to the result container.
 
void mapVirtualFile (StringRef FilePath, StringRef Content) override
 Map a virtual file to be used while running the tool.
 
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.
 
- Public Member Functions inherited from clang::tooling::ToolExecutor
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.
 

Static Public Attributes

static const char * ExecutorName = "AllTUsToolExecutor"
 

Detailed Description

Executes given frontend actions on all files/TUs in the compilation database.

Definition at line 26 of file AllTUsExecution.h.

Constructor & Destructor Documentation

◆ AllTUsToolExecutor() [1/2]

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 64 of file AllTUsExecution.cpp.

◆ AllTUsToolExecutor() [2/2]

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 70 of file AllTUsExecution.cpp.

Member Function Documentation

◆ execute() [1/4]

llvm::Error clang::tooling::AllTUsToolExecutor::execute ( llvm::ArrayRef< std::pair< std::unique_ptr< FrontendActionFactory >, ArgumentsAdjuster > >  Actions)
overridevirtual

◆ execute() [2/4]

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

Executes each action with a corresponding arguments adjuster.

Implements clang::tooling::ToolExecutor.

◆ execute() [3/4]

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

Convenient functions for the above execute.

Definition at line 125 of file Execution.cpp.

◆ execute() [4/4]

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

Executes an action with an argument adjuster.

Definition at line 127 of file Execution.cpp.

◆ getExecutionContext()

ExecutionContext * clang::tooling::AllTUsToolExecutor::getExecutionContext ( )
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 55 of file AllTUsExecution.h.

◆ getExecutorName()

StringRef clang::tooling::AllTUsToolExecutor::getExecutorName ( ) const
inlineoverridevirtual

Returns the name of a specific executor.

Implements clang::tooling::ToolExecutor.

Definition at line 46 of file AllTUsExecution.h.

References ExecutorName.

◆ getToolResults()

ToolResults * clang::tooling::AllTUsToolExecutor::getToolResults ( )
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 57 of file AllTUsExecution.h.

◆ mapVirtualFile()

void clang::tooling::AllTUsToolExecutor::mapVirtualFile ( StringRef  FilePath,
StringRef  Content 
)
inlineoverridevirtual

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.

Implements clang::tooling::ToolExecutor.

Definition at line 59 of file AllTUsExecution.h.

Member Data Documentation

◆ ExecutorName

const char * clang::tooling::AllTUsToolExecutor::ExecutorName = "AllTUsToolExecutor"
static

Definition at line 28 of file AllTUsExecution.h.

Referenced by getExecutorName().


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