clang  8.0.0svn
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]
Collaboration diagram for clang::tooling::AllTUsToolExecutor:
Collaboration graph
[legend]

Public Member Functions

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

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

Member Function Documentation

◆ execute()

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

◆ 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 57 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 59 of file AllTUsExecution.h.

◆ isSingleProcess()

bool clang::tooling::AllTUsToolExecutor::isSingleProcess ( ) const
inlineoverridevirtual

Should return true iff executor runs all actions in a single process.

Clients can use this signal to find out if they can collect results in-memory (e.g. to avoid serialization costs of using ToolResults). The single-process executors can still run multiple threads, but all executions are guaranteed to share the same memory.

Implements clang::tooling::ToolExecutor.

Definition at line 48 of file AllTUsExecution.h.

References clang::Error, execute(), and clang::tooling::ToolExecutor::execute().

◆ 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 61 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: