clang  6.0.0svn
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. More...
 
virtual llvm::Error execute (llvm::ArrayRef< std::pair< std::unique_ptr< FrontendActionFactory >, ArgumentsAdjuster >> Actions)=0
 Executes each action with a corresponding arguments adjuster. More...
 
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...
 
virtual ExecutionContextgetExecutionContext ()=0
 Returns a reference to the execution context. More...
 
virtual ToolResultsgetToolResults ()=0
 Returns a reference to the result container. More...
 
virtual void mapVirtualFile (StringRef FilePath, StringRef Content)=0
 Map a virtual file to be used while running the tool. More...
 

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 100 of file Execution.h.

Constructor & Destructor Documentation

◆ ~ToolExecutor()

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

Definition at line 102 of file Execution.h.

References clang::Error.

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::StandaloneToolExecutor.

Referenced by clang::tooling::StandaloneToolExecutor::getExecutorName().

◆ execute() [2/3]

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

Convenient functions for the above execute.

Definition at line 44 of file Execution.cpp.

◆ 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 48 of file Execution.cpp.

◆ 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::StandaloneToolExecutor.

◆ getExecutorName()

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

Returns the name of a specific executor.

Implemented in 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::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::StandaloneToolExecutor.


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