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
- protected bool BeginInvocation(clang::CompilerInstance & CI)
- protected bool BeginSourceFileAction(clang::CompilerInstance & CI)
- protected std::unique_ptr<ASTConsumer> CreateASTConsumer(clang::CompilerInstance & CI, llvm::StringRef InFile)
- protected void EndSourceFile()
- protected void EndSourceFileAction()
- protected void ExecuteAction()
- protected bool PrepareToExecuteAction(clang::CompilerInstance & CI)
- public WrapperFrontendAction(std::unique_ptr<FrontendAction> WrappedAction)
- public clang::TranslationUnitKind getTranslationUnitKind()
- public bool hasASTFileSupport() const
- public bool hasCodeCompletionSupport() const
- public bool hasIRSupport() const
- public bool hasPCHSupport() const
- protected bool shouldEraseOutputFiles()
- public bool usesPreprocessorOnly() const
Inherited from FrontendAction:
- protected BeginInvocation
- public BeginSourceFile
- protected BeginSourceFileAction
- protected CreateASTConsumer
- public EndSourceFile
- protected EndSourceFileAction
- public Execute
- protected ExecuteAction
- public PrepareToExecute
- protected PrepareToExecuteAction
- public getCompilerInstance
- public getCurrentASTUnit
- public getCurrentFile
- public getCurrentFileKind
- public getCurrentFileOrBufferName
- public getCurrentInput
- public getCurrentModule
- public getTranslationUnitKind
- public hasASTFileSupport
- public hasCodeCompletionSupport
- public hasIRSupport
- public hasPCHSupport
- public isCurrentFileAST
- public isModelParsingAction
- public setCompilerInstance
- public setCurrentInput
- protected shouldEraseOutputFiles
- public takeCurrentASTUnit
- public usesPreprocessorOnly
Methods
¶bool BeginInvocation(clang::CompilerInstance& CI)
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
Returns
True on success; on failure BeginSourceFileAction(), ExecuteAction() and EndSourceFileAction() will not be called.
¶bool BeginSourceFileAction(
clang::CompilerInstance& CI)
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
Returns
True on success; on failure ExecutionAction() and EndSourceFileAction() will not be called.
¶std::unique_ptr<ASTConsumer> CreateASTConsumer(
clang::CompilerInstance& CI,
llvm::StringRef InFile)
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()
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()
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()
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)
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
¶WrapperFrontendAction(
std::unique_ptr<FrontendAction> WrappedAction)
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()
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
bool hasASTFileSupport() const
Description
Does this action support use with AST files?
Declared at: clang/include/clang/Frontend/FrontendAction.h:327
¶bool hasCodeCompletionSupport() const
bool hasCodeCompletionSupport() const
Description
Does this action support use with code completion?
Declared at: clang/include/clang/Frontend/FrontendAction.h:329
¶bool hasIRSupport() const
bool hasIRSupport() const
Description
Does this action support use with IR files?
Declared at: clang/include/clang/Frontend/FrontendAction.h:328
¶bool hasPCHSupport() const
bool hasPCHSupport() const
Description
Does this action support use with PCH?
Declared at: clang/include/clang/Frontend/FrontendAction.h:326
¶bool shouldEraseOutputFiles()
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
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