clang 22.0.0git
clang::PCHGenerator Class Reference

AST and semantic-analysis consumer that generates a precompiled header from the parsed source code. More...

#include "clang/Serialization/ASTWriter.h"

Inheritance diagram for clang::PCHGenerator:
[legend]

Public Member Functions

 PCHGenerator (Preprocessor &PP, ModuleCache &ModCache, StringRef OutputFile, StringRef isysroot, std::shared_ptr< PCHBuffer > Buffer, const CodeGenOptions &CodeGenOpts, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, bool AllowASTWithErrors=false, bool IncludeTimestamps=true, bool BuildingImplicitModule=false, bool ShouldCacheASTInMemory=false, bool GeneratingReducedBMI=false)
 ~PCHGenerator () override
void InitializeSema (Sema &S) override
 Initialize the semantic consumer with the Sema instance being used to perform semantic analysis on the abstract syntax tree.
void HandleTranslationUnit (ASTContext &Ctx) override
 HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been parsed.
void HandleVTable (CXXRecordDecl *RD) override
 Callback involved at the end of a translation unit to notify the consumer that a vtable for the given C++ class is required.
ASTMutationListenerGetASTMutationListener () override
 If the consumer is interested in entities getting modified after their initial creation, it should return a pointer to an ASTMutationListener here.
ASTDeserializationListenerGetASTDeserializationListener () override
 If the consumer is interested in entities being deserialized from AST files, it should return a pointer to a ASTDeserializationListener here.
bool hasEmittedPCH () const
Public Member Functions inherited from clang::SemaConsumer
 SemaConsumer ()
virtual void ForgetSema ()
 Inform the semantic consumer that Sema is no longer available.
Public Member Functions inherited from clang::ASTConsumer
 ASTConsumer ()=default
virtual ~ASTConsumer ()
virtual void Initialize (ASTContext &Context)
 Initialize - This is called to initialize the consumer, providing the ASTContext.
virtual bool HandleTopLevelDecl (DeclGroupRef D)
 HandleTopLevelDecl - Handle the specified top-level declaration.
virtual void HandleInlineFunctionDefinition (FunctionDecl *D)
 This callback is invoked each time an inline (method or friend) function definition in a class is completed.
virtual void HandleInterestingDecl (DeclGroupRef D)
 HandleInterestingDecl - Handle the specified interesting declaration.
virtual void HandleTagDeclDefinition (TagDecl *D)
 HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g.
virtual void HandleTagDeclRequiredDefinition (const TagDecl *D)
 This callback is invoked the first time each TagDecl is required to be complete.
virtual void HandleCXXImplicitFunctionInstantiation (FunctionDecl *D)
 Invoked when a function is implicitly instantiated.
virtual void HandleTopLevelDeclInObjCContainer (DeclGroupRef D)
 Handle the specified top-level declaration that occurred inside and ObjC container.
virtual void HandleImplicitImportDecl (ImportDecl *D)
 Handle an ImportDecl that was implicitly created due to an inclusion directive.
virtual void CompleteTentativeDefinition (VarDecl *D)
 CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consumer that the given tentative definition should be completed.
virtual void CompleteExternalDeclaration (DeclaratorDecl *D)
 CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consumer that the given external declaration should be completed.
virtual void AssignInheritanceModel (CXXRecordDecl *RD)
 Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
virtual void HandleCXXStaticMemberVarInstantiation (VarDecl *D)
 HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
virtual void PrintStats ()
 PrintStats - If desired, print any statistics.
virtual bool shouldSkipFunctionBody (Decl *D)
 This callback is called for each function if the Parser was initialized with SkipFunctionBodies set to true.

Protected Member Functions

ASTWritergetWriter ()
const ASTWritergetWriter () const
SmallVectorImpl< char > & getPCH () const
bool isComplete () const
PCHBuffergetBufferPtr ()
StringRef getOutputFile () const
DiagnosticsEnginegetDiagnostics () const
PreprocessorgetPreprocessor ()
virtual ModulegetEmittingModule (ASTContext &Ctx)

Additional Inherited Members

Static Public Member Functions inherited from clang::SemaConsumer
static bool classof (const ASTConsumer *Consumer)

Detailed Description

AST and semantic-analysis consumer that generates a precompiled header from the parsed source code.

Definition at line 979 of file ASTWriter.h.

Constructor & Destructor Documentation

◆ PCHGenerator()

PCHGenerator::PCHGenerator ( Preprocessor & PP,
ModuleCache & ModCache,
StringRef OutputFile,
StringRef isysroot,
std::shared_ptr< PCHBuffer > Buffer,
const CodeGenOptions & CodeGenOpts,
ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions,
bool AllowASTWithErrors = false,
bool IncludeTimestamps = true,
bool BuildingImplicitModule = false,
bool ShouldCacheASTInMemory = false,
bool GeneratingReducedBMI = false )

Definition at line 25 of file GeneratePCH.cpp.

References clang::Data.

Referenced by clang::CXX20ModulesGenerator::CXX20ModulesGenerator().

◆ ~PCHGenerator()

PCHGenerator::~PCHGenerator ( )
override

Definition at line 42 of file GeneratePCH.cpp.

Member Function Documentation

◆ GetASTDeserializationListener()

ASTDeserializationListener * PCHGenerator::GetASTDeserializationListener ( )
overridevirtual

If the consumer is interested in entities being deserialized from AST files, it should return a pointer to a ASTDeserializationListener here.

Reimplemented from clang::ASTConsumer.

Definition at line 97 of file GeneratePCH.cpp.

◆ GetASTMutationListener()

ASTMutationListener * PCHGenerator::GetASTMutationListener ( )
overridevirtual

If the consumer is interested in entities getting modified after their initial creation, it should return a pointer to an ASTMutationListener here.

Reimplemented from clang::ASTConsumer.

Definition at line 93 of file GeneratePCH.cpp.

◆ getBufferPtr()

PCHBuffer * clang::PCHGenerator::getBufferPtr ( )
inlineprotected

Definition at line 998 of file ASTWriter.h.

Referenced by clang::CXX20ModulesGenerator::HandleTranslationUnit().

◆ getDiagnostics()

DiagnosticsEngine & PCHGenerator::getDiagnostics ( ) const
protected

Definition at line 60 of file GeneratePCH.cpp.

Referenced by clang::CXX20ModulesGenerator::HandleTranslationUnit().

◆ getEmittingModule()

Module * PCHGenerator::getEmittingModule ( ASTContext & Ctx)
protectedvirtual

Reimplemented in clang::CXX20ModulesGenerator.

Definition at line 45 of file GeneratePCH.cpp.

Referenced by HandleTranslationUnit().

◆ getOutputFile()

StringRef clang::PCHGenerator::getOutputFile ( ) const
inlineprotected

Definition at line 999 of file ASTWriter.h.

Referenced by clang::CXX20ModulesGenerator::HandleTranslationUnit().

◆ getPCH()

SmallVectorImpl< char > & clang::PCHGenerator::getPCH ( ) const
inlineprotected

Definition at line 995 of file ASTWriter.h.

◆ getPreprocessor()

Preprocessor & clang::PCHGenerator::getPreprocessor ( )
inlineprotected

Definition at line 1001 of file ASTWriter.h.

◆ getWriter() [1/2]

ASTWriter & clang::PCHGenerator::getWriter ( )
inlineprotected

Definition at line 993 of file ASTWriter.h.

◆ getWriter() [2/2]

const ASTWriter & clang::PCHGenerator::getWriter ( ) const
inlineprotected

Definition at line 994 of file ASTWriter.h.

◆ HandleTranslationUnit()

void PCHGenerator::HandleTranslationUnit ( ASTContext & Ctx)
overridevirtual

HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been parsed.

Reimplemented from clang::ASTConsumer.

Definition at line 71 of file GeneratePCH.cpp.

References clang::Sema::getDiagnostics(), getEmittingModule(), and clang::DiagnosticsEngine::hasErrorOccurred().

Referenced by clang::CXX20ModulesGenerator::HandleTranslationUnit().

◆ HandleVTable()

void clang::PCHGenerator::HandleVTable ( CXXRecordDecl * RD)
inlineoverridevirtual

Callback involved at the end of a translation unit to notify the consumer that a vtable for the given C++ class is required.

Parameters
RDThe class whose vtable was used.

Reimplemented from clang::ASTConsumer.

Definition at line 1018 of file ASTWriter.h.

◆ hasEmittedPCH()

bool clang::PCHGenerator::hasEmittedPCH ( ) const
inline

Definition at line 1021 of file ASTWriter.h.

◆ InitializeSema()

void PCHGenerator::InitializeSema ( Sema & S)
overridevirtual

Initialize the semantic consumer with the Sema instance being used to perform semantic analysis on the abstract syntax tree.

Reimplemented from clang::SemaConsumer.

Definition at line 64 of file GeneratePCH.cpp.

◆ isComplete()

bool clang::PCHGenerator::isComplete ( ) const
inlineprotected

Definition at line 997 of file ASTWriter.h.

Referenced by clang::CXX20ModulesGenerator::HandleTranslationUnit().


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