14#ifndef LLVM_CLANG_SERIALIZATION_ASTRECORDWRITER_H
15#define LLVM_CLANG_SERIALIZATION_ASTRECORDWRITER_H
50 void PrepareToEmit(uint64_t MyOffset) {
52 for (
unsigned I : OffsetIndices) {
53 auto &StoredOffset = (*Record)[I];
54 assert(StoredOffset < MyOffset &&
"invalid offset");
56 StoredOffset = MyOffset - StoredOffset;
58 OffsetIndices.clear();
82 template<
typename InputIterator>
83 void append(InputIterator begin, InputIterator end) {
84 Record->append(begin, end);
94 uint64_t
Emit(
unsigned Code,
unsigned Abbrev = 0) {
95 uint64_t Offset = Writer->Stream.GetCurrentBitNo();
96 PrepareToEmit(Offset);
97 Writer->Stream.EmitRecord(Code, *
Record, Abbrev);
103 uint64_t
EmitStmt(
unsigned Code,
unsigned Abbrev = 0) {
105 PrepareToEmit(Writer->Stream.GetCurrentBitNo());
106 Writer->Stream.EmitRecord(Code, *
Record, Abbrev);
107 return Writer->Stream.GetCurrentBitNo();
113 OffsetIndices.push_back(
Record->size());
114 Record->push_back(BitOffset);
125 StmtsToEmit.push_back(S);
245 writeDeclarationName(Name);
264 writeTemplateName(Name);
269 writeTemplateArgument(Arg);
enum clang::sema::@1653::IndirectLocalPathEntry::EntryKind Kind
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
An object for streaming information to a record.
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo)
ASTRecordWriter & operator=(const ASTRecordWriter &)=delete
void AddCXXBaseSpecifiers(ArrayRef< CXXBaseSpecifier > Bases)
Emit a set of C++ base specifiers.
void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs)
Emit a template argument list.
void AddFunctionDefinition(const FunctionDecl *FD)
Add a definition for the given function to the queue of statements to emit.
uint64_t Emit(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, followed by its substatements, and return its offset.
void AddCXXTemporary(const CXXTemporary *Temp)
Emit a CXXTemporary.
void writeOMPTraitInfo(const OMPTraitInfo *TI)
Write an OMPTraitInfo object.
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Emit a C++ base specifier.
ASTWriter::RecordDataImpl & getRecordData() const
Extract the underlying record storage.
void writeOMPClause(OMPClause *C)
void writeBool(bool Value)
void AddAPValue(const APValue &Value)
Emit an APvalue.
void AddNestedNameSpecifier(NestedNameSpecifier *NNS)
Emit a nested name specifier.
void AddUnresolvedSet(const ASTUnresolvedSet &Set)
Emit a UnresolvedSet structure.
void AddIdentifierRef(const IdentifierInfo *II)
Emit a reference to an identifier.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
void AddDeclarationName(DeclarationName Name)
Emit a declaration name.
void AddSelectorRef(Selector S)
Emit a Selector (which is a smart pointer reference).
void writeUInt64(uint64_t Value)
uint64_t EmitStmt(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, preceded by its substatements.
void AddSourceRange(SourceRange Range, LocSeq *Seq=nullptr)
Emit a source range.
void AddPath(StringRef Path)
Emit a path.
void writeSourceLocation(SourceLocation Loc)
void AddOffset(uint64_t BitOffset)
Add a bit offset into the record.
void AddTypeRef(QualType T)
Emit a reference to a type.
void writeQualType(QualType T)
void writeOpenACCClauseList(ArrayRef< const OpenACCClause * > Clauses)
Writes out a list of OpenACC clauses.
void AddSourceLocation(SourceLocation Loc, LocSeq *Seq=nullptr)
Emit a source location.
void push_back(uint64_t N)
Minimal vector-like interface.
void append(InputIterator begin, InputIterator end)
void AddTypeLoc(TypeLoc TL, LocSeq *Seq=nullptr)
Emits source location information for a type. Does not emit the type.
void AddCXXCtorInitializers(ArrayRef< CXXCtorInitializer * > CtorInits)
Emit a CXXCtorInitializer array.
void AddTemplateParameterList(const TemplateParameterList *TemplateParams)
Emit a template parameter list.
void AddTemplateArgument(const TemplateArgument &Arg)
Emit a template argument.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name)
void writeSelector(Selector sel)
void writeOpenACCIntExprList(ArrayRef< Expr * > Exprs)
void AddTemplateName(TemplateName Name)
Emit a template name.
void AddAPFloat(const llvm::APFloat &Value)
Emit a floating-point value.
void AddTypeSourceInfo(TypeSourceInfo *TInfo)
Emits a reference to a declarator info.
ASTRecordWriter(ASTWriter &W, ASTWriter::RecordDataImpl &Record)
Construct a ASTRecordWriter that uses the default encoding scheme.
void AddQualifierInfo(const QualifierInfo &Info)
void writeUInt32(uint32_t Value)
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
void writeOMPChildren(OMPChildren *Data)
Writes data related to the OpenMP directives.
ASTRecordWriter(const ASTRecordWriter &)=delete
Copying an ASTRecordWriter is almost certainly a bug.
void AddAPSInt(const llvm::APSInt &Value)
Emit a signed integral value.
void AddConceptReference(const ConceptReference *CR)
void AddVersionTuple(const VersionTuple &Version)
Emit a version tuple.
void AddString(StringRef Str)
Emit a string.
void writeIdentifier(const IdentifierInfo *II)
void AddAPInt(const llvm::APInt &Value)
Emit an integral value.
void AddTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind, const TemplateArgumentLocInfo &Arg)
Emits a template argument location info.
void writeOpenACCVarList(const OpenACCClauseWithVarList *C)
void writeTypeCoupledDeclRefInfo(TypeCoupledDeclRefInfo Info)
ASTRecordWriter(ASTRecordWriter &Parent, ASTWriter::RecordDataImpl &Record)
Construct a ASTRecordWriter that uses the same encoding scheme as another ASTRecordWriter.
void AddAttributes(ArrayRef< const Attr * > Attrs)
Emit a list of attributes.
void AddASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *ASTTemplArgList)
Emits an AST template argument list info.
void AddCXXDefinitionData(const CXXRecordDecl *D)
void AddVarDeclInit(const VarDecl *VD)
Emit information about the initializer of a VarDecl.
void writeStmtRef(const Stmt *S)
uint64_t & operator[](size_t N)
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg)
Emits a template argument location.
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Emit a nested name specifier with source-location information.
void writeOpenACCClause(const OpenACCClause *C)
Writes out a single OpenACC Clause.
void writeBTFTypeTagAttr(const BTFTypeTagAttr *A)
Write an BTFTypeTagAttr object.
void AddAttr(const Attr *A)
void writeDeclRef(const Decl *D)
An UnresolvedSet-like class which uses the ASTContext's allocator.
Writes an AST file containing the contents of a translation unit.
void AddSourceRange(SourceRange Range, RecordDataImpl &Record, LocSeq *Seq=nullptr)
Emit a source range.
void AddPath(StringRef Path, RecordDataImpl &Record)
Add a path to the given record.
void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record)
Add a version tuple to the given record.
void AddString(StringRef Str, RecordDataImpl &Record)
Add a string to the given record.
void AddIdentifierRef(const IdentifierInfo *II, RecordDataImpl &Record)
Emit a reference to an identifier.
void AddSourceLocation(SourceLocation Loc, RecordDataImpl &Record, LocSeq *Seq=nullptr)
Emit a source location.
void AddTypeRef(QualType T, RecordDataImpl &Record)
Emit a reference to a type.
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
Attr - This represents one attribute.
Represents a base class of a C++ class.
Represents a C++ struct/union/class.
Represents a C++ temporary.
A reference to a concept and its template args, as it appears in the code.
Decl - This represents one declaration (or definition), e.g.
DeclarationNameLoc - Additional source/type location info for a declaration name.
The name of a declaration.
Represents a function declaration or definition.
One of these records is kept for each identifier that is lexed.
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
This is a basic class for representing single OpenMP clause.
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
Represents a clause with one or more 'var' objects, represented as an expr, as its arguments.
This is the base type for all OpenACC Clauses.
A (possibly-)qualified type.
Smart pointer class that efficiently represents Objective-C method names.
Serialized encoding of a sequence of SourceLocations.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
A template argument list.
Location wrapper for a TemplateArgument.
Represents a template argument.
ArgKind
The kind of template argument we're storing.
Represents a C++ template name within the type system.
Stores a list of template parameters for a TemplateDecl and its derived classes.
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
ValueDecl * getDecl() const
Base wrapper for a particular "section" of type source info.
A container of type source information.
Represents a variable declaration or definition.
DataStreamBasicWriter provides convenience implementations for many BasicWriter methods based on the ...
DataStreamBasicWriter(ASTContext &ctx)
void writeAPInt(const llvm::APInt &value)
void writeAPSInt(const llvm::APSInt &value)
void writeNestedNameSpecifier(NestedNameSpecifier *NNS)
The JSON file list parser is used to communicate input to InstallAPI.
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
const FunctionProtoType * T
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
Location information for a TemplateArgument.