14 #ifndef LLVM_CLANG_SERIALIZATION_ASTWRITER_H
15 #define LLVM_CLANG_SERIALIZATION_ASTWRITER_H
25 #include "llvm/ADT/DenseMap.h"
26 #include "llvm/ADT/DenseSet.h"
27 #include "llvm/ADT/MapVector.h"
28 #include "llvm/ADT/SetVector.h"
29 #include "llvm/ADT/SmallPtrSet.h"
30 #include "llvm/ADT/SmallVector.h"
31 #include "llvm/Bitcode/BitstreamWriter.h"
39 class BitstreamWriter;
46 class NestedNameSpecifier;
47 class CXXBaseSpecifier;
48 class CXXCtorInitializer;
52 class HeaderSearchOptions;
53 class IdentifierResolver;
54 class MacroDefinitionRecord;
57 class OpaqueValueExpr;
61 class ModuleFileExtension;
62 class ModuleFileExtensionWriter;
63 class PreprocessedEntity;
64 class PreprocessingRecord;
69 struct StoredDeclsList;
74 class ASTUnresolvedSet;
76 namespace SrcMgr {
class SLocEntry; }
108 llvm::BitstreamWriter &Stream;
123 std::string BaseDirectory;
129 bool IncludeTimestamps;
137 bool DoneWritingDeclsAndTypes;
140 bool ASTHasCompilerErrors;
144 llvm::DenseMap<const FileEntry *, uint32_t> InputFileIDs;
149 DeclOrType(
Decl *D) : Stored(D), IsType(
false) { }
150 DeclOrType(
QualType T) : Stored(T.getAsOpaquePtr()), IsType(
true) { }
152 bool isType()
const {
return IsType; }
153 bool isDecl()
const {
return !IsType; }
155 QualType getType()
const {
156 assert(isType() &&
"Not a type!");
160 Decl *getDecl()
const {
161 assert(isDecl() &&
"Not a decl!");
162 return static_cast<Decl *
>(Stored);
171 std::queue<DeclOrType> DeclTypesToEmit;
185 llvm::DenseMap<const Decl *, serialization::DeclID> DeclIDs;
189 std::vector<serialization::DeclOffset> DeclOffsets;
192 typedef SmallVector<std::pair<unsigned, serialization::DeclID>, 64>
194 struct DeclIDInFileInfo {
195 LocDeclIDsTy DeclIDs;
198 unsigned FirstDeclIndex;
200 typedef llvm::DenseMap<FileID, DeclIDInFileInfo *> FileDeclIDsTy;
204 FileDeclIDsTy FileDeclIDs;
227 std::vector<uint32_t> TypeOffsets;
241 llvm::MapVector<const IdentifierInfo *, serialization::IdentID> IdentifierIDs;
250 llvm::DenseMap<MacroInfo *, serialization::MacroID> MacroIDs;
252 struct MacroInfoToEmitData {
253 const IdentifierInfo *
Name;
258 std::vector<MacroInfoToEmitData> MacroInfosToEmit;
260 llvm::DenseMap<const IdentifierInfo *, uint64_t> IdentMacroDirectivesOffsetMap;
270 llvm::DenseMap<Stmt *, uint64_t> SubStmtEntries;
276 std::vector<uint32_t> IdentifierOffsets;
291 llvm::MapVector<Selector, serialization::SelectorID> SelectorIDs;
295 std::vector<uint32_t> SelectorOffsets;
299 llvm::DenseMap<
const MacroDefinitionRecord *,
304 llvm::DenseMap<const Decl *, unsigned> AnonymousDeclarationNumbers;
316 const Attr *Attribute;
320 DeclUpdate(
unsigned Kind) : Kind(Kind), Dcl(nullptr) {}
321 DeclUpdate(
unsigned Kind,
const Decl *Dcl) : Kind(Kind), Dcl(Dcl) {}
322 DeclUpdate(
unsigned Kind, QualType Type)
323 : Kind(Kind), Type(Type.getAsOpaquePtr()) {}
324 DeclUpdate(
unsigned Kind, SourceLocation Loc)
325 : Kind(Kind), Loc(Loc.getRawEncoding()) {}
326 DeclUpdate(
unsigned Kind,
unsigned Val)
327 : Kind(Kind), Val(Val) {}
328 DeclUpdate(
unsigned Kind, Module *M)
329 : Kind(Kind), Mod(M) {}
330 DeclUpdate(
unsigned Kind,
const Attr *Attribute)
331 : Kind(Kind), Attribute(Attribute) {}
334 const Decl *getDecl()
const {
return Dcl; }
336 SourceLocation getLoc()
const {
339 unsigned getNumber()
const {
return Val; }
340 Module *getModule()
const {
return Mod; }
341 const Attr *getAttr()
const {
return Attribute; }
344 typedef SmallVector<DeclUpdate, 1> UpdateRecord;
345 typedef llvm::MapVector<const Decl *, UpdateRecord> DeclUpdateMap;
348 DeclUpdateMap DeclUpdates;
350 typedef llvm::DenseMap<Decl *, Decl *> FirstLatestDeclMap;
353 FirstLatestDeclMap FirstLatestDecls;
366 SmallVector<uint64_t, 16> EagerlyDeserializedDecls;
379 SmallVector<const Decl *, 16> UpdatingVisibleDecls;
383 llvm::SetVector<ObjCInterfaceDecl *> ObjCClassesWithCategories;
385 struct ReplacedDeclInfo {
390 ReplacedDeclInfo() :
ID(0),
Offset(0), Loc(0) {}
393 : ID(ID), Offset(Offset), Loc(Loc.getRawEncoding()) {}
402 SmallVector<ReplacedDeclInfo, 16> ReplacedDecls;
410 llvm::DenseMap<const Decl *, const Decl *> FirstLocalDeclCache;
414 SmallVector<Stmt *, 16> StmtsToEmit;
418 SmallVector<Stmt *, 16> *CollectedStmts;
421 llvm::DenseMap<SwitchCase *, unsigned> SwitchCaseIDs;
424 unsigned NumStatements;
431 unsigned NumLexicalDeclContexts;
435 unsigned NumVisibleDeclContexts;
438 SmallVector<uint32_t, 16> CXXBaseSpecifiersOffsets;
449 struct QueuedCXXBaseSpecifiers {
450 QueuedCXXBaseSpecifiers() :
ID(), Bases(), BasesEnd() { }
453 CXXBaseSpecifier
const *Bases,
454 CXXBaseSpecifier
const *BasesEnd)
455 : ID(ID), Bases(Bases), BasesEnd(BasesEnd) { }
458 CXXBaseSpecifier
const * Bases;
459 CXXBaseSpecifier
const * BasesEnd;
464 SmallVector<QueuedCXXBaseSpecifiers, 2> CXXBaseSpecifiersToWrite;
467 SmallVector<uint32_t, 16> CXXCtorInitializersOffsets;
478 struct QueuedCXXCtorInitializers {
479 QueuedCXXCtorInitializers() :
ID() {}
482 ArrayRef<CXXCtorInitializer*>
Inits)
483 : ID(ID), Inits(Inits) {}
486 ArrayRef<CXXCtorInitializer*>
Inits;
491 SmallVector<QueuedCXXCtorInitializers, 2> CXXCtorInitializersToWrite;
495 llvm::DenseMap<Module *, unsigned> SubmoduleIDs;
498 std::vector<std::unique_ptr<ModuleFileExtensionWriter>>
499 ModuleFileExtensionWriters;
502 unsigned getSubmoduleID(Module *Mod);
505 void WriteSubStmt(
Stmt *
S,
506 llvm::DenseMap<Stmt *, uint64_t> &SubStmtEntries,
509 void WriteBlockInfoBlock();
510 uint64_t WriteControlBlock(Preprocessor &PP,
ASTContext &Context,
511 StringRef isysroot,
const std::string &OutputFile);
512 void WriteInputFiles(SourceManager &
SourceMgr, HeaderSearchOptions &HSOpts,
514 void WriteSourceManagerBlock(SourceManager &
SourceMgr,
515 const Preprocessor &PP);
516 void WritePreprocessor(
const Preprocessor &PP,
bool IsModule);
517 void WriteHeaderSearch(
const HeaderSearch &HS);
518 void WritePreprocessorDetail(PreprocessingRecord &PPRec);
519 void WriteSubmodules(Module *WritingModule);
521 void WritePragmaDiagnosticMappings(
const DiagnosticsEngine &
Diag,
523 void WriteCXXBaseSpecifiersOffsets();
524 void WriteCXXCtorInitializersOffsets();
526 unsigned TypeExtQualAbbrev;
527 unsigned TypeFunctionProtoAbbrev;
528 void WriteTypeAbbrevs();
529 void WriteType(QualType T);
531 bool isLookupResultExternal(StoredDeclsList &
Result, DeclContext *DC);
532 bool isLookupResultEntirelyExternal(StoredDeclsList &
Result, DeclContext *DC);
534 void GenerateNameLookupTable(
const DeclContext *DC,
536 uint64_t WriteDeclContextLexicalBlock(
ASTContext &Context, DeclContext *DC);
537 uint64_t WriteDeclContextVisibleBlock(
ASTContext &Context, DeclContext *DC);
538 void WriteTypeDeclOffsets();
539 void WriteFileDeclIDsMap();
540 void WriteComments();
541 void WriteSelectors(Sema &SemaRef);
542 void WriteReferencedSelectorsPool(Sema &SemaRef);
543 void WriteIdentifierTable(Preprocessor &PP, IdentifierResolver &IdResolver,
545 void WriteAttributes(ArrayRef<const Attr*> Attrs,
RecordDataImpl &Record);
547 void WriteDeclReplacementsBlock();
548 void WriteDeclContextVisibleUpdate(
const DeclContext *DC);
549 void WriteFPPragmaOptions(
const FPOptions &Opts);
550 void WriteOpenCLExtensions(Sema &SemaRef);
551 void WriteObjCCategories();
552 void WriteLateParsedTemplates(Sema &SemaRef);
553 void WriteOptimizePragmaOptions(Sema &SemaRef);
554 void WriteModuleFileExtension(Sema &SemaRef,
555 ModuleFileExtensionWriter &Writer);
557 unsigned DeclParmVarAbbrev;
558 unsigned DeclContextLexicalAbbrev;
559 unsigned DeclContextVisibleLookupAbbrev;
560 unsigned UpdateVisibleAbbrev;
561 unsigned DeclRecordAbbrev;
562 unsigned DeclTypedefAbbrev;
563 unsigned DeclVarAbbrev;
564 unsigned DeclFieldAbbrev;
565 unsigned DeclEnumAbbrev;
566 unsigned DeclObjCIvarAbbrev;
567 unsigned DeclCXXMethodAbbrev;
569 unsigned DeclRefExprAbbrev;
570 unsigned CharacterLiteralAbbrev;
571 unsigned IntegerLiteralAbbrev;
572 unsigned ExprImplicitCastAbbrev;
574 void WriteDeclAbbrevs();
576 void AddFunctionDefinition(
const FunctionDecl *FD,
RecordData &Record);
578 uint64_t WriteASTCore(Sema &SemaRef,
579 StringRef isysroot,
const std::string &OutputFile,
580 Module *WritingModule);
587 bool IncludeTimestamps =
true);
611 uint64_t
WriteAST(Sema &SemaRef,
const std::string &OutputFile,
612 Module *WritingModule, StringRef isysroot,
613 bool hasErrors =
false);
644 CXXBaseSpecifier
const *BasesEnd,
678 const TemplateArgumentLocInfo &Arg,
687 const ASTTemplateArgumentListInfo *ASTTemplArgList,
750 const CXXCtorInitializer *
const *CtorInitializers,
751 unsigned NumCtorInitializers,
799 CollectedStmts->push_back(S);
831 return TypeExtQualAbbrev;
834 return TypeFunctionProtoAbbrev;
889 std::string OutputFile;
891 std::string isysroot;
893 std::shared_ptr<PCHBuffer> Buffer;
894 llvm::BitstreamWriter Stream;
896 bool AllowASTWithErrors;
907 std::shared_ptr<PCHBuffer> Buffer,
909 bool AllowASTWithErrors =
false,
910 bool IncludeTimestamps =
true);
void AddTemplateArgument(const TemplateArgument &Arg, RecordDataImpl &Record)
Emit a template argument.
unsigned getDeclParmVarAbbrev() const
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
uint64_t getMacroDirectivesOffset(const IdentifierInfo *Name)
void AddedVisibleDecl(const DeclContext *DC, const Decl *D) override
A new declaration with name has been added to a DeclContext.
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo, RecordDataImpl &Record)
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
void FunctionDefinitionInstantiated(const FunctionDecl *D) override
A function template's definition was instantiated.
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
void AddAPInt(const llvm::APInt &Value, RecordDataImpl &Record)
Emit an integral value.
A structure for putting "fast"-unqualified QualTypes into a DenseMap.
unsigned getTypeExtQualAbbrev() const
void MacroDefinitionRead(serialization::PreprocessedEntityID ID, MacroDefinitionRecord *MD) override
A macro definition was read from the AST file.
uint32_t IdentID
An ID number that refers to an identifier in an AST file.
const LangOptions & getLangOpts() const
void InitializeSema(Sema &S) override
Initialize the semantic consumer with the Sema instance being used to perform semantic analysis on th...
Decl - This represents one declaration (or definition), e.g.
void CompletedTagDefinition(const TagDecl *D) override
A new TagDecl definition was completed.
void ReaderInitialized(ASTReader *Reader) override
The ASTReader was initialized.
unsigned getDeclRefExprAbbrev() const
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
void AddTypeSourceInfo(TypeSourceInfo *TInfo, RecordDataImpl &Record)
Emits a reference to a declarator info.
void AddTemplateName(TemplateName Name, RecordDataImpl &Record)
Emit a template name.
serialization::DeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its ID.
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void AddCXXCtorInitializersRef(ArrayRef< CXXCtorInitializer * > Inits, RecordDataImpl &Record)
Emit the ID for a CXXCtorInitializer array and register the array for later serialization.
void AddTypeRef(QualType T, RecordDataImpl &Record)
Emit a reference to a type.
serialization::MacroID getMacroRef(MacroInfo *MI, const IdentifierInfo *Name)
Get the unique number used to refer to the given macro.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override
A declaration is marked as OpenMP threadprivate which was not previously marked as threadprivate...
void AddCXXTemporary(const CXXTemporary *Temp, RecordDataImpl &Record)
Emit a CXXTemporary.
serialization::IdentID getIdentifierRef(const IdentifierInfo *II)
Get the unique number used to refer to the given identifier.
ParmVarDecl - Represents a parameter to a function.
void AddIdentifierRef(const IdentifierInfo *II, RecordDataImpl &Record)
Emit a reference to an identifier.
RecordDecl - Represents a struct/union/class.
void AddQualifierInfo(const QualifierInfo &Info, RecordDataImpl &Record)
One of these records is kept for each identifier that is lexed.
unsigned getDeclVarAbbrev() const
time_t getTimestampForOutput(const FileEntry *E) const
Get a timestamp for output into the AST file.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
void AddTypeLoc(TypeLoc TL, RecordDataImpl &Record)
Emits a type with source-location information.
unsigned getDeclRecordAbbrev() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Record the location of a macro definition.
void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) override
A definition has been made visible by being redefined locally.
void HandleTranslationUnit(ASTContext &Ctx) override
HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been par...
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
unsigned getDeclEnumAbbrev() const
void ResolvedOperatorDelete(const CXXDestructorDecl *DD, const FunctionDecl *Delete) override
A virtual destructor's operator delete has been resolved.
Describes a module or submodule.
An abstract interface that should be implemented by clients that read ASTs and then require further s...
serialization::MacroID getMacroID(MacroInfo *MI)
Determine the ID of an already-emitted macro.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
SmallVector< uint64_t, 64 > RecordData
PCHGenerator(const Preprocessor &PP, StringRef OutputFile, clang::Module *Module, StringRef isysroot, std::shared_ptr< PCHBuffer > Buffer, ArrayRef< llvm::IntrusiveRefCntPtr< ModuleFileExtension >> Extensions, bool AllowASTWithErrors=false, bool IncludeTimestamps=true)
void IdentifierRead(serialization::IdentID ID, IdentifierInfo *II) override
An identifier was deserialized from the AST file.
void AddSourceRange(SourceRange Range, RecordDataImpl &Record)
Emit a source range.
void AddTemplateParameterList(const TemplateParameterList *TemplateParams, RecordDataImpl &Record)
Emit a template parameter list.
void AddSelectorRef(Selector, RecordDataImpl &Record)
Emit a Selector (which is a smart pointer reference).
unsigned getDeclObjCIvarAbbrev() const
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg, RecordDataImpl &Record)
Emits a template argument location.
void StaticDataMemberInstantiated(const VarDecl *D) override
A static data member was implicitly instantiated.
Represents an ObjC class declaration.
void AddDeclarationName(DeclarationName Name, RecordDataImpl &Record)
Emit a declaration name.
serialization::TypeID getTypeID(QualType T) const
Determine the type ID of an already-emitted type.
serialization::SubmoduleID inferSubmoduleIDFromLocation(SourceLocation Loc)
Infer the submodule ID that contains an entity at the given source location.
unsigned RecordSwitchCaseID(SwitchCase *S)
Record an ID for the given switch-case statement.
void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, const ObjCInterfaceDecl *IFD) override
A new objc category class was added for an interface.
void AddedAttributeToRecord(const Attr *Attr, const RecordDecl *Record) override
An attribute was added to a RecordDecl.
void SelectorRead(serialization::SelectorID ID, Selector Sel) override
A selector was read from the AST file.
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, RecordDataImpl &Record)
Emit a nested name specifier with source-location information.
void ModuleRead(serialization::SubmoduleID ID, Module *Mod) override
A module definition was read from the AST file.
Sema - This implements semantic analysis and AST building for C.
unsigned getCharacterLiteralAbbrev() const
unsigned getSwitchCaseID(SwitchCase *S)
Retrieve the ID for the given switch-case statement.
void AddPath(StringRef Path, RecordDataImpl &Record)
Add a path to the given record.
ID
Defines the set of possible language-specific address spaces.
void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs, RecordDataImpl &Record)
Emit a template argument list.
void FlushCXXBaseSpecifiers()
Flush all of the C++ base specifier sets that have been added via AddCXXBaseSpecifiersRef().
ASTDeserializationListener * GetASTDeserializationListener() override
If the consumer is interested in entities being deserialized from AST files, it should return a point...
bool hasEmittedPCH() const
unsigned getExprImplicitCastAbbrev() const
Represents a C++ destructor within a class.
ArgKind
The kind of template argument we're storing.
serialization::TypeID GetOrCreateTypeID(QualType T)
Force a type to be emitted and get its ID.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
void AddString(StringRef Str, RecordDataImpl &Record)
Add a string to the given record.
unsigned getLocalOrImportedSubmoduleID(Module *Mod)
Retrieve or create a submodule ID for this module, or return 0 if the submodule is neither local (a s...
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base, RecordDataImpl &Record)
Emit a C++ base specifier.
void FlushPendingAfterDecl()
Flush all pending records that are tacked onto the end of decl and decl update records.
unsigned getDeclFieldAbbrev() const
The result type of a method or function.
void MacroRead(serialization::MacroID ID, MacroInfo *MI) override
A macro was read from the AST file.
SmallVectorImpl< char > & getPCH() const
The l-value was considered opaque, so the alignment was determined from a type.
void AddSourceLocation(SourceLocation Loc, RecordDataImpl &Record)
Emit a source location.
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
void AddAPSInt(const llvm::APSInt &Value, RecordDataImpl &Record)
Emit a signed integral value.
void AddTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind, const TemplateArgumentLocInfo &Arg, RecordDataImpl &Record)
Emits a template argument location info.
TagDecl - Represents the declaration of a struct/union/class/enum.
void DefaultArgumentInstantiated(const ParmVarDecl *D) override
A default argument was instantiated.
ObjCCategoryDecl - Represents a category declaration.
unsigned getIntegerLiteralAbbrev() const
void CompletedImplicitDefinition(const FunctionDecl *D) override
An implicit member got a definition.
uint32_t MacroID
An ID number that refers to a macro in an AST file.
void AddCXXDefinitionData(const CXXRecordDecl *D, RecordDataImpl &Record)
void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record)
Add a version tuple to the given record.
void AddNestedNameSpecifier(NestedNameSpecifier *NNS, RecordDataImpl &Record)
Emit a nested name specifier.
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
bool PreparePathForOutput(SmallVectorImpl< char > &Path)
Convert a path from this build process into one that is appropriate for emission in the module file...
static QualType getFromOpaquePtr(const void *Ptr)
void AddCXXBaseSpecifiersRef(CXXBaseSpecifier const *Bases, CXXBaseSpecifier const *BasesEnd, RecordDataImpl &Record)
Emit a set of C++ base specifiers to the record.
SmallVectorImpl< uint64_t > RecordDataImpl
ASTMutationListener * GetASTMutationListener() override
If the consumer is interested in entities getting modified after their initial creation, it should return a pointer to an ASTMutationListener here.
void SetIdentifierOffset(const IdentifierInfo *II, uint32_t Offset)
Note that the identifier II occurs at the given offset within the identifier table.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name, RecordDataImpl &Record)
void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) override
A function's return type has been deduced.
const ASTWriter & getWriter() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void AddASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *ASTTemplArgList, RecordDataImpl &Record)
Emits an AST template argument list info.
unsigned getDeclCXXMethodAbbrev() const
Reads an AST files chain containing the contents of a translation unit.
void AddUnresolvedSet(const ASTUnresolvedSet &Set, RecordDataImpl &Record)
Emit a UnresolvedSet structure.
detail::InMemoryDirectory::const_iterator E
uint32_t CXXCtorInitializersID
An ID number that refers to a list of CXXCtorInitializers in an AST file.
Encapsulates the data about a macro definition (e.g.
unsigned getTypeFunctionProtoAbbrev() const
void ResolvedExceptionSpec(const FunctionDecl *FD) override
A function's exception specification has been evaluated or instantiated.
void FlushCXXCtorInitializers()
Flush all of the C++ constructor initializer lists that have been added via AddCXXCtorInitializersRef...
serialization::SelectorID getSelectorRef(Selector Sel)
Get the unique number used to refer to the given selector.
void EmitRecordWithPath(unsigned Abbrev, RecordDataRef Record, StringRef Path)
Emit the current record with the given path as a blob.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
void SetSelectorOffset(Selector Sel, uint32_t Offset)
Note that the selector Sel occurs at the given offset within the method pool/selector table...
Represents a C++ struct/union/class.
void FlushStmts()
Flush all of the statements and expressions that have been added to the queue via AddStmt()...
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
void DeclarationMarkedUsed(const Decl *D) override
A declaration is marked used which was not previously marked used.
ASTReader * getChain() const
Writes an AST file containing the contents of a translation unit.
ArrayRef< uint64_t > RecordDataRef
serialization::DeclID getDeclID(const Decl *D)
Determine the declaration ID of an already-emitted declaration.
uint64_t WriteAST(Sema &SemaRef, const std::string &OutputFile, Module *WritingModule, StringRef isysroot, bool hasErrors=false)
Write a precompiled header for the given semantic analysis.
static Decl::Kind getKind(const Decl *D)
void ClearSwitchCaseIDs()
unsigned getDeclTypedefAbbrev() const
AST and semantic-analysis consumer that generates a precompiled header from the parsed source code...
void AddCXXCtorInitializers(const CXXCtorInitializer *const *CtorInitializers, unsigned NumCtorInitializers, RecordDataImpl &Record)
Emit a CXXCtorInitializer array.
uint32_t TypeID
An ID number that refers to a type in an AST file.
NamedDecl - This represents a decl with a name.
uint32_t CXXBaseSpecifiersID
An ID number that refers to a set of CXXBaseSpecifiers in an AST file.
void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) override
An implicit member was added after the definition was completed.
A type index; the type ID with the qualifier bits removed.
Attr - This represents one attribute.
void TypeRead(serialization::TypeIdx Idx, QualType T) override
A type was deserialized from the AST file.
ASTWriter(llvm::BitstreamWriter &Stream, ArrayRef< llvm::IntrusiveRefCntPtr< ModuleFileExtension >> Extensions, bool IncludeTimestamps=true)
Create a new precompiled header writer that outputs to the given bitstream.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void AddAPFloat(const llvm::APFloat &Value, RecordDataImpl &Record)
Emit a floating-point value.