14 #ifndef LLVM_CLANG_SERIALIZATION_ASTWRITER_H
15 #define LLVM_CLANG_SERIALIZATION_ASTWRITER_H
24 #include "llvm/ADT/DenseMap.h"
25 #include "llvm/ADT/DenseSet.h"
26 #include "llvm/ADT/MapVector.h"
27 #include "llvm/ADT/SetVector.h"
28 #include "llvm/ADT/SmallVector.h"
29 #include "llvm/Bitcode/BitstreamWriter.h"
40 class DeclarationName;
43 class NestedNameSpecifier;
44 class CXXBaseSpecifier;
45 class CXXCtorInitializer;
49 class HeaderSearchOptions;
50 class IdentifierResolver;
51 class MacroDefinitionRecord;
54 class OpaqueValueExpr;
57 class MemoryBufferCache;
59 class ModuleFileExtension;
60 class ModuleFileExtensionWriter;
61 class PreprocessedEntity;
62 class PreprocessingRecord;
67 struct StoredDeclsList;
72 class ASTUnresolvedSet;
74 namespace SrcMgr {
class SLocEntry; }
108 llvm::BitstreamWriter &Stream;
126 Module *WritingModule =
nullptr;
129 std::string BaseDirectory;
135 bool IncludeTimestamps;
139 bool WritingAST =
false;
143 bool DoneWritingDeclsAndTypes =
false;
146 bool ASTHasCompilerErrors =
false;
150 llvm::DenseMap<const FileEntry *, uint32_t> InputFileIDs;
155 DeclOrType(
Decl *D) : Stored(D), IsType(
false) { }
156 DeclOrType(
QualType T) : Stored(T.getAsOpaquePtr()), IsType(
true) { }
158 bool isType()
const {
return IsType; }
159 bool isDecl()
const {
return !IsType; }
161 QualType getType()
const {
162 assert(isType() &&
"Not a type!");
166 Decl *getDecl()
const {
167 assert(isDecl() &&
"Not a decl!");
168 return static_cast<Decl *
>(Stored);
177 std::queue<DeclOrType> DeclTypesToEmit;
191 llvm::DenseMap<const Decl *, serialization::DeclID> DeclIDs;
195 std::vector<serialization::DeclOffset> DeclOffsets;
198 typedef SmallVector<std::pair<unsigned, serialization::DeclID>, 64>
200 struct DeclIDInFileInfo {
201 LocDeclIDsTy DeclIDs;
204 unsigned FirstDeclIndex;
206 typedef llvm::DenseMap<FileID, DeclIDInFileInfo *> FileDeclIDsTy;
210 FileDeclIDsTy FileDeclIDs;
233 std::vector<uint32_t> TypeOffsets;
247 llvm::MapVector<const IdentifierInfo *, serialization::IdentID> IdentifierIDs;
256 llvm::DenseMap<MacroInfo *, serialization::MacroID> MacroIDs;
258 struct MacroInfoToEmitData {
259 const IdentifierInfo *
Name;
264 std::vector<MacroInfoToEmitData> MacroInfosToEmit;
266 llvm::DenseMap<const IdentifierInfo *, uint64_t> IdentMacroDirectivesOffsetMap;
276 llvm::DenseMap<Stmt *, uint64_t> SubStmtEntries;
282 std::vector<uint32_t> IdentifierOffsets;
299 llvm::MapVector<Selector, serialization::SelectorID> SelectorIDs;
303 std::vector<uint32_t> SelectorOffsets;
307 llvm::DenseMap<
const MacroDefinitionRecord *,
312 llvm::DenseMap<const Decl *, unsigned> AnonymousDeclarationNumbers;
324 const Attr *Attribute;
328 DeclUpdate(
unsigned Kind) : Kind(Kind), Dcl(nullptr) {}
329 DeclUpdate(
unsigned Kind,
const Decl *Dcl) : Kind(Kind), Dcl(Dcl) {}
330 DeclUpdate(
unsigned Kind, QualType Type)
331 : Kind(Kind), Type(Type.getAsOpaquePtr()) {}
332 DeclUpdate(
unsigned Kind, SourceLocation Loc)
333 : Kind(Kind), Loc(Loc.getRawEncoding()) {}
334 DeclUpdate(
unsigned Kind,
unsigned Val)
335 : Kind(Kind), Val(Val) {}
336 DeclUpdate(
unsigned Kind, Module *M)
337 : Kind(Kind), Mod(M) {}
338 DeclUpdate(
unsigned Kind,
const Attr *Attribute)
339 : Kind(Kind), Attribute(Attribute) {}
342 const Decl *getDecl()
const {
return Dcl; }
344 SourceLocation getLoc()
const {
347 unsigned getNumber()
const {
return Val; }
348 Module *getModule()
const {
return Mod; }
349 const Attr *getAttr()
const {
return Attribute; }
352 typedef SmallVector<DeclUpdate, 1> UpdateRecord;
353 typedef llvm::MapVector<const Decl *, UpdateRecord> DeclUpdateMap;
356 DeclUpdateMap DeclUpdates;
358 typedef llvm::DenseMap<Decl *, Decl *> FirstLatestDeclMap;
361 FirstLatestDeclMap FirstLatestDecls;
374 SmallVector<uint64_t, 16> EagerlyDeserializedDecls;
375 SmallVector<uint64_t, 16> ModularCodegenDecls;
389 SmallVector<const Decl *, 16> DeclsToEmitEvenIfUnreferenced;
393 llvm::SetVector<ObjCInterfaceDecl *> ObjCClassesWithCategories;
401 llvm::DenseMap<const Decl *, const Decl *> FirstLocalDeclCache;
404 llvm::DenseMap<SwitchCase *, unsigned> SwitchCaseIDs;
407 unsigned NumStatements = 0;
410 unsigned NumMacros = 0;
414 unsigned NumLexicalDeclContexts = 0;
418 unsigned NumVisibleDeclContexts = 0;
422 llvm::DenseMap<Module *, unsigned> SubmoduleIDs;
425 std::vector<std::unique_ptr<ModuleFileExtensionWriter>>
426 ModuleFileExtensionWriters;
429 unsigned getSubmoduleID(Module *Mod);
432 void WriteSubStmt(Stmt *
S);
434 void WriteBlockInfoBlock();
435 void WriteControlBlock(Preprocessor &PP, ASTContext &Context,
436 StringRef isysroot,
const std::string &OutputFile);
439 ASTFileSignature writeUnhashedControlBlock(Preprocessor &PP,
440 ASTContext &Context);
443 static ASTFileSignature createSignature(StringRef Bytes);
445 void WriteInputFiles(SourceManager &
SourceMgr, HeaderSearchOptions &HSOpts,
447 void WriteSourceManagerBlock(SourceManager &
SourceMgr,
448 const Preprocessor &PP);
449 void WritePreprocessor(
const Preprocessor &PP,
bool IsModule);
450 void WriteHeaderSearch(
const HeaderSearch &HS);
451 void WritePreprocessorDetail(PreprocessingRecord &PPRec);
452 void WriteSubmodules(Module *WritingModule);
454 void WritePragmaDiagnosticMappings(
const DiagnosticsEngine &
Diag,
457 unsigned TypeExtQualAbbrev = 0;
458 unsigned TypeFunctionProtoAbbrev = 0;
459 void WriteTypeAbbrevs();
460 void WriteType(QualType T);
462 bool isLookupResultExternal(StoredDeclsList &
Result, DeclContext *DC);
463 bool isLookupResultEntirelyExternal(StoredDeclsList &
Result, DeclContext *DC);
465 void GenerateNameLookupTable(
const DeclContext *DC,
467 uint64_t WriteDeclContextLexicalBlock(ASTContext &Context, DeclContext *DC);
468 uint64_t WriteDeclContextVisibleBlock(ASTContext &Context, DeclContext *DC);
469 void WriteTypeDeclOffsets();
470 void WriteFileDeclIDsMap();
471 void WriteComments();
472 void WriteSelectors(Sema &SemaRef);
473 void WriteReferencedSelectorsPool(Sema &SemaRef);
474 void WriteIdentifierTable(Preprocessor &PP, IdentifierResolver &IdResolver,
477 void WriteDeclContextVisibleUpdate(
const DeclContext *DC);
478 void WriteFPPragmaOptions(
const FPOptions &Opts);
479 void WriteOpenCLExtensions(Sema &SemaRef);
480 void WriteOpenCLExtensionTypes(Sema &SemaRef);
481 void WriteOpenCLExtensionDecls(Sema &SemaRef);
482 void WriteCUDAPragmas(Sema &SemaRef);
483 void WriteObjCCategories();
484 void WriteLateParsedTemplates(Sema &SemaRef);
485 void WriteOptimizePragmaOptions(Sema &SemaRef);
486 void WriteMSStructPragmaOptions(Sema &SemaRef);
487 void WriteMSPointersToMembersPragmaOptions(Sema &SemaRef);
488 void WritePackPragmaOptions(Sema &SemaRef);
489 void WriteModuleFileExtension(Sema &SemaRef,
490 ModuleFileExtensionWriter &Writer);
492 unsigned DeclParmVarAbbrev = 0;
493 unsigned DeclContextLexicalAbbrev = 0;
494 unsigned DeclContextVisibleLookupAbbrev = 0;
495 unsigned UpdateVisibleAbbrev = 0;
496 unsigned DeclRecordAbbrev = 0;
497 unsigned DeclTypedefAbbrev = 0;
498 unsigned DeclVarAbbrev = 0;
499 unsigned DeclFieldAbbrev = 0;
500 unsigned DeclEnumAbbrev = 0;
501 unsigned DeclObjCIvarAbbrev = 0;
502 unsigned DeclCXXMethodAbbrev = 0;
504 unsigned DeclRefExprAbbrev = 0;
505 unsigned CharacterLiteralAbbrev = 0;
506 unsigned IntegerLiteralAbbrev = 0;
507 unsigned ExprImplicitCastAbbrev = 0;
509 void WriteDeclAbbrevs();
510 void WriteDecl(ASTContext &Context, Decl *D);
512 ASTFileSignature WriteASTCore(Sema &SemaRef, StringRef isysroot,
513 const std::string &OutputFile,
514 Module *WritingModule);
519 ASTWriter(llvm::BitstreamWriter &Stream, SmallVectorImpl<char> &Buffer,
520 MemoryBufferCache &PCMCache,
521 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
522 bool IncludeTimestamps =
true);
546 ASTFileSignature
WriteAST(Sema &SemaRef,
const std::string &OutputFile,
547 Module *WritingModule, StringRef isysroot,
548 bool hasErrors =
false);
595 auto I = DeclIDs.find(D);
596 return (
I == DeclIDs.end() ||
652 return TypeExtQualAbbrev;
655 return TypeFunctionProtoAbbrev;
677 void ReaderInitialized(
ASTReader *Reader)
override;
687 void CompletedTagDefinition(
const TagDecl *D)
override;
690 void AddedCXXTemplateSpecialization(
693 void AddedCXXTemplateSpecialization(
698 void ResolvedExceptionSpec(
const FunctionDecl *FD)
override;
702 void CompletedImplicitDefinition(
const FunctionDecl *D)
override;
703 void StaticDataMemberInstantiated(
const VarDecl *D)
override;
704 void DefaultArgumentInstantiated(
const ParmVarDecl *D)
override;
705 void DefaultMemberInitializerInstantiated(
const FieldDecl *D)
override;
706 void FunctionDefinitionInstantiated(
const FunctionDecl *D)
override;
709 void DeclarationMarkedUsed(
const Decl *D)
override;
710 void DeclarationMarkedOpenMPThreadPrivate(
const Decl *D)
override;
711 void DeclarationMarkedOpenMPDeclareTarget(
const Decl *D,
713 void RedefinedHiddenDefinition(
const NamedDecl *D,
Module *M)
override;
714 void AddedAttributeToRecord(
const Attr *
Attr,
735 void FlushSubStmts();
737 void PrepareToEmit(uint64_t MyOffset) {
739 for (
unsigned I : OffsetIndices) {
740 auto &StoredOffset = (*Record)[
I];
741 assert(StoredOffset < MyOffset &&
"invalid offset");
743 StoredOffset = MyOffset - StoredOffset;
745 OffsetIndices.clear();
751 : Writer(&Writer), Record(&Record) {}
756 : Writer(Parent.Writer), Record(&Record) {}
768 template<
typename InputIterator>
769 void append(InputIterator begin, InputIterator end) {
770 Record->append(begin, end);
772 bool empty()
const {
return Record->empty(); }
773 size_t size()
const {
return Record->size(); }
780 uint64_t
Emit(
unsigned Code,
unsigned Abbrev = 0) {
781 uint64_t
Offset = Writer->Stream.GetCurrentBitNo();
782 PrepareToEmit(Offset);
783 Writer->Stream.EmitRecord(Code, *Record, Abbrev);
789 uint64_t
EmitStmt(
unsigned Code,
unsigned Abbrev = 0) {
791 PrepareToEmit(Writer->Stream.GetCurrentBitNo());
792 Writer->Stream.EmitRecord(Code, *Record, Abbrev);
793 return Writer->Stream.GetCurrentBitNo();
799 OffsetIndices.push_back(Record->size());
800 Record->push_back(BitOffset);
811 StmtsToEmit.push_back(S);
923 return Writer->
AddPath(Path, *Record);
939 std::string OutputFile;
940 std::string isysroot;
942 std::shared_ptr<PCHBuffer> Buffer;
943 llvm::BitstreamWriter Stream;
945 bool AllowASTWithErrors;
954 std::shared_ptr<PCHBuffer> Buffer,
955 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
956 bool AllowASTWithErrors =
false,
bool IncludeTimestamps =
true);
unsigned getDeclParmVarAbbrev() const
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
uint64_t getMacroDirectivesOffset(const IdentifierInfo *Name)
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.
ASTWriter(llvm::BitstreamWriter &Stream, SmallVectorImpl< char > &Buffer, MemoryBufferCache &PCMCache, ArrayRef< std::shared_ptr< ModuleFileExtension >> Extensions, bool IncludeTimestamps=true)
Create a new precompiled header writer that outputs to the given bitstream.
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
Represents a version number in the form major[.minor[.subminor[.build]]].
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
A structure for putting "fast"-unqualified QualTypes into a DenseMap.
const unsigned NUM_PREDEF_TYPE_IDS
The number of predefined type IDs that are reserved for the PREDEF_TYPE_* constants.
unsigned getTypeExtQualAbbrev() const
Stmt - This represents one statement.
void AddUnresolvedSet(const ASTUnresolvedSet &Set)
Emit a UnresolvedSet structure.
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Emit a nested name specifier with source-location information.
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...
const unsigned int NUM_PREDEF_SELECTOR_IDS
The number of predefined selector IDs.
Decl - This represents one declaration (or definition), e.g.
uint64_t & operator[](size_t N)
unsigned getDeclRefExprAbbrev() const
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
std::unique_ptr< llvm::MemoryBuffer > Buffer
Declaration of a variable template.
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 ...
A container of type source information.
void AddTypeRef(QualType T, RecordDataImpl &Record)
Emit a reference to a type.
uint64_t Emit(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, followed by its substatements, and return its offset.
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 AddFunctionDefinition(const FunctionDecl *FD)
Add a definition for the given function to the queue of statements to emit.
Manage memory buffers across multiple users.
const unsigned int NUM_PREDEF_DECL_IDS
The number of declaration IDs that are predefined.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Stores a list of template parameters for a TemplateDecl and its derived classes.
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 AddString(StringRef Str)
Emit a string.
void AddSourceRange(SourceRange Range)
Emit a source range.
void AddIdentifierRef(const IdentifierInfo *II, RecordDataImpl &Record)
Emit a reference to an identifier.
void AddTypeSourceInfo(TypeSourceInfo *TInfo)
Emits a reference to a declarator info.
PCHGenerator(const Preprocessor &PP, StringRef OutputFile, StringRef isysroot, std::shared_ptr< PCHBuffer > Buffer, ArrayRef< std::shared_ptr< ModuleFileExtension >> Extensions, bool AllowASTWithErrors=false, bool IncludeTimestamps=true)
Base wrapper for a particular "section" of type source info.
RecordDecl - Represents a struct/union/class.
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
ASTRecordWriter(ASTRecordWriter &Parent, ASTWriter::RecordDataImpl &Record)
Construct a ASTRecordWriter that uses the same encoding scheme as another ASTRecordWriter.
unsigned getDeclVarAbbrev() const
time_t getTimestampForOutput(const FileEntry *E) const
Get a timestamp for output into the AST file.
void AddTypeRef(QualType T)
Emit a reference to a type.
unsigned getDeclRecordAbbrev() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Record the location of a macro definition.
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
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
void AddTemplateParameterList(const TemplateParameterList *TemplateParams)
Emit a template parameter list.
Describes a module or submodule.
void AddIdentifierRef(const IdentifierInfo *II)
Emit a reference to an identifier.
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
void append(InputIterator begin, InputIterator end)
void AddSourceRange(SourceRange Range, RecordDataImpl &Record)
Emit a source range.
void AddCXXCtorInitializers(ArrayRef< CXXCtorInitializer * > CtorInits)
Emit a CXXCtorInitializer array.
void AddTypeLoc(TypeLoc TL)
Emits a type with source-location information.
void AddAttributes(ArrayRef< const Attr * > Attrs)
Emit a list of attributes.
unsigned getDeclObjCIvarAbbrev() const
Represents an ObjC class declaration.
detail::InMemoryDirectory::const_iterator I
serialization::TypeID getTypeID(QualType T) const
Determine the type ID of an already-emitted type.
unsigned RecordSwitchCaseID(SwitchCase *S)
Record an ID for the given switch-case statement.
Sema - This implements semantic analysis and AST building for C.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name)
void AddCXXTemporary(const CXXTemporary *Temp)
Emit a CXXTemporary.
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.
ASTDeserializationListener * GetASTDeserializationListener() override
If the consumer is interested in entities being deserialized from AST files, it should return a point...
bool hasEmittedPCH() const
void AddCXXDefinitionData(const CXXRecordDecl *D)
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...
Represents a C++ template name within the type system.
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 AddPath(StringRef Path)
Emit a path.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
unsigned getDeclFieldAbbrev() const
void AddQualifierInfo(const QualifierInfo &Info)
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
void AddSelectorRef(Selector S)
Emit a Selector (which is a smart pointer reference).
The result type of a method or function.
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.
void push_back(uint64_t N)
Minimal vector-like interface.
const unsigned int NUM_PREDEF_IDENT_IDS
The number of predefined identifier IDs.
QualifierInfo - A struct with extended info about a syntactic name qualifier, to be used for the case...
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
Encodes a location in the source.
void AddTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind, const TemplateArgumentLocInfo &Arg)
Emits a template argument location info.
Represents a C++ temporary.
void AddDeclarationName(DeclarationName Name)
Emit a declaration name.
void AddOffset(uint64_t BitOffset)
Add a bit offset into the record.
TagDecl - Represents the declaration of a struct/union/class/enum.
void AddTemplateArgument(const TemplateArgument &Arg)
Emit a template argument.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
ObjCCategoryDecl - Represents a category declaration.
unsigned getIntegerLiteralAbbrev() const
void AddNestedNameSpecifier(NestedNameSpecifier *NNS)
Emit a nested name specifier.
uint32_t MacroID
An ID number that refers to a macro in an AST file.
void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record)
Add a version tuple to the given record.
void AddSourceLocation(SourceLocation Loc)
Emit a source location.
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
void AddAPFloat(const llvm::APFloat &Value)
Emit a floating-point value.
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 AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo)
SmallVectorImpl< uint64_t > RecordDataImpl
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
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.
Represents a template argument.
const ASTWriter & getWriter() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
unsigned getDeclCXXMethodAbbrev() const
void AddCXXBaseSpecifiers(ArrayRef< CXXBaseSpecifier > Bases)
Emit a set of C++ base specifiers.
Reads an AST files chain containing the contents of a translation unit.
DeclarationName - The name of a declaration.
detail::InMemoryDirectory::const_iterator E
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void AddVersionTuple(const VersionTuple &Version)
Emit a version tuple.
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...
Encapsulates the data about a macro definition (e.g.
unsigned getTypeFunctionProtoAbbrev() const
Location wrapper for a TemplateArgument.
ASTWriter::RecordDataImpl & getRecordData() const
Extract the underlying record storage.
An UnresolvedSet-like class which uses the ASTContext's allocator.
const unsigned int NUM_PREDEF_MACRO_IDS
The number of predefined macro IDs.
void AddAPSInt(const llvm::APSInt &Value)
Emit a signed integral value.
uint64_t EmitStmt(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, preceded by its substatements.
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.
Represents a base class of a C++ class.
A template argument list.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
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.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
An object for streaming information to a record.
ASTFileSignature WriteAST(Sema &SemaRef, const std::string &OutputFile, Module *WritingModule, StringRef isysroot, bool hasErrors=false)
Write a precompiled header for the given semantic analysis.
Location information for a TemplateArgument.
void operator=(const ASTRecordWriter &)=delete
Declaration of a class template.
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.
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Emit a C++ base specifier.
void AddASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *ASTTemplArgList)
Emits an AST template argument list info.
void AddAPInt(const llvm::APInt &Value)
Emit an integral value.
static Decl::Kind getKind(const Decl *D)
void ClearSwitchCaseIDs()
unsigned getDeclTypedefAbbrev() const
void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs)
Emit a template argument list.
AST and semantic-analysis consumer that generates a precompiled header from the parsed source code...
void AddTemplateName(TemplateName Name)
Emit a template name.
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg)
Emits a template argument location.
uint32_t TypeID
An ID number that refers to a type in an AST file.
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
ASTRecordWriter(ASTWriter &Writer, ASTWriter::RecordDataImpl &Record)
Construct a ASTRecordWriter that uses the default encoding scheme.
Declaration of a template function.
A type index; the type ID with the qualifier bits removed.
Attr - This represents one attribute.
const unsigned int NUM_PREDEF_SUBMODULE_IDS
The number of predefined submodule IDs.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.