class WrapperFrontendAction

Declaration

class WrapperFrontendAction : public FrontendAction { /* full declaration omitted */ };

Description

A frontend action which simply wraps some other runtime-specified frontend action. Deriving from this class allows an action to inject custom logic around some existing action's behavior. It implements every virtual method in the FrontendAction interface by forwarding to the wrapped action.

Declared at: clang/include/clang/Frontend/FrontendAction.h:305

Inherits from: FrontendAction

Member Variables

protected std::unique_ptr<FrontendAction> WrappedAction

Method Overview

Inherited from FrontendAction:

Methods

bool BeginInvocation(clang::CompilerInstance& CI)

Description

Callback before starting processing a single input, giving the opportunity to modify the CompilerInvocation or do some other action before BeginSourceFileAction is called.

Declared at: clang/include/clang/Frontend/FrontendAction.h:312

Parameters

clang::CompilerInstance& CI

Returns

True on success; on failure BeginSourceFileAction(), ExecuteAction() and EndSourceFileAction() will not be called.

bool BeginSourceFileAction(
    clang::CompilerInstance& CI)

Description

Callback at the start of processing a single input.

Declared at: clang/include/clang/Frontend/FrontendAction.h:313

Parameters

clang::CompilerInstance& CI

Returns

True on success; on failure ExecutionAction() and EndSourceFileAction() will not be called.

std::unique_ptr<ASTConsumer> CreateASTConsumer(
    clang::CompilerInstance& CI,
    llvm::StringRef InFile)

Description

Create the AST consumer object for this action, if supported. This routine is called as part of BeginSourceFile(), which will fail if the AST consumer cannot be created. This will not be called if the action has indicated that it only uses the preprocessor.

Declared at: clang/include/clang/Frontend/FrontendAction.h:310

Parameters

clang::CompilerInstance& CI
- The current compiler instance, provided as a convenience, see getCompilerInstance().
llvm::StringRef InFile
- The current input file, provided as a convenience, see getCurrentFile().

Returns

The new AST consumer, or null on failure.

void EndSourceFile()

Description

Perform any per-file post processing, deallocate per-file objects, and run statistics and output file cleanup code.

Declared at: clang/include/clang/Frontend/FrontendAction.h:315

void EndSourceFileAction()

Description

Callback at the end of processing a single input. This is guaranteed to only be called following a successful call to BeginSourceFileAction (and BeginSourceFile).

Declared at: clang/include/clang/Frontend/FrontendAction.h:316

void ExecuteAction()

Description

Callback to run the program action, using the initialized compiler instance. This is guaranteed to only be called between BeginSourceFileAction() and EndSourceFileAction().

Declared at: clang/include/clang/Frontend/FrontendAction.h:314

bool PrepareToExecuteAction(
    clang::CompilerInstance& CI)

Description

Prepare to execute the action on the given CompilerInstance. This is called before executing the action on any inputs, and can modify the configuration as needed (including adjusting the input list).

Declared at: clang/include/clang/Frontend/FrontendAction.h:309

Parameters

clang::CompilerInstance& CI

WrapperFrontendAction(
    std::unique_ptr<FrontendAction> WrappedAction)

Description

Construct a WrapperFrontendAction from an existing action, taking ownership of it.

Declared at: clang/include/clang/Frontend/FrontendAction.h:322

Parameters

std::unique_ptr<FrontendAction> WrappedAction

clang::TranslationUnitKind
getTranslationUnitKind()

Description

For AST-based actions, the kind of translation unit we're handling.

Declared at: clang/include/clang/Frontend/FrontendAction.h:325

bool hasASTFileSupport() const

Description

Does this action support use with AST files?

Declared at: clang/include/clang/Frontend/FrontendAction.h:327

bool hasCodeCompletionSupport() const

Description

Does this action support use with code completion?

Declared at: clang/include/clang/Frontend/FrontendAction.h:329

bool hasIRSupport() const

Description

Does this action support use with IR files?

Declared at: clang/include/clang/Frontend/FrontendAction.h:328

bool hasPCHSupport() const

Description

Does this action support use with PCH?

Declared at: clang/include/clang/Frontend/FrontendAction.h:326

bool shouldEraseOutputFiles()

Description

Callback at the end of processing a single input, to determine if the output files should be erased or not. By default it returns true if a compiler error occurred. This is guaranteed to only be called following a successful call to BeginSourceFileAction (and BeginSourceFile).

Declared at: clang/include/clang/Frontend/FrontendAction.h:317

bool usesPreprocessorOnly() const

Description

Does this action only use the preprocessor? If so no AST context will be created and this action will be invalid with AST file inputs.

Declared at: clang/include/clang/Frontend/FrontendAction.h:324