clang 20.0.0git
Classes | Public Types | Public Member Functions | Friends | List of all members
clang::ASTWriter Class Reference

Writes an AST file containing the contents of a translation unit. More...

#include "clang/Serialization/ASTWriter.h"

Inheritance diagram for clang::ASTWriter:
Inheritance graph
[legend]

Public Types

using RecordData = SmallVector< uint64_t, 64 >
 
using RecordDataImpl = SmallVectorImpl< uint64_t >
 
using RecordDataRef = ArrayRef< uint64_t >
 

Public Member Functions

 ASTWriter (llvm::BitstreamWriter &Stream, SmallVectorImpl< char > &Buffer, InMemoryModuleCache &ModuleCache, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, bool IncludeTimestamps=true, bool BuildingImplicitModule=false, bool GeneratingReducedBMI=false)
 Create a new precompiled header writer that outputs to the given bitstream.
 
 ~ASTWriter () override
 
const LangOptionsgetLangOpts () const
 
time_t getTimestampForOutput (const FileEntry *E) const
 Get a timestamp for output into the AST file.
 
ASTFileSignature WriteAST (llvm::PointerUnion< Sema *, Preprocessor * > Subject, StringRef OutputFile, Module *WritingModule, StringRef isysroot, bool ShouldCacheASTInMemory=false)
 Write a precompiled header or a module with the AST produced by the Sema object, or a dependency scanner module with the preprocessor state produced by the Preprocessor object.
 
void AddToken (const Token &Tok, RecordDataImpl &Record)
 Emit a token.
 
void AddAlignPackInfo (const Sema::AlignPackInfo &Info, RecordDataImpl &Record)
 Emit a AlignPackInfo.
 
void AddFileID (FileID FID, RecordDataImpl &Record)
 Emit a FileID.
 
void AddSourceLocation (SourceLocation Loc, RecordDataImpl &Record, LocSeq *Seq=nullptr)
 Emit a source location.
 
SourceLocationEncoding::RawLocEncoding getRawSourceLocationEncoding (SourceLocation Loc, LocSeq *Seq=nullptr)
 Return the raw encodings for source locations.
 
void AddSourceRange (SourceRange Range, RecordDataImpl &Record, LocSeq *Seq=nullptr)
 Emit a source range.
 
void AddIdentifierRef (const IdentifierInfo *II, RecordDataImpl &Record)
 Emit a reference to an identifier.
 
serialization::SelectorID getSelectorRef (Selector Sel)
 Get the unique number used to refer to the given selector.
 
serialization::IdentifierID getIdentifierRef (const IdentifierInfo *II)
 Get the unique number used to refer to the given identifier.
 
serialization::MacroID getMacroRef (MacroInfo *MI, const IdentifierInfo *Name)
 Get the unique number used to refer to the given macro.
 
serialization::MacroID getMacroID (MacroInfo *MI)
 Determine the ID of an already-emitted macro.
 
uint32_t getMacroDirectivesOffset (const IdentifierInfo *Name)
 
void AddTypeRef (ASTContext &Context, QualType T, RecordDataImpl &Record)
 Emit a reference to a type.
 
serialization::TypeID GetOrCreateTypeID (ASTContext &Context, QualType T)
 Force a type to be emitted and get its ID.
 
const DeclgetFirstLocalDecl (const Decl *D)
 Find the first local declaration of a given local redeclarable decl.
 
bool IsLocalDecl (const Decl *D)
 Is this a local declaration (that is, one that will be written to our AST file)? This is the case for declarations that are neither imported from another AST file nor predefined.
 
void AddDeclRef (const Decl *D, RecordDataImpl &Record)
 Emit a reference to a declaration.
 
void AddEmittedDeclRef (const Decl *D, RecordDataImpl &Record)
 
LocalDeclID GetDeclRef (const Decl *D)
 Force a declaration to be emitted and get its local ID to the module file been writing.
 
LocalDeclID getDeclID (const Decl *D)
 Determine the local declaration ID of an already-emitted declaration.
 
bool wasDeclEmitted (const Decl *D) const
 Whether or not the declaration got emitted.
 
unsigned getAnonymousDeclarationNumber (const NamedDecl *D)
 
void AddString (StringRef Str, RecordDataImpl &Record)
 Add a string to the given record.
 
void AddStringBlob (StringRef Str, RecordDataImpl &Record, SmallVectorImpl< char > &Blob)
 
bool PreparePathForOutput (SmallVectorImpl< char > &Path)
 Convert a path from this build process into one that is appropriate for emission in the module file.
 
void AddPath (StringRef Path, RecordDataImpl &Record)
 Add a path to the given record.
 
void AddPathBlob (StringRef Str, RecordDataImpl &Record, SmallVectorImpl< char > &Blob)
 
void EmitRecordWithPath (unsigned Abbrev, RecordDataRef Record, StringRef Path)
 Emit the current record with the given path as a blob.
 
void AddVersionTuple (const VersionTuple &Version, RecordDataImpl &Record)
 Add a version tuple to the given record.
 
unsigned getLocalOrImportedSubmoduleID (const Module *Mod)
 Retrieve or create a submodule ID for this module, or return 0 if the submodule is neither local (a submodle of the currently-written module) nor from an imported module.
 
void SetIdentifierOffset (const IdentifierInfo *II, uint32_t Offset)
 Note that the identifier II occurs at the given offset within the identifier table.
 
void SetSelectorOffset (Selector Sel, uint32_t Offset)
 Note that the selector Sel occurs at the given offset within the method pool/selector table.
 
unsigned RecordSwitchCaseID (SwitchCase *S)
 Record an ID for the given switch-case statement.
 
unsigned getSwitchCaseID (SwitchCase *S)
 Retrieve the ID for the given switch-case statement.
 
void ClearSwitchCaseIDs ()
 
unsigned getTypeExtQualAbbrev () const
 
unsigned getDeclParmVarAbbrev () const
 
unsigned getDeclRecordAbbrev () const
 
unsigned getDeclTypedefAbbrev () const
 
unsigned getDeclVarAbbrev () const
 
unsigned getDeclFieldAbbrev () const
 
unsigned getDeclEnumAbbrev () const
 
unsigned getDeclObjCIvarAbbrev () const
 
unsigned getDeclCXXMethodAbbrev (FunctionDecl::TemplatedKind Kind) const
 
unsigned getDeclTemplateTypeParmAbbrev () const
 
unsigned getDeclUsingShadowAbbrev () const
 
unsigned getDeclRefExprAbbrev () const
 
unsigned getCharacterLiteralAbbrev () const
 
unsigned getIntegerLiteralAbbrev () const
 
unsigned getExprImplicitCastAbbrev () const
 
unsigned getBinaryOperatorAbbrev () const
 
unsigned getCompoundAssignOperatorAbbrev () const
 
unsigned getCallExprAbbrev () const
 
unsigned getCXXOperatorCallExprAbbrev ()
 
unsigned getCXXMemberCallExprAbbrev ()
 
unsigned getCompoundStmtAbbrev () const
 
bool hasChain () const
 
ASTReadergetChain () const
 
bool isWritingModule () const
 
bool isWritingStdCXXNamedModules () const
 
bool isGeneratingReducedBMI () const
 
bool getDoneWritingDeclsAndTypes () const
 
bool isDeclPredefined (const Decl *D) const
 
void handleVTable (CXXRecordDecl *RD)
 
- Public Member Functions inherited from clang::ASTDeserializationListener
virtual ~ASTDeserializationListener ()
 
virtual void ReaderInitialized (ASTReader *Reader)
 The ASTReader was initialized.
 
virtual void IdentifierRead (serialization::IdentifierID ID, IdentifierInfo *II)
 An identifier was deserialized from the AST file.
 
virtual void MacroRead (serialization::MacroID ID, MacroInfo *MI)
 A macro was read from the AST file.
 
virtual void TypeRead (serialization::TypeIdx Idx, QualType T)
 A type was deserialized from the AST file.
 
virtual void DeclRead (GlobalDeclID ID, const Decl *D)
 A decl was deserialized from the AST file.
 
virtual void PredefinedDeclBuilt (PredefinedDeclIDs ID, const Decl *D)
 A predefined decl was built during the serialization.
 
virtual void SelectorRead (serialization::SelectorID iD, Selector Sel)
 A selector was read from the AST file.
 
virtual void MacroDefinitionRead (serialization::PreprocessedEntityID, MacroDefinitionRecord *MD)
 A macro definition was read from the AST file.
 
virtual void ModuleRead (serialization::SubmoduleID ID, Module *Mod)
 A module definition was read from the AST file.
 
virtual void ModuleImportRead (serialization::SubmoduleID ID, SourceLocation ImportLoc)
 A module import was read from the AST file.
 
- Public Member Functions inherited from clang::ASTMutationListener
virtual ~ASTMutationListener ()
 
virtual void CompletedTagDefinition (const TagDecl *D)
 A new TagDecl definition was completed.
 
virtual void AddedVisibleDecl (const DeclContext *DC, const Decl *D)
 A new declaration with name has been added to a DeclContext.
 
virtual void AddedCXXImplicitMember (const CXXRecordDecl *RD, const Decl *D)
 An implicit member was added after the definition was completed.
 
virtual void AddedCXXTemplateSpecialization (const ClassTemplateDecl *TD, const ClassTemplateSpecializationDecl *D)
 A template specialization (or partial one) was added to the template declaration.
 
virtual void AddedCXXTemplateSpecialization (const VarTemplateDecl *TD, const VarTemplateSpecializationDecl *D)
 A template specialization (or partial one) was added to the template declaration.
 
virtual void AddedCXXTemplateSpecialization (const FunctionTemplateDecl *TD, const FunctionDecl *D)
 A template specialization (or partial one) was added to the template declaration.
 
virtual void ResolvedExceptionSpec (const FunctionDecl *FD)
 A function's exception specification has been evaluated or instantiated.
 
virtual void DeducedReturnType (const FunctionDecl *FD, QualType ReturnType)
 A function's return type has been deduced.
 
virtual void ResolvedOperatorDelete (const CXXDestructorDecl *DD, const FunctionDecl *Delete, Expr *ThisArg)
 A virtual destructor's operator delete has been resolved.
 
virtual void CompletedImplicitDefinition (const FunctionDecl *D)
 An implicit member got a definition.
 
virtual void InstantiationRequested (const ValueDecl *D)
 The instantiation of a templated function or variable was requested.
 
virtual void VariableDefinitionInstantiated (const VarDecl *D)
 A templated variable's definition was implicitly instantiated.
 
virtual void FunctionDefinitionInstantiated (const FunctionDecl *D)
 A function template's definition was instantiated.
 
virtual void DefaultArgumentInstantiated (const ParmVarDecl *D)
 A default argument was instantiated.
 
virtual void DefaultMemberInitializerInstantiated (const FieldDecl *D)
 A default member initializer was instantiated.
 
virtual void AddedObjCCategoryToInterface (const ObjCCategoryDecl *CatD, const ObjCInterfaceDecl *IFD)
 A new objc category class was added for an interface.
 
virtual void DeclarationMarkedUsed (const Decl *D)
 A declaration is marked used which was not previously marked used.
 
virtual void DeclarationMarkedOpenMPThreadPrivate (const Decl *D)
 A declaration is marked as OpenMP threadprivate which was not previously marked as threadprivate.
 
virtual void DeclarationMarkedOpenMPDeclareTarget (const Decl *D, const Attr *Attr)
 A declaration is marked as OpenMP declaretarget which was not previously marked as declaretarget.
 
virtual void DeclarationMarkedOpenMPAllocate (const Decl *D, const Attr *A)
 A declaration is marked as a variable with OpenMP allocator.
 
virtual void RedefinedHiddenDefinition (const NamedDecl *D, Module *M)
 A definition has been made visible by being redefined locally.
 
virtual void AddedAttributeToRecord (const Attr *Attr, const RecordDecl *Record)
 An attribute was added to a RecordDecl.
 
virtual void EnteringModulePurview ()
 The parser find the named module declaration.
 
virtual void AddedManglingNumber (const Decl *D, unsigned Number)
 An mangling number was added to a Decl.
 
virtual void AddedStaticLocalNumbers (const Decl *D, unsigned Number)
 An static local number was added to a Decl.
 
virtual void AddedAnonymousNamespace (const TranslationUnitDecl *TU, NamespaceDecl *AnonNamespace)
 An anonymous namespace was added the translation unit decl.
 

Friends

class ASTDeclWriter
 
class ASTRecordWriter
 

Detailed Description

Writes an AST file containing the contents of a translation unit.

The ASTWriter class produces a bitstream containing the serialized representation of a given abstract syntax tree and its supporting data structures. This bitstream can be de-serialized via an instance of the ASTReader class.

Definition at line 88 of file ASTWriter.h.

Member Typedef Documentation

◆ RecordData

Definition at line 94 of file ASTWriter.h.

◆ RecordDataImpl

Definition at line 95 of file ASTWriter.h.

◆ RecordDataRef

Definition at line 96 of file ASTWriter.h.

Constructor & Destructor Documentation

◆ ASTWriter()

ASTWriter::ASTWriter ( llvm::BitstreamWriter &  Stream,
SmallVectorImpl< char > &  Buffer,
InMemoryModuleCache ModuleCache,
ArrayRef< std::shared_ptr< ModuleFileExtension > >  Extensions,
bool  IncludeTimestamps = true,
bool  BuildingImplicitModule = false,
bool  GeneratingReducedBMI = false 
)

Create a new precompiled header writer that outputs to the given bitstream.

Definition at line 5078 of file ASTWriter.cpp.

◆ ~ASTWriter()

ASTWriter::~ASTWriter ( )
overridedefault

Member Function Documentation

◆ AddAlignPackInfo()

void ASTWriter::AddAlignPackInfo ( const Sema::AlignPackInfo Info,
RecordDataImpl Record 
)

Emit a AlignPackInfo.

Definition at line 6250 of file ASTWriter.cpp.

References clang::Sema::AlignPackInfo::getRawEncoding().

◆ AddDeclRef()

void ASTWriter::AddDeclRef ( const Decl D,
RecordDataImpl Record 
)

◆ AddEmittedDeclRef()

void ASTWriter::AddEmittedDeclRef ( const Decl D,
RecordDataImpl Record 
)

Definition at line 6541 of file ASTWriter.cpp.

References AddDeclRef(), D, and wasDeclEmitted().

Referenced by AddLazyVectorEmiitedDecls().

◆ AddFileID()

void ASTWriter::AddFileID ( FileID  FID,
RecordDataImpl Record 
)

Emit a FileID.

Definition at line 6318 of file ASTWriter.cpp.

◆ AddIdentifierRef()

void ASTWriter::AddIdentifierRef ( const IdentifierInfo II,
RecordDataImpl Record 
)

Emit a reference to an identifier.

Definition at line 6361 of file ASTWriter.cpp.

References getIdentifierRef().

Referenced by clang::ASTRecordWriter::AddIdentifierRef(), and AddToken().

◆ AddPath()

void ASTWriter::AddPath ( StringRef  Path,
RecordDataImpl Record 
)

Add a path to the given record.

Definition at line 5016 of file ASTWriter.cpp.

References AddString(), Path, and PreparePathForOutput().

Referenced by clang::ASTRecordWriter::AddPath().

◆ AddPathBlob()

void ASTWriter::AddPathBlob ( StringRef  Str,
RecordDataImpl Record,
SmallVectorImpl< char > &  Blob 
)

Definition at line 5022 of file ASTWriter.cpp.

References AddStringBlob(), Path, and PreparePathForOutput().

◆ AddSourceLocation()

void ASTWriter::AddSourceLocation ( SourceLocation  Loc,
RecordDataImpl Record,
LocSeq Seq = nullptr 
)

Emit a source location.

Definition at line 6345 of file ASTWriter.cpp.

References getRawSourceLocationEncoding(), Loc, and clang::Seq.

Referenced by clang::ASTRecordWriter::AddSourceLocation(), AddSourceRange(), and AddToken().

◆ AddSourceRange()

void ASTWriter::AddSourceRange ( SourceRange  Range,
RecordDataImpl Record,
LocSeq Seq = nullptr 
)

◆ AddString()

void ASTWriter::AddString ( StringRef  Str,
RecordDataImpl Record 
)

Add a string to the given record.

Definition at line 4983 of file ASTWriter.cpp.

Referenced by AddPath(), clang::ASTRecordWriter::AddString(), and AddToken().

◆ AddStringBlob()

void ASTWriter::AddStringBlob ( StringRef  Str,
RecordDataImpl Record,
SmallVectorImpl< char > &  Blob 
)

Definition at line 4988 of file ASTWriter.cpp.

Referenced by AddPathBlob().

◆ AddToken()

void ASTWriter::AddToken ( const Token Tok,
RecordDataImpl Record 
)

◆ AddTypeRef()

void ASTWriter::AddTypeRef ( ASTContext Context,
QualType  T,
RecordDataImpl Record 
)

Emit a reference to a type.

Definition at line 6489 of file ASTWriter.cpp.

References GetOrCreateTypeID(), and clang::T.

Referenced by clang::ASTRecordWriter::AddTypeRef().

◆ AddVersionTuple()

void ASTWriter::AddVersionTuple ( const VersionTuple &  Version,
RecordDataImpl Record 
)

Add a version tuple to the given record.

Definition at line 5036 of file ASTWriter.cpp.

Referenced by clang::ASTRecordWriter::AddVersionTuple().

◆ ClearSwitchCaseIDs()

void ASTWriter::ClearSwitchCaseIDs ( )

Definition at line 3009 of file ASTWriterStmt.cpp.

Referenced by clang::ASTRecordWriter::AddFunctionDefinition().

◆ EmitRecordWithPath()

void ASTWriter::EmitRecordWithPath ( unsigned  Abbrev,
RecordDataRef  Record,
StringRef  Path 
)

Emit the current record with the given path as a blob.

Definition at line 5029 of file ASTWriter.cpp.

References Path, and PreparePathForOutput().

◆ getAnonymousDeclarationNumber()

unsigned ASTWriter::getAnonymousDeclarationNumber ( const NamedDecl D)

◆ getBinaryOperatorAbbrev()

unsigned clang::ASTWriter::getBinaryOperatorAbbrev ( ) const
inline

Definition at line 865 of file ASTWriter.h.

◆ getCallExprAbbrev()

unsigned clang::ASTWriter::getCallExprAbbrev ( ) const
inline

Definition at line 869 of file ASTWriter.h.

◆ getChain()

ASTReader * clang::ASTWriter::getChain ( ) const
inline

Definition at line 876 of file ASTWriter.h.

Referenced by getRawSourceLocationEncoding().

◆ getCharacterLiteralAbbrev()

unsigned clang::ASTWriter::getCharacterLiteralAbbrev ( ) const
inline

Definition at line 862 of file ASTWriter.h.

◆ getCompoundAssignOperatorAbbrev()

unsigned clang::ASTWriter::getCompoundAssignOperatorAbbrev ( ) const
inline

Definition at line 866 of file ASTWriter.h.

◆ getCompoundStmtAbbrev()

unsigned clang::ASTWriter::getCompoundStmtAbbrev ( ) const
inline

Definition at line 873 of file ASTWriter.h.

◆ getCXXMemberCallExprAbbrev()

unsigned clang::ASTWriter::getCXXMemberCallExprAbbrev ( )
inline

Definition at line 871 of file ASTWriter.h.

◆ getCXXOperatorCallExprAbbrev()

unsigned clang::ASTWriter::getCXXOperatorCallExprAbbrev ( )
inline

Definition at line 870 of file ASTWriter.h.

◆ getDeclCXXMethodAbbrev()

unsigned clang::ASTWriter::getDeclCXXMethodAbbrev ( FunctionDecl::TemplatedKind  Kind) const
inline

◆ getDeclEnumAbbrev()

unsigned clang::ASTWriter::getDeclEnumAbbrev ( ) const
inline

Definition at line 837 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitEnumDecl().

◆ getDeclFieldAbbrev()

unsigned clang::ASTWriter::getDeclFieldAbbrev ( ) const
inline

Definition at line 836 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitFieldDecl().

◆ getDeclID()

LocalDeclID ASTWriter::getDeclID ( const Decl D)

Determine the local declaration ID of an already-emitted declaration.

Definition at line 6593 of file ASTWriter.cpp.

References D, clang::Decl::getGlobalID(), and clang::Decl::isFromASTFile().

◆ getDeclObjCIvarAbbrev()

unsigned clang::ASTWriter::getDeclObjCIvarAbbrev ( ) const
inline

Definition at line 838 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitObjCIvarDecl().

◆ getDeclParmVarAbbrev()

unsigned clang::ASTWriter::getDeclParmVarAbbrev ( ) const
inline

Definition at line 832 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitParmVarDecl().

◆ getDeclRecordAbbrev()

unsigned clang::ASTWriter::getDeclRecordAbbrev ( ) const
inline

Definition at line 833 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitRecordDecl().

◆ GetDeclRef()

LocalDeclID ASTWriter::GetDeclRef ( const Decl D)

◆ getDeclRefExprAbbrev()

unsigned clang::ASTWriter::getDeclRefExprAbbrev ( ) const
inline

Definition at line 861 of file ASTWriter.h.

◆ getDeclTemplateTypeParmAbbrev()

unsigned clang::ASTWriter::getDeclTemplateTypeParmAbbrev ( ) const
inline

Definition at line 856 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitTemplateTypeParmDecl().

◆ getDeclTypedefAbbrev()

unsigned clang::ASTWriter::getDeclTypedefAbbrev ( ) const
inline

Definition at line 834 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitTypedefDecl().

◆ getDeclUsingShadowAbbrev()

unsigned clang::ASTWriter::getDeclUsingShadowAbbrev ( ) const
inline

Definition at line 859 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitUsingShadowDecl().

◆ getDeclVarAbbrev()

unsigned clang::ASTWriter::getDeclVarAbbrev ( ) const
inline

Definition at line 835 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitVarDecl().

◆ getDoneWritingDeclsAndTypes()

bool clang::ASTWriter::getDoneWritingDeclsAndTypes ( ) const
inline

Definition at line 886 of file ASTWriter.h.

Referenced by isLookupResultNotInteresting().

◆ getExprImplicitCastAbbrev()

unsigned clang::ASTWriter::getExprImplicitCastAbbrev ( ) const
inline

Definition at line 864 of file ASTWriter.h.

◆ getFirstLocalDecl()

const Decl * ASTWriter::getFirstLocalDecl ( const Decl D)

Find the first local declaration of a given local redeclarable decl.

Definition at line 2087 of file ASTWriterDecl.cpp.

References D, clang::Decl::getCanonicalDecl(), clang::Decl::getPreviousDecl(), and IsLocalDecl().

Referenced by clang::ASTDeclWriter::RegisterTemplateSpecialization(), and clang::ASTDeclWriter::VisitRedeclarable().

◆ getIdentifierRef()

IdentifierID ASTWriter::getIdentifierRef ( const IdentifierInfo II)

Get the unique number used to refer to the given identifier.

Definition at line 6365 of file ASTWriter.cpp.

Referenced by AddIdentifierRef().

◆ getIntegerLiteralAbbrev()

unsigned clang::ASTWriter::getIntegerLiteralAbbrev ( ) const
inline

Definition at line 863 of file ASTWriter.h.

◆ getLangOpts()

const LangOptions & ASTWriter::getLangOpts ( ) const

◆ getLocalOrImportedSubmoduleID()

unsigned ASTWriter::getLocalOrImportedSubmoduleID ( const Module Mod)

Retrieve or create a submodule ID for this module, or return 0 if the submodule is neither local (a submodle of the currently-written module) nor from an imported module.

Definition at line 2898 of file ASTWriter.cpp.

References getLangOpts(), and clang::Module::getTopLevelModule().

◆ getMacroDirectivesOffset()

uint32_t ASTWriter::getMacroDirectivesOffset ( const IdentifierInfo Name)

Definition at line 6399 of file ASTWriter.cpp.

◆ getMacroID()

MacroID ASTWriter::getMacroID ( MacroInfo MI)

Determine the ID of an already-emitted macro.

Definition at line 6391 of file ASTWriter.cpp.

References clang::MacroInfo::isBuiltinMacro().

◆ getMacroRef()

MacroID ASTWriter::getMacroRef ( MacroInfo MI,
const IdentifierInfo Name 
)

Get the unique number used to refer to the given macro.

Definition at line 6375 of file ASTWriter.cpp.

References clang::MacroInfo::isBuiltinMacro().

◆ GetOrCreateTypeID()

TypeID ASTWriter::GetOrCreateTypeID ( ASTContext Context,
QualType  T 
)

Force a type to be emitted and get its ID.

Definition at line 6519 of file ASTWriter.cpp.

References clang::serialization::TypeIdx::getValue(), MakeTypeID(), and clang::T.

Referenced by AddTypeRef().

◆ getRawSourceLocationEncoding()

SourceLocationEncoding::RawLocEncoding ASTWriter::getRawSourceLocationEncoding ( SourceLocation  Loc,
LocSeq Seq = nullptr 
)

◆ getSelectorRef()

SelectorID ASTWriter::getSelectorRef ( Selector  Sel)

Get the unique number used to refer to the given selector.

Definition at line 6407 of file ASTWriter.cpp.

References clang::Selector::getAsOpaquePtr(), and clang::ASTReader::LoadSelector().

◆ getSwitchCaseID()

unsigned ASTWriter::getSwitchCaseID ( SwitchCase S)

Retrieve the ID for the given switch-case statement.

Definition at line 3004 of file ASTWriterStmt.cpp.

◆ getTimestampForOutput()

time_t ASTWriter::getTimestampForOutput ( const FileEntry E) const

Get a timestamp for output into the AST file.

The actual timestamp of the specified file may be ignored if we have been instructed to not include timestamps in the output file.

Definition at line 5101 of file ASTWriter.cpp.

References E.

◆ getTypeExtQualAbbrev()

unsigned clang::ASTWriter::getTypeExtQualAbbrev ( ) const
inline

Definition at line 828 of file ASTWriter.h.

◆ handleVTable()

void ASTWriter::handleVTable ( CXXRecordDecl RD)

Definition at line 4014 of file ASTWriter.cpp.

References clang::Decl::isInNamedModule().

Referenced by clang::PCHGenerator::HandleVTable().

◆ hasChain()

bool clang::ASTWriter::hasChain ( ) const
inline

Definition at line 875 of file ASTWriter.h.

Referenced by clang::ASTDeclWriter::VisitNamespaceDecl().

◆ isDeclPredefined()

bool clang::ASTWriter::isDeclPredefined ( const Decl D) const
inline

Definition at line 888 of file ASTWriter.h.

References D.

Referenced by isLookupResultNotInteresting().

◆ isGeneratingReducedBMI()

bool clang::ASTWriter::isGeneratingReducedBMI ( ) const
inline

◆ IsLocalDecl()

bool clang::ASTWriter::IsLocalDecl ( const Decl D)
inline

Is this a local declaration (that is, one that will be written to our AST file)? This is the case for declarations that are neither imported from another AST file nor predefined.

Definition at line 755 of file ASTWriter.h.

References D, and clang::NUM_PREDEF_DECL_IDS.

Referenced by getFirstLocalDecl().

◆ isWritingModule()

bool clang::ASTWriter::isWritingModule ( ) const
inline

Definition at line 878 of file ASTWriter.h.

◆ isWritingStdCXXNamedModules()

bool clang::ASTWriter::isWritingStdCXXNamedModules ( ) const
inline

◆ PreparePathForOutput()

bool ASTWriter::PreparePathForOutput ( SmallVectorImpl< char > &  Path)

Convert a path from this build process into one that is appropriate for emission in the module file.

Definition at line 4994 of file ASTWriter.cpp.

References adjustFilenameForRelocatableAST(), cleanPathForOutput(), clang::Preprocessor::getFileManager(), and Path.

Referenced by AddPath(), AddPathBlob(), and EmitRecordWithPath().

◆ RecordSwitchCaseID()

unsigned ASTWriter::RecordSwitchCaseID ( SwitchCase S)

Record an ID for the given switch-case statement.

Definition at line 2997 of file ASTWriterStmt.cpp.

◆ SetIdentifierOffset()

void ASTWriter::SetIdentifierOffset ( const IdentifierInfo II,
uint32_t  Offset 
)

Note that the identifier II occurs at the given offset within the identifier table.

Definition at line 5051 of file ASTWriter.cpp.

References isLocalIdentifierID(), and clang::serialization::NUM_PREDEF_IDENT_IDS.

◆ SetSelectorOffset()

void ASTWriter::SetSelectorOffset ( Selector  Sel,
uint32_t  Offset 
)

Note that the selector Sel occurs at the given offset within the method pool/selector table.

Definition at line 5068 of file ASTWriter.cpp.

◆ wasDeclEmitted()

bool ASTWriter::wasDeclEmitted ( const Decl D) const

Whether or not the declaration got emitted.

If not, it wouldn't be emitted.

This may only be called after we've done the job to write the declarations (marked by DoneWritingDeclsAndTypes).

A declaration may only be omitted in reduced BMI.

Definition at line 6606 of file ASTWriter.cpp.

References D, clang::Decl::getOwningModule(), clang::Decl::isFromASTFile(), and isWritingStdCXXNamedModules().

Referenced by AddEmittedDeclRef(), and isLookupResultNotInteresting().

◆ WriteAST()

ASTFileSignature ASTWriter::WriteAST ( llvm::PointerUnion< Sema *, Preprocessor * >  Subject,
StringRef  OutputFile,
Module WritingModule,
StringRef  isysroot,
bool  ShouldCacheASTInMemory = false 
)

Write a precompiled header or a module with the AST produced by the Sema object, or a dependency scanner module with the preprocessor state produced by the Preprocessor object.

Parameters
SubjectThe Sema object that processed the AST to be written, or in the case of a dependency scanner module the Preprocessor that holds the state.
WritingModuleThe module that we are writing. If null, we are writing a precompiled header.
isysrootif non-empty, write a relocatable file whose headers are relative to the given system root. If we're writing a module, its build directory will be used in preference to this if both are available.
Returns
the module signature, which eventually will be a hash of the module but currently is merely a random 32-bit number.

Definition at line 5106 of file ASTWriter.cpp.

References clang::InMemoryModuleCache::addBuiltPCM(), clang::Sema::getPreprocessor(), and clang::serialization::updateModuleTimestamp().

Referenced by clang::PCHGenerator::HandleTranslationUnit(), and serializeUnit().

Friends And Related Function Documentation

◆ ASTDeclWriter

friend class ASTDeclWriter
friend

Definition at line 91 of file ASTWriter.h.

◆ ASTRecordWriter

friend class ASTRecordWriter
friend

Definition at line 92 of file ASTWriter.h.


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