clang API Documentation

Public Member Functions
clang::tooling::ToolInvocation Class Reference

Utility to run a FrontendAction in a single clang invocation. More...

#include <Tooling.h>

List of all members.

Public Member Functions

 ToolInvocation (std::vector< std::string > CommandLine, FrontendAction *FAction, FileManager *Files)
 Create a tool invocation.
 ToolInvocation (std::vector< std::string > CommandLine, ToolAction *Action, FileManager *Files)
 Create a tool invocation.
 ~ToolInvocation ()
void setDiagnosticConsumer (DiagnosticConsumer *DiagConsumer)
 Set a DiagnosticConsumer to use during parsing.
void mapVirtualFile (StringRef FilePath, StringRef Content)
 Map a virtual file to be used while running the tool.
bool run ()
 Run the clang invocation.

Detailed Description

Utility to run a FrontendAction in a single clang invocation.

Definition at line 181 of file Tooling.h.


Constructor & Destructor Documentation

clang::tooling::ToolInvocation::ToolInvocation ( std::vector< std::string >  CommandLine,
FrontendAction FAction,
FileManager Files 
)

Create a tool invocation.

Parameters:
CommandLineThe command line arguments to clang. Note that clang uses its binary name (CommandLine[0]) to locate its builtin headers. Callers have to ensure that they are installed in a compatible location (see clang driver implementation) or mapped in via mapVirtualFile.
FActionThe action to be executed. Class takes ownership.
FilesThe FileManager used for the execution. Class does not take ownership.

Definition at line 176 of file Tooling.cpp.

clang::tooling::ToolInvocation::ToolInvocation ( std::vector< std::string >  CommandLine,
ToolAction Action,
FileManager Files 
)

Create a tool invocation.

Parameters:
CommandLineThe command line arguments to clang.
ActionThe action to be executed.
FilesThe FileManager used for the execution.

Definition at line 168 of file Tooling.cpp.

Definition at line 184 of file Tooling.cpp.


Member Function Documentation

void clang::tooling::ToolInvocation::mapVirtualFile ( StringRef  FilePath,
StringRef  Content 
)

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

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

Definition at line 189 of file Tooling.cpp.

Referenced by clang::tooling::buildASTFromCodeWithArgs(), and clang::tooling::runToolOnCodeWithArgs().

Run the clang invocation.

Returns:
True if there were no errors during execution.

Definition at line 195 of file Tooling.cpp.

References clang::tooling::getCC1Arguments(), Input, clang::tooling::newDriver(), and clang::tooling::newInvocation().

Referenced by clang::tooling::buildASTFromCodeWithArgs().

Set a DiagnosticConsumer to use during parsing.

Definition at line 206 of file Tooling.h.


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