class ASTWriter

Declaration

class ASTWriter : public ASTDeserializationListener,
                  public ASTMutationListener { /* full declaration omitted */ };

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.

Declared at: clang/include/clang/Serialization/ASTWriter.h:85

Inherits from: ASTDeserializationListener, ASTMutationListener

Member Variables

private llvm::BitstreamWriter& Stream
The bitstream writer used to emit this precompiled header.
private const SmallVectorImpl<char>& Buffer
The buffer associated with the bitstream.
private clang::InMemoryModuleCache& ModuleCache
The PCM manager which manages memory buffers for pcm files.
private clang::ASTContext* Context = nullptr
The ASTContext we're writing.
private clang::Preprocessor* PP = nullptr
The preprocessor we're writing.
private clang::ASTReader* Chain = nullptr
The reader of existing AST files, if we're chaining.
private clang::Module* WritingModule = nullptr
The module we're currently writing, if any.
private uint64_t ASTBlockStartOffset = 0
The offset of the first bit inside the AST_BLOCK.
private std::pair<uint64_t, uint64_t> ASTBlockRange
The range representing all the AST_BLOCK.
private std::string BaseDirectory
The base directory for any relative paths we emit.
private bool IncludeTimestamps
Indicates whether timestamps should be written to the produced module file. This is the case for files implicitly written to the module cache, where we need the timestamps to determine if the module file is up to date, but not otherwise.
private bool WritingAST = false
Indicates when the AST writing is actively performing serialization, rather than just queueing updates.
private bool DoneWritingDeclsAndTypes = false
Indicates that we are done serializing the collection of decls and types to emit.
private bool ASTHasCompilerErrors = false
Indicates that the AST contained compiler errors.
private llvm::DenseMap<const FileEntry*, uint32_t> InputFileIDs
Mapping from input file entries to the index into the offset table where information about that input file is stored.
private std::queue<DeclOrType> DeclTypesToEmit
The declarations and types to emit.
private serialization::DeclID FirstDeclID = serialization::NUM_PREDEF_DECL_IDS
The first ID number we can use for our own declarations.
private serialization::DeclID NextDeclID = this->FirstDeclID
The decl ID that will be assigned to the next new decl.
private llvm::DenseMap<const Decl*, serialization::DeclID> DeclIDs
The ID numbers of declarations are consecutive (in order of discovery) and start at 2. 1 is reserved for the translation unit, while 0 is reserved for NULL.
private std::vector<serialization::DeclOffset> DeclOffsets
Offset of each declaration in the bitstream, indexed by the declaration's ID.
private uint64_t DeclTypesBlockStartOffset = 0
The offset of the DECLTYPES_BLOCK. The offsets in DeclOffsets are relative to this value.
private clang::ASTWriter::FileDeclIDsTy FileDeclIDs
Map from file SLocEntries to info about the file-level declarations that it contains.
private serialization::TypeID FirstTypeID = serialization::NUM_PREDEF_TYPE_IDS
The first ID number we can use for our own types.
private serialization::TypeID NextTypeID = this->FirstTypeID
The type ID that will be assigned to the next new type.
private clang::ASTWriter::TypeIdxMap TypeIdxs
Keys in the map never have const/volatile qualifiers.
private std::vector<serialization::UnderalignedInt64> TypeOffsets
Offset of each type in the bitstream, indexed by the type's ID.
private serialization::IdentID FirstIdentID = serialization::NUM_PREDEF_IDENT_IDS
The first ID number we can use for our own identifiers.
private serialization::IdentID NextIdentID = this->FirstIdentID
The identifier ID that will be assigned to the next new identifier.
private llvm::MapVector<const IdentifierInfo*, serialization::IdentID> IdentifierIDs
The ID numbers for identifiers are consecutive (in order of discovery), starting at 1. An ID of zero refers to a NULL IdentifierInfo.
private serialization::MacroID FirstMacroID = serialization::NUM_PREDEF_MACRO_IDS
The first ID number we can use for our own macros.
private serialization::MacroID NextMacroID = this->FirstMacroID
The identifier ID that will be assigned to the next new identifier.
private llvm::DenseMap<MacroInfo*, serialization::MacroID> MacroIDs
Map that provides the ID numbers of each macro.
private std::vector<MacroInfoToEmitData> MacroInfosToEmit
The macro infos to emit.
private llvm::DenseMap<const IdentifierInfo*, uint32_t> IdentMacroDirectivesOffsetMap
private llvm::DenseSet<Stmt*> ParentStmts
Set of parent Stmts for the currently serializing sub-stmt.
private llvm::DenseMap<Stmt*, uint64_t> SubStmtEntries
Offsets of sub-stmts already serialized. The offset points just after the stmt record.
private std::vector<uint32_t> IdentifierOffsets
Offsets of each of the identifier IDs into the identifier table.
private serialization::SubmoduleID FirstSubmoduleID = serialization::NUM_PREDEF_SUBMODULE_IDS
The first ID number we can use for our own submodules.
private serialization::SubmoduleID NextSubmoduleID = this->FirstSubmoduleID
The submodule ID that will be assigned to the next new submodule.
private serialization::SelectorID FirstSelectorID = serialization::NUM_PREDEF_SELECTOR_IDS
The first ID number we can use for our own selectors.
private serialization::SelectorID NextSelectorID = this->FirstSelectorID
The selector ID that will be assigned to the next new selector.
private llvm::MapVector<Selector, serialization::SelectorID> SelectorIDs
Map that provides the ID numbers of each Selector.
private std::vector<uint32_t> SelectorOffsets
Offset of each selector within the method pool/selector table, indexed by the Selector ID (-1).
private llvm::DenseMap< const MacroDefinitionRecord*, serialization::PreprocessedEntityID> MacroDefinitions
Mapping from macro definitions (as they occur in the preprocessing record) to the macro IDs.
private llvm::DenseMap<const Decl*, unsigned int> AnonymousDeclarationNumbers
Cache of indices of anonymous declarations within their lexical contexts.
private clang::ASTWriter::DeclUpdateMap DeclUpdates
Mapping from declarations that came from a chained PCH to the record containing modifications to them.
private clang::ASTWriter::FirstLatestDeclMap FirstLatestDecls
Map of first declarations from a chained PCH that point to the most recent declarations in another PCH.
private SmallVector<serialization::DeclID, 16> EagerlyDeserializedDecls
We keep track of external definitions and other 'interesting' declarations as we are emitting declarations to the AST file. The AST file contains a separate record for these declarations, which are provided to the AST consumer by the AST reader. This is behavior is required to properly cope with, e.g., tentative variable definitions that occur within headers. The declarations themselves are stored as declaration IDs, since they will be written out to an EAGERLY_DESERIALIZED_DECLS record.
private SmallVector<serialization::DeclID, 16> ModularCodegenDecls
private llvm::SmallSetVector<const DeclContext*, 16> UpdatedDeclContexts
For namespaces, when we're chaining and encountering a namespace, we check if its primary namespace comes from the chain. If it does, we add the primary to this set, so that we can write out lexical content updates for it.
private SmallVector<const clang::Decl*, 16> DeclsToEmitEvenIfUnreferenced
Keeps track of declarations that we must emit, even though we're not guaranteed to be able to find them by walking the AST starting at the translation unit.
private llvm::SetVector<ObjCInterfaceDecl*> ObjCClassesWithCategories
The set of Objective-C class that have categories we should serialize.
private llvm::SmallVector<const Decl*, 16> Redeclarations
The set of declarations that may have redeclaration chains that need to be serialized.
private llvm::DenseMap<const Decl*, const Decl*> FirstLocalDeclCache
A cache of the first local declaration for "interesting" redeclaration chains.
private llvm::DenseMap<SwitchCase*, unsigned int> SwitchCaseIDs
Mapping from SwitchCase statements to IDs.
private unsigned int NumStatements = 0
The number of statements written to the AST file.
private unsigned int NumMacros = 0
The number of macros written to the AST file.
private unsigned int NumLexicalDeclContexts = 0
The number of lexical declcontexts written to the AST file.
private unsigned int NumVisibleDeclContexts = 0
The number of visible declcontexts written to the AST file.
private llvm::DenseMap<const Module*, unsigned int> SubmoduleIDs
A mapping from each known submodule to its ID number, which will be a positive integer.
private std::vector< std::unique_ptr<ModuleFileExtensionWriter>> ModuleFileExtensionWriters
A list of the module file extension writers.
private std::set<const FileEntry*> SkippedModuleMaps
User ModuleMaps skipped when writing control block.
private unsigned int TypeExtQualAbbrev = 0
private unsigned int DeclParmVarAbbrev = 0
private unsigned int DeclContextLexicalAbbrev = 0
private unsigned int DeclContextVisibleLookupAbbrev = 0
private unsigned int UpdateVisibleAbbrev = 0
private unsigned int DeclRecordAbbrev = 0
private unsigned int DeclTypedefAbbrev = 0
private unsigned int DeclVarAbbrev = 0
private unsigned int DeclFieldAbbrev = 0
private unsigned int DeclEnumAbbrev = 0
private unsigned int DeclObjCIvarAbbrev = 0
private unsigned int DeclCXXMethodAbbrev = 0
private unsigned int DeclRefExprAbbrev = 0
private unsigned int CharacterLiteralAbbrev = 0
private unsigned int IntegerLiteralAbbrev = 0
private unsigned int ExprImplicitCastAbbrev = 0

Method Overview

Inherited from ASTMutationListener:

Inherited from ASTDeserializationListener:

Methods

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

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:542

Parameters

llvm::BitstreamWriter& Stream
SmallVectorImpl<char>& Buffer
clang::InMemoryModuleCache& ModuleCache
ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions
bool IncludeTimestamps = true

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

Description

Emit a AlignPackInfo.

Declared at: clang/include/clang/Serialization/ASTWriter.h:583

Parameters

const Sema::AlignPackInfo& Info
clang::ASTWriter::RecordDataImpl& Record

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

Description

Emit a reference to a declaration.

Declared at: clang/include/clang/Serialization/ASTWriter.h:636

Parameters

const clang::Decl* D
clang::ASTWriter::RecordDataImpl& Record

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

Description

Emit a reference to an identifier.

Declared at: clang/include/clang/Serialization/ASTWriter.h:595

Parameters

const clang::IdentifierInfo* II
clang::ASTWriter::RecordDataImpl& Record

void AddPath(
    llvm::StringRef Path,
    clang::ASTWriter::RecordDataImpl& Record)

Description

Add a path to the given record.

Declared at: clang/include/clang/Serialization/ASTWriter.h:655

Parameters

llvm::StringRef Path
clang::ASTWriter::RecordDataImpl& Record

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

Description

Emit a source location.

Declared at: clang/include/clang/Serialization/ASTWriter.h:587

Parameters

clang::SourceLocation Loc
clang::ASTWriter::RecordDataImpl& Record
clang::ASTWriter::LocSeq* Seq = nullptr

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

Description

Emit a source range.

Declared at: clang/include/clang/Serialization/ASTWriter.h:591

Parameters

clang::SourceRange Range
clang::ASTWriter::RecordDataImpl& Record
clang::ASTWriter::LocSeq* Seq = nullptr

void AddString(
    llvm::StringRef Str,
    clang::ASTWriter::RecordDataImpl& Record)

Description

Add a string to the given record.

Declared at: clang/include/clang/Serialization/ASTWriter.h:648

Parameters

llvm::StringRef Str
clang::ASTWriter::RecordDataImpl& Record

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

Description

Emit a token.

Declared at: clang/include/clang/Serialization/ASTWriter.h:580

Parameters

const clang::Token& Tok
clang::ASTWriter::RecordDataImpl& Record

void AddTypeRef(
    clang::QualType T,
    clang::ASTWriter::RecordDataImpl& Record)

Description

Emit a reference to a type.

Declared at: clang/include/clang/Serialization/ASTWriter.h:612

Parameters

clang::QualType T
clang::ASTWriter::RecordDataImpl& Record

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

Description

Add a version tuple to the given record

Declared at: clang/include/clang/Serialization/ASTWriter.h:662

Parameters

const llvm::VersionTuple& Version
clang::ASTWriter::RecordDataImpl& Record

void AddedAttributeToRecord(
    const clang::Attr* Attr,
    const clang::RecordDecl* Record)

Description

An attribute was added to a RecordDecl

Declared at: clang/include/clang/Serialization/ASTWriter.h:752

Parameters

const clang::Attr* Attr
The attribute that was added to the Record
const clang::RecordDecl* Record
The RecordDecl that got a new attribute

void AddedCXXImplicitMember(
    const clang::CXXRecordDecl* RD,
    const clang::Decl* D)

Description

An implicit member was added after the definition was completed.

Declared at: clang/include/clang/Serialization/ASTWriter.h:724

Parameters

const clang::CXXRecordDecl* RD
const clang::Decl* D

void AddedCXXTemplateSpecialization(
    const clang::ClassTemplateDecl* TD,
    const clang::ClassTemplateSpecializationDecl*
        D)

Description

A template specialization (or partial one) was added to the template declaration.

Declared at: clang/include/clang/Serialization/ASTWriter.h:725

Parameters

const clang::ClassTemplateDecl* TD
const clang::ClassTemplateSpecializationDecl* D

void AddedCXXTemplateSpecialization(
    const clang::VarTemplateDecl* TD,
    const clang::VarTemplateSpecializationDecl* D)

Description

A template specialization (or partial one) was added to the template declaration.

Declared at: clang/include/clang/Serialization/ASTWriter.h:728

Parameters

const clang::VarTemplateDecl* TD
const clang::VarTemplateSpecializationDecl* D

void AddedCXXTemplateSpecialization(
    const clang::FunctionTemplateDecl* TD,
    const clang::FunctionDecl* D)

Description

A template specialization (or partial one) was added to the template declaration.

Declared at: clang/include/clang/Serialization/ASTWriter.h:731

Parameters

const clang::FunctionTemplateDecl* TD
const clang::FunctionDecl* D

void AddedObjCCategoryToInterface(
    const clang::ObjCCategoryDecl* CatD,
    const clang::ObjCInterfaceDecl* IFD)

Description

A new objc category class was added for an interface.

Declared at: clang/include/clang/Serialization/ASTWriter.h:744

Parameters

const clang::ObjCCategoryDecl* CatD
const clang::ObjCInterfaceDecl* IFD

void AddedVisibleDecl(
    const clang::DeclContext* DC,
    const clang::Decl* D)

Description

A new declaration with name has been added to a DeclContext.

Declared at: clang/include/clang/Serialization/ASTWriter.h:723

Parameters

const clang::DeclContext* DC
const clang::Decl* D

void ClearSwitchCaseIDs()

Declared at: clang/include/clang/Serialization/ASTWriter.h:683

void CompletedImplicitDefinition(
    const clang::FunctionDecl* D)

Description

An implicit member got a definition.

Declared at: clang/include/clang/Serialization/ASTWriter.h:738

Parameters

const clang::FunctionDecl* D

void CompletedTagDefinition(
    const clang::TagDecl* D)

Description

A new TagDecl definition was completed.

Declared at: clang/include/clang/Serialization/ASTWriter.h:722

Parameters

const clang::TagDecl* D

void DeclarationMarkedOpenMPAllocate(
    const clang::Decl* D,
    const clang::Attr* A)

Description

A declaration is marked as a variable with OpenMP allocator.

Declared at: clang/include/clang/Serialization/ASTWriter.h:750

Parameters

const clang::Decl* D
the declaration marked as a variable with OpenMP allocator.
const clang::Attr* A

void DeclarationMarkedOpenMPDeclareTarget(
    const clang::Decl* D,
    const clang::Attr* Attr)

Description

A declaration is marked as OpenMP declaretarget which was not previously marked as declaretarget.

Declared at: clang/include/clang/Serialization/ASTWriter.h:748

Parameters

const clang::Decl* D
the declaration marked OpenMP declaretarget.
const clang::Attr* Attr
the added attribute.

void DeclarationMarkedOpenMPThreadPrivate(
    const clang::Decl* D)

Description

A declaration is marked as OpenMP threadprivate which was not previously marked as threadprivate.

Declared at: clang/include/clang/Serialization/ASTWriter.h:747

Parameters

const clang::Decl* D
the declaration marked OpenMP threadprivate.

void DeclarationMarkedUsed(const clang::Decl* D)

Description

A declaration is marked used which was not previously marked used.

Declared at: clang/include/clang/Serialization/ASTWriter.h:746

Parameters

const clang::Decl* D
the declaration marked used

void DeducedReturnType(
    const clang::FunctionDecl* FD,
    clang::QualType ReturnType)

Description

A function's return type has been deduced.

Declared at: clang/include/clang/Serialization/ASTWriter.h:734

Parameters

const clang::FunctionDecl* FD
clang::QualType ReturnType

void DefaultArgumentInstantiated(
    const clang::ParmVarDecl* D)

Description

A default argument was instantiated.

Declared at: clang/include/clang/Serialization/ASTWriter.h:742

Parameters

const clang::ParmVarDecl* D

void DefaultMemberInitializerInstantiated(
    const clang::FieldDecl* D)

Description

A default member initializer was instantiated.

Declared at: clang/include/clang/Serialization/ASTWriter.h:743

Parameters

const clang::FieldDecl* D

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

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:658

Parameters

unsigned int Abbrev
clang::ASTWriter::RecordDataRef Record
llvm::StringRef Path

void FunctionDefinitionInstantiated(
    const clang::FunctionDecl* D)

Description

A function template's definition was instantiated.

Declared at: clang/include/clang/Serialization/ASTWriter.h:741

Parameters

const clang::FunctionDecl* D

void GenerateNameLookupTable(
    const clang::DeclContext* DC,
    llvm::SmallVectorImpl<char>& LookupTable)

Declared at: clang/include/clang/Serialization/ASTWriter.h:489

Parameters

const clang::DeclContext* DC
llvm::SmallVectorImpl<char>& LookupTable

serialization::DeclID GetDeclRef(
    const clang::Decl* D)

Description

Force a declaration to be emitted and get its ID.

Declared at: clang/include/clang/Serialization/ASTWriter.h:639

Parameters

const clang::Decl* D

serialization::TypeID GetOrCreateTypeID(
    clang::QualType T)

Description

Force a type to be emitted and get its ID.

Declared at: clang/include/clang/Serialization/ASTWriter.h:615

Parameters

clang::QualType T

void IdentifierRead(serialization::IdentID ID,
                    clang::IdentifierInfo* II)

Description

An identifier was deserialized from the AST file.

Declared at: clang/include/clang/Serialization/ASTWriter.h:713

Parameters

serialization::IdentID ID
clang::IdentifierInfo* II

void InstantiationRequested(
    const clang::ValueDecl* D)

Description

The instantiation of a templated function or variable was requested. In particular, the point of instantiation and template specialization kind of \p D may have changed.

Declared at: clang/include/clang/Serialization/ASTWriter.h:739

Parameters

const clang::ValueDecl* D

bool IsLocalDecl(const clang::Decl* D)

Description

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.

Declared at: clang/include/clang/Serialization/ASTWriter.h:627

Parameters

const clang::Decl* D

void MacroDefinitionRead(
    serialization::PreprocessedEntityID ID,
    clang::MacroDefinitionRecord* MD)

Description

A macro definition was read from the AST file.

Declared at: clang/include/clang/Serialization/ASTWriter.h:717

Parameters

serialization::PreprocessedEntityID ID
clang::MacroDefinitionRecord* MD

void MacroRead(serialization::MacroID ID,
               clang::MacroInfo* MI)

Description

A macro was read from the AST file.

Declared at: clang/include/clang/Serialization/ASTWriter.h:714

Parameters

serialization::MacroID ID
clang::MacroInfo* MI

void ModuleRead(serialization::SubmoduleID ID,
                clang::Module* Mod)

Description

A module definition was read from the AST file.

Declared at: clang/include/clang/Serialization/ASTWriter.h:719

Parameters

serialization::SubmoduleID ID
clang::Module* Mod

bool PreparePathForOutput(
    SmallVectorImpl<char>& Path)

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:652

Parameters

SmallVectorImpl<char>& Path

void ReaderInitialized(clang::ASTReader* Reader)

Description

The ASTReader was initialized.

Declared at: clang/include/clang/Serialization/ASTWriter.h:712

Parameters

clang::ASTReader* Reader

unsigned int RecordSwitchCaseID(
    clang::SwitchCase* S)

Description

Record an ID for the given switch-case statement.

Declared at: clang/include/clang/Serialization/ASTWriter.h:678

Parameters

clang::SwitchCase* S

void RedefinedHiddenDefinition(
    const clang::NamedDecl* D,
    clang::Module* M)

Description

A definition has been made visible by being redefined locally.

Declared at: clang/include/clang/Serialization/ASTWriter.h:751

Parameters

const clang::NamedDecl* D
The definition that was previously not visible.
clang::Module* M
The containing module in which the definition was made visible, if any.

void ResolvedExceptionSpec(
    const clang::FunctionDecl* FD)

Description

A function's exception specification has been evaluated or instantiated.

Declared at: clang/include/clang/Serialization/ASTWriter.h:733

Parameters

const clang::FunctionDecl* FD

void ResolvedOperatorDelete(
    const clang::CXXDestructorDecl* DD,
    const clang::FunctionDecl* Delete,
    clang::Expr* ThisArg)

Description

A virtual destructor's operator delete has been resolved.

Declared at: clang/include/clang/Serialization/ASTWriter.h:735

Parameters

const clang::CXXDestructorDecl* DD
const clang::FunctionDecl* Delete
clang::Expr* ThisArg

void SelectorRead(serialization::SelectorID ID,
                  clang::Selector Sel)

Description

A selector was read from the AST file.

Declared at: clang/include/clang/Serialization/ASTWriter.h:716

Parameters

serialization::SelectorID ID
clang::Selector Sel

void SetIdentifierOffset(
    const clang::IdentifierInfo* II,
    uint32_t Offset)

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:671

Parameters

const clang::IdentifierInfo* II
uint32_t Offset

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

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:675

Parameters

clang::Selector Sel
uint32_t Offset

void TypeRead(serialization::TypeIdx Idx,
              clang::QualType T)

Description

A type was deserialized from the AST file. The ID here has the qualifier bits already removed, and T is guaranteed to be locally unqualified.

Declared at: clang/include/clang/Serialization/ASTWriter.h:715

Parameters

serialization::TypeIdx Idx
clang::QualType T

void VariableDefinitionInstantiated(
    const clang::VarDecl* D)

Description

A templated variable's definition was implicitly instantiated.

Declared at: clang/include/clang/Serialization/ASTWriter.h:740

Parameters

const clang::VarDecl* D

clang::ASTFileSignature WriteAST(
    clang::Sema& SemaRef,
    const std::string& OutputFile,
    clang::Module* WritingModule,
    llvm::StringRef isysroot,
    bool hasErrors = false,
    bool ShouldCacheASTInMemory = false)

Description

Write a precompiled header for the given semantic analysis.

Declared at: clang/include/clang/Serialization/ASTWriter.h:574

Parameters

clang::Sema& SemaRef
a reference to the semantic analysis object that processed the AST to be written into the precompiled header.
const std::string& OutputFile
clang::Module* WritingModule
The module that we are writing. If null, we are writing a precompiled header.
llvm::StringRef isysroot
if 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.
bool hasErrors = false
bool ShouldCacheASTInMemory = false

Returns

the module signature, which eventually will be a hash of the module but currently is merely a random 32-bit number.

clang::ASTFileSignature WriteASTCore(
    clang::Sema& SemaRef,
    llvm::StringRef isysroot,
    const std::string& OutputFile,
    clang::Module* WritingModule)

Declared at: clang/include/clang/Serialization/ASTWriter.h:535

Parameters

clang::Sema& SemaRef
llvm::StringRef isysroot
const std::string& OutputFile
clang::Module* WritingModule

void WriteBlockInfoBlock()

Declared at: clang/include/clang/Serialization/ASTWriter.h:456

void WriteCUDAPragmas(clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:504

Parameters

clang::Sema& SemaRef

void WriteComments()

Declared at: clang/include/clang/Serialization/ASTWriter.h:495

void WriteControlBlock(
    clang::Preprocessor& PP,
    clang::ASTContext& Context,
    llvm::StringRef isysroot,
    const std::string& OutputFile)

Declared at: clang/include/clang/Serialization/ASTWriter.h:457

Parameters

clang::Preprocessor& PP
clang::ASTContext& Context
llvm::StringRef isysroot
const std::string& OutputFile

void WriteDecl(clang::ASTContext& Context,
               clang::Decl* D)

Declared at: clang/include/clang/Serialization/ASTWriter.h:533

Parameters

clang::ASTContext& Context
clang::Decl* D

void WriteDeclAbbrevs()

Declared at: clang/include/clang/Serialization/ASTWriter.h:532

uint64_t WriteDeclContextLexicalBlock(
    clang::ASTContext& Context,
    clang::DeclContext* DC)

Declared at: clang/include/clang/Serialization/ASTWriter.h:491

Parameters

clang::ASTContext& Context
clang::DeclContext* DC

uint64_t WriteDeclContextVisibleBlock(
    clang::ASTContext& Context,
    clang::DeclContext* DC)

Declared at: clang/include/clang/Serialization/ASTWriter.h:492

Parameters

clang::ASTContext& Context
clang::DeclContext* DC

void WriteDeclContextVisibleUpdate(
    const clang::DeclContext* DC)

Declared at: clang/include/clang/Serialization/ASTWriter.h:501

Parameters

const clang::DeclContext* DC

void WriteDeclUpdatesBlocks(
    clang::ASTWriter::RecordDataImpl&
        OffsetsRecord)

Declared at: clang/include/clang/Serialization/ASTWriter.h:500

Parameters

clang::ASTWriter::RecordDataImpl& OffsetsRecord

void WriteFPPragmaOptions(
    const clang::FPOptionsOverride& Opts)

Declared at: clang/include/clang/Serialization/ASTWriter.h:502

Parameters

const clang::FPOptionsOverride& Opts

void WriteFileDeclIDsMap()

Declared at: clang/include/clang/Serialization/ASTWriter.h:494

void WriteFloatControlPragmaOptions(
    clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:511

Parameters

clang::Sema& SemaRef

void WriteHeaderSearch(
    const clang::HeaderSearch& HS)

Declared at: clang/include/clang/Serialization/ASTWriter.h:474

Parameters

const clang::HeaderSearch& HS

void WriteIdentifierTable(
    clang::Preprocessor& PP,
    clang::IdentifierResolver& IdResolver,
    bool IsModule)

Declared at: clang/include/clang/Serialization/ASTWriter.h:498

Parameters

clang::Preprocessor& PP
clang::IdentifierResolver& IdResolver
bool IsModule

void WriteInputFiles(
    clang::SourceManager& SourceMgr,
    clang::HeaderSearchOptions& HSOpts,
    std::set<const FileEntry*>&
        AffectingModuleMaps)

Declared at: clang/include/clang/Serialization/ASTWriter.h:468

Parameters

clang::SourceManager& SourceMgr
clang::HeaderSearchOptions& HSOpts
std::set<const FileEntry*>& AffectingModuleMaps

void WriteLateParsedTemplates(
    clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:506

Parameters

clang::Sema& SemaRef

void WriteMSPointersToMembersPragmaOptions(
    clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:509

Parameters

clang::Sema& SemaRef

void WriteMSStructPragmaOptions(
    clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:508

Parameters

clang::Sema& SemaRef

void WriteModuleFileExtension(
    clang::Sema& SemaRef,
    clang::ModuleFileExtensionWriter& Writer)

Declared at: clang/include/clang/Serialization/ASTWriter.h:512

Parameters

clang::Sema& SemaRef
clang::ModuleFileExtensionWriter& Writer

void WriteObjCCategories()

Declared at: clang/include/clang/Serialization/ASTWriter.h:505

void WriteOpenCLExtensions(clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:503

Parameters

clang::Sema& SemaRef

void WriteOptimizePragmaOptions(
    clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:507

Parameters

clang::Sema& SemaRef

void WritePackPragmaOptions(clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:510

Parameters

clang::Sema& SemaRef

void WritePragmaDiagnosticMappings(
    const clang::DiagnosticsEngine& Diag,
    bool isModule)

Declared at: clang/include/clang/Serialization/ASTWriter.h:479

Parameters

const clang::DiagnosticsEngine& Diag
bool isModule

void WritePreprocessor(
    const clang::Preprocessor& PP,
    bool IsModule)

Declared at: clang/include/clang/Serialization/ASTWriter.h:473

Parameters

const clang::Preprocessor& PP
bool IsModule

void WritePreprocessorDetail(
    clang::PreprocessingRecord& PPRec,
    uint64_t MacroOffsetsBase)

Declared at: clang/include/clang/Serialization/ASTWriter.h:475

Parameters

clang::PreprocessingRecord& PPRec
uint64_t MacroOffsetsBase

void WriteReferencedSelectorsPool(
    clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:497

Parameters

clang::Sema& SemaRef

void WriteSelectors(clang::Sema& SemaRef)

Declared at: clang/include/clang/Serialization/ASTWriter.h:496

Parameters

clang::Sema& SemaRef

void WriteSourceManagerBlock(
    clang::SourceManager& SourceMgr,
    const clang::Preprocessor& PP)

Declared at: clang/include/clang/Serialization/ASTWriter.h:470

Parameters

clang::SourceManager& SourceMgr
const clang::Preprocessor& PP

void WriteSubStmt(clang::Stmt* S)

Description

Write the given subexpression to the bitstream.

Declared at: clang/include/clang/Serialization/ASTWriter.h:454

Parameters

clang::Stmt* S

void WriteSubmodules(clang::Module* WritingModule)

Declared at: clang/include/clang/Serialization/ASTWriter.h:477

Parameters

clang::Module* WritingModule

void WriteType(clang::QualType T)

Declared at: clang/include/clang/Serialization/ASTWriter.h:484

Parameters

clang::QualType T

void WriteTypeAbbrevs()

Declared at: clang/include/clang/Serialization/ASTWriter.h:483

void WriteTypeDeclOffsets()

Declared at: clang/include/clang/Serialization/ASTWriter.h:493

void associateDeclWithFile(const clang::Decl* D,
                           serialization::DeclID)

Declared at: clang/include/clang/Serialization/ASTWriter.h:227

Parameters

const clang::Decl* D
serialization::DeclID

static std::pair<ASTFileSignature,
                 ASTFileSignature>
createSignature(llvm::StringRef AllBytes,
                llvm::StringRef ASTBlockBytes)

Description

Calculate hash of the pcm content.

Declared at: clang/include/clang/Serialization/ASTWriter.h:466

Parameters

llvm::StringRef AllBytes
llvm::StringRef ASTBlockBytes

clang::ASTContext& getASTContext() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:548

unsigned int getAnonymousDeclarationNumber(
    const clang::NamedDecl* D)

Declared at: clang/include/clang/Serialization/ASTWriter.h:645

Parameters

const clang::NamedDecl* D

clang::ASTReader* getChain() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:704

unsigned int getCharacterLiteralAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:699

unsigned int getDeclCXXMethodAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:696

unsigned int getDeclEnumAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:694

unsigned int getDeclFieldAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:693

serialization::DeclID getDeclID(
    const clang::Decl* D)

Description

Determine the declaration ID of an already-emitted declaration.

Declared at: clang/include/clang/Serialization/ASTWriter.h:643

Parameters

const clang::Decl* D

unsigned int getDeclObjCIvarAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:695

unsigned int getDeclParmVarAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:689

unsigned int getDeclRecordAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:690

unsigned int getDeclRefExprAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:698

unsigned int getDeclTypedefAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:691

unsigned int getDeclVarAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:692

unsigned int getExprImplicitCastAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:701

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

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:622

Parameters

const clang::Decl* D

serialization::IdentID getIdentifierRef(
    const clang::IdentifierInfo* II)

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:601

Parameters

const clang::IdentifierInfo* II

unsigned int getIntegerLiteralAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:700

const clang::LangOptions& getLangOpts() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:553

unsigned int getLocalOrImportedSubmoduleID(
    const clang::Module* Mod)

Description

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.

Declared at: clang/include/clang/Serialization/ASTWriter.h:667

Parameters

const clang::Module* Mod

uint32_t getMacroDirectivesOffset(
    const clang::IdentifierInfo* Name)

Declared at: clang/include/clang/Serialization/ASTWriter.h:609

Parameters

const clang::IdentifierInfo* Name

serialization::MacroID getMacroID(
    clang::MacroInfo* MI)

Description

Determine the ID of an already-emitted macro.

Declared at: clang/include/clang/Serialization/ASTWriter.h:607

Parameters

clang::MacroInfo* MI

serialization::MacroID getMacroRef(
    clang::MacroInfo* MI,
    const clang::IdentifierInfo* Name)

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:604

Parameters

clang::MacroInfo* MI
const clang::IdentifierInfo* Name

serialization::SelectorID getSelectorRef(
    clang::Selector Sel)

Description

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

Declared at: clang/include/clang/Serialization/ASTWriter.h:598

Parameters

clang::Selector Sel

unsigned int getSubmoduleID(clang::Module* Mod)

Description

Retrieve or create a submodule ID for this module.

Declared at: clang/include/clang/Serialization/ASTWriter.h:451

Parameters

clang::Module* Mod

unsigned int getSwitchCaseID(clang::SwitchCase* S)

Description

Retrieve the ID for the given switch-case statement.

Declared at: clang/include/clang/Serialization/ASTWriter.h:681

Parameters

clang::SwitchCase* S

time_t getTimestampForOutput(
    const clang::FileEntry* E) const

Description

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.

Declared at: clang/include/clang/Serialization/ASTWriter.h:558

Parameters

const clang::FileEntry* E

unsigned int getTypeExtQualAbbrev() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:685

serialization::TypeID getTypeID(
    clang::QualType T) const

Description

Determine the type ID of an already-emitted type.

Declared at: clang/include/clang/Serialization/ASTWriter.h:618

Parameters

clang::QualType T

bool hasChain() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:703

bool isLookupResultEntirelyExternal(
    clang::StoredDeclsList& Result,
    clang::DeclContext* DC)

Declared at: clang/include/clang/Serialization/ASTWriter.h:487

Parameters

clang::StoredDeclsList& Result
clang::DeclContext* DC

bool isLookupResultExternal(
    clang::StoredDeclsList& Result,
    clang::DeclContext* DC)

Declared at: clang/include/clang/Serialization/ASTWriter.h:486

Parameters

clang::StoredDeclsList& Result
clang::DeclContext* DC

bool isWritingNamedModules() const

Declared at: clang/include/clang/Serialization/ASTWriter.h:706

void writeIncludedFiles(
    llvm::raw_ostream& Out,
    const clang::Preprocessor& PP)

Declared at: clang/include/clang/Serialization/ASTWriter.h:472

Parameters

llvm::raw_ostream& Out
const clang::Preprocessor& PP

clang::ASTFileSignature writeUnhashedControlBlock(
    clang::Preprocessor& PP,
    clang::ASTContext& Context)

Description

Write out the signature and diagnostic options, and return the signature.

Declared at: clang/include/clang/Serialization/ASTWriter.h:461

Parameters

clang::Preprocessor& PP
clang::ASTContext& Context

~ASTWriter()

Declared at: clang/include/clang/Serialization/ASTWriter.h:546