clang 19.0.0git
Public Member Functions | List of all members
clang::PreambleCallbacks Class Reference

A set of callbacks to gather useful information while building a preamble. More...

#include "clang/Frontend/PrecompiledPreamble.h"

Public Member Functions

virtual ~PreambleCallbacks ()=default
 
virtual void BeforeExecute (CompilerInstance &CI)
 Called before FrontendAction::Execute.
 
virtual void AfterExecute (CompilerInstance &CI)
 Called after FrontendAction::Execute(), but before FrontendAction::EndSourceFile().
 
virtual void AfterPCHEmitted (ASTWriter &Writer)
 Called after PCH has been emitted.
 
virtual void HandleTopLevelDecl (DeclGroupRef DG)
 Called for each TopLevelDecl.
 
virtual std::unique_ptr< PPCallbackscreatePPCallbacks ()
 Creates wrapper class for PPCallbacks so we can also process information about includes that are inside of a preamble.
 
virtual CommentHandlergetCommentHandler ()
 The returned CommentHandler will be added to the preprocessor if not null.
 
virtual bool shouldSkipFunctionBody (Decl *D)
 Determines which function bodies are parsed, by default skips everything.
 

Detailed Description

A set of callbacks to gather useful information while building a preamble.

Definition at line 211 of file PrecompiledPreamble.h.

Constructor & Destructor Documentation

◆ ~PreambleCallbacks()

virtual clang::PreambleCallbacks::~PreambleCallbacks ( )
virtualdefault

Member Function Documentation

◆ AfterExecute()

void PreambleCallbacks::AfterExecute ( CompilerInstance CI)
virtual

Called after FrontendAction::Execute(), but before FrontendAction::EndSourceFile().

Can be used to transfer ownership of various CompilerInstance fields before they are destroyed.

Definition at line 825 of file PrecompiledPreamble.cpp.

Referenced by clang::PrecompiledPreamble::Build().

◆ AfterPCHEmitted()

void PreambleCallbacks::AfterPCHEmitted ( ASTWriter Writer)
virtual

Called after PCH has been emitted.

Writer may be used to retrieve information about AST, serialized in PCH.

Definition at line 826 of file PrecompiledPreamble.cpp.

◆ BeforeExecute()

void PreambleCallbacks::BeforeExecute ( CompilerInstance CI)
virtual

Called before FrontendAction::Execute.

Can be used to store references to various CompilerInstance fields (e.g. SourceManager) that may be interesting to the consumers of other callbacks.

Definition at line 824 of file PrecompiledPreamble.cpp.

Referenced by clang::PrecompiledPreamble::Build().

◆ createPPCallbacks()

std::unique_ptr< PPCallbacks > PreambleCallbacks::createPPCallbacks ( )
virtual

Creates wrapper class for PPCallbacks so we can also process information about includes that are inside of a preamble.

Called after BeforeExecute.

Definition at line 828 of file PrecompiledPreamble.cpp.

Referenced by clang::PrecompiledPreamble::Build().

◆ getCommentHandler()

CommentHandler * PreambleCallbacks::getCommentHandler ( )
virtual

The returned CommentHandler will be added to the preprocessor if not null.

Definition at line 831 of file PrecompiledPreamble.cpp.

Referenced by clang::PrecompiledPreamble::Build().

◆ HandleTopLevelDecl()

void PreambleCallbacks::HandleTopLevelDecl ( DeclGroupRef  DG)
virtual

Called for each TopLevelDecl.

NOTE: To allow more flexibility a custom ASTConsumer could probably be used instead, but having only this method allows a simpler API.

Definition at line 827 of file PrecompiledPreamble.cpp.

◆ shouldSkipFunctionBody()

virtual bool clang::PreambleCallbacks::shouldSkipFunctionBody ( Decl D)
inlinevirtual

Determines which function bodies are parsed, by default skips everything.

Only used if FrontendOpts::SkipFunctionBodies is true. See ASTConsumer::shouldSkipFunctionBody.

Definition at line 239 of file PrecompiledPreamble.h.


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