clang 20.0.0git
|
A standalone executor that runs FrontendActions on a given set of TUs in sequence. More...
#include "clang/Tooling/StandaloneExecution.h"
Public Member Functions | |
StandaloneToolExecutor (const CompilationDatabase &Compilations, llvm::ArrayRef< std::string > SourcePaths, IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS=llvm::vfs::getRealFileSystem(), std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >()) | |
Init with CompilationDatabase and the paths of all files to be proccessed. | |
StandaloneToolExecutor (CommonOptionsParser Options, 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. | |
void | setDiagnosticConsumer (DiagnosticConsumer *DiagConsumer) |
Set a DiagnosticConsumer to use during parsing. | |
ExecutionContext * | getExecutionContext () override |
Returns a reference to the execution context. | |
ToolResults * | getToolResults () override |
Returns a reference to the result container. | |
llvm::ArrayRef< std::string > | getSourcePaths () const |
void | mapVirtualFile (StringRef FilePath, StringRef Content) override |
Map a virtual file to be used while running the tool. | |
FileManager & | getFiles () |
Returns the file manager used in 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 ExecutionContext * | getExecutionContext ()=0 |
Returns a reference to the execution context. | |
virtual ToolResults * | getToolResults ()=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 = "StandaloneToolExecutor" |
A standalone executor that runs FrontendActions on a given set of TUs in sequence.
By default, this executor uses the following arguments adjusters (as defined in clang/Tooling/ArgumentsAdjusters.h
):
Definition at line 31 of file StandaloneExecution.h.
clang::tooling::StandaloneToolExecutor::StandaloneToolExecutor | ( | const CompilationDatabase & | Compilations, |
llvm::ArrayRef< std::string > | SourcePaths, | ||
IntrusiveRefCntPtr< llvm::vfs::FileSystem > | BaseFS = llvm::vfs::getRealFileSystem() , |
||
std::shared_ptr< PCHContainerOperations > | PCHContainerOps = std::make_shared<PCHContainerOperations>() |
||
) |
Init with CompilationDatabase
and the paths of all files to be proccessed.
Definition at line 29 of file StandaloneExecution.cpp.
References clang::tooling::ClangTool::clearArgumentsAdjusters().
clang::tooling::StandaloneToolExecutor::StandaloneToolExecutor | ( | CommonOptionsParser | Options, |
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 42 of file StandaloneExecution.cpp.
References clang::tooling::ClangTool::clearArgumentsAdjusters().
|
overridevirtual |
Executes each action with a corresponding arguments adjuster.
Implements clang::tooling::ToolExecutor.
Definition at line 52 of file StandaloneExecution.cpp.
References clang::tooling::ClangTool::appendArgumentsAdjuster(), clang::tooling::make_string_error(), and clang::tooling::ClangTool::run().
|
virtual |
Executes each action with a corresponding arguments adjuster.
Implements clang::tooling::ToolExecutor.
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.
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.
|
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 68 of file StandaloneExecution.h.
|
inlineoverridevirtual |
Returns the name of a specific executor.
Implements clang::tooling::ToolExecutor.
Definition at line 54 of file StandaloneExecution.h.
References ExecutorName.
|
inline |
Returns the file manager used in the tool.
The file manager is shared between all translation units.
Definition at line 83 of file StandaloneExecution.h.
References clang::tooling::ClangTool::getFiles().
|
inline |
Definition at line 72 of file StandaloneExecution.h.
References clang::tooling::ClangTool::getSourcePaths().
|
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 70 of file StandaloneExecution.h.
|
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 76 of file StandaloneExecution.h.
References clang::tooling::ClangTool::mapVirtualFile().
|
inline |
Set a DiagnosticConsumer
to use during parsing.
Definition at line 64 of file StandaloneExecution.h.
References clang::tooling::ClangTool::setDiagnosticConsumer().
|
static |
Definition at line 33 of file StandaloneExecution.h.
Referenced by getExecutorName().