14#ifndef LLVM_CLANG_SERIALIZATION_ASTRECORDREADER_H
15#define LLVM_CLANG_SERIALIZATION_ASTRECORDREADER_H
22#include "llvm/ADT/APFloat.h"
23#include "llvm/ADT/APInt.h"
24#include "llvm/ADT/APSInt.h"
62 unsigned getIdx()
const {
return Idx; }
102 return Reader->ReadLexicalDeclContextStorage(*F, F->
DeclsCursor, Offset,
108 bool HasExpr =
Kind & 0x1;
120 return Reader->getGlobalBitOffset(*F, LocalOffset);
140 return cast_or_null<T>(Reader->
GetLocalDecl(*F, LocalID));
234 using DataStreamBasicReader::readTemplateArgument;
248 bool Canonicalize =
false);
304 llvm::APFloat
readAPFloat(
const llvm::fltSemantics &Sem);
342 return cast<BTFTypeTagAttr>(
readAttr());
364 : Cursor(Cursor), Offset(Cursor.GetCurrentBitNo()) {}
367 if (llvm::Error Err = Cursor.JumpToBit(Offset))
368 llvm::report_fatal_error(
369 llvm::Twine(
"Cursor should always be able to go back, failed: ") +
374 llvm::BitstreamCursor &Cursor;
Defines the clang::ASTContext interface.
enum clang::sema::@1655::IndirectLocalPathEntry::EntryKind Kind
llvm::MachO::Record Record
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
Reads an AST files chain containing the contents of a translation unit.
SmallVectorImpl< uint64_t > RecordDataImpl
serialization::SubmoduleID getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID) const
Retrieve the global submodule ID given a module and its local ID number.
void RecordSwitchCaseID(SwitchCase *SC, unsigned ID)
Record that the given ID maps to the given switch-case statement.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Decl * ReadDecl(ModuleFile &F, const RecordDataImpl &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
static std::string ReadString(const RecordDataImpl &Record, unsigned &Idx)
serialization::TypeID getGlobalTypeID(ModuleFile &F, serialization::LocalTypeID LocalID) const
Map a local type ID within a given AST file into a global type ID.
T * ReadDeclAs(ModuleFile &F, const RecordDataImpl &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
QualType readType(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a type from the current position in the given record, which was read from the given AST file.
SourceLocation ReadSourceLocation(ModuleFile &MF, RawLocEncoding Raw, LocSeq *Seq=nullptr) const
Read a source location from raw form.
GlobalDeclID ReadDeclID(ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx)
Reads a declaration ID from the given position in a record in the given module.
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
Expr * ReadSubExpr()
Reads a sub-expression operand during statement reading.
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx, LocSeq *Seq=nullptr)
Read a source range.
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Selector ReadSelector(ModuleFile &M, const RecordData &Record, unsigned &Idx)
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
Reads a token out of a record.
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
Decl * GetLocalDecl(ModuleFile &F, LocalDeclID LocalID)
Reads a declaration with the given local ID in the given module.
CXXTemporary * ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
SmallVector< uint64_t, 64 > RecordData
IdentifierInfo * readIdentifier(ModuleFile &M, const RecordData &Record, unsigned &Idx)
An object for streaming information from a record.
bool readBool()
Read a boolean value, advancing Idx.
std::string readString()
Read a string, advancing Idx.
Decl * readDecl()
Reads a declaration from the given position in a record in the given module, advancing Idx.
uint32_t readUInt32()
Read a 32-bit unsigned value; required to satisfy BasicReader.
llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem)
Read an arbitrary constant value, advancing Idx.
TemplateArgumentLoc readTemplateArgumentLoc()
Reads a TemplateArgumentLoc, advancing Idx.
void readTypeLoc(TypeLoc TL, LocSeq *Seq=nullptr)
Reads the location information for a type.
ExplicitSpecifier readExplicitSpec()
uint64_t getGlobalBitOffset(uint64_t LocalOffset)
Read information about an exception specification (inherited).
void readUnresolvedSet(LazyASTUnresolvedSet &Set)
Read a UnresolvedSet structure, advancing Idx.
bool readLexicalDeclContextStorage(uint64_t Offset, DeclContext *DC)
Read the record that describes the lexical contents of a DC.
void readTemplateArgumentList(SmallVectorImpl< TemplateArgument > &TemplArgs, bool Canonicalize=false)
Read a template argument array, advancing Idx.
void readAttributes(AttrVec &Attrs)
Reads attributes from the current stream position, advancing Idx.
void readQualifierInfo(QualifierInfo &Info)
T * GetLocalDeclAs(LocalDeclID LocalID)
Reads a declaration with the given local ID in the given module.
unsigned getIdx() const
The current position in this record.
DeclarationNameLoc readDeclarationNameLoc(DeclarationName Name)
Read a declaration name, advancing Idx.
CXXBaseSpecifier readCXXBaseSpecifier()
Read a C++ base specifier, advancing Idx.
QualType readType()
Read a type from the current position in the record.
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
T * readDeclAs()
Reads a declaration from the given position in the record, advancing Idx.
Expected< unsigned > readRecord(llvm::BitstreamCursor &Cursor, unsigned AbbrevID)
Reads a record with id AbbrevID from Cursor, resetting the internal state.
DeclarationNameInfo readDeclarationNameInfo()
const uint64_t & operator[](size_t N)
An arbitrary index in this record.
size_t size() const
The length of this record.
IdentifierInfo * readIdentifier()
TemplateArgumentLocInfo readTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind)
Reads a TemplateArgumentLocInfo appropriate for the given TemplateArgument kind, advancing Idx.
uint64_t readUInt64()
Read a 64-bit unsigned value; required to satisfy BasicReader.
TemplateArgument readTemplateArgument(bool Canonicalize)
std::string readPath()
Read a path, advancing Idx.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
TypeSourceInfo * readTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
uint64_t peekInt()
Returns the current value in this record, without advancing.
void readTemplateArgumentListInfo(TemplateArgumentListInfo &Result)
TypeCoupledDeclRefInfo readTypeCoupledDeclRefInfo()
BTFTypeTagAttr * readBTFTypeTagAttr()
Read an BTFTypeTagAttr object.
void skipInts(unsigned N)
Skips the specified number of values.
GlobalDeclID readDeclID()
Reads a declaration ID from the given position in this record.
SourceRange readSourceRange(LocSeq *Seq=nullptr)
Read a source range, advancing Idx.
serialization::TypeID getGlobalTypeID(serialization::TypeID LocalID) const
Map a local type ID within a given AST file to a global type ID.
NestedNameSpecifierLoc readNestedNameSpecifierLoc()
Return a nested name specifier, advancing Idx.
ASTRecordReader(ASTReader &Reader, ModuleFile &F)
Construct an ASTRecordReader that uses the default encoding scheme.
ConceptReference * readConceptReference()
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
Token readToken()
Reads a token out of a record, advancing Idx.
void recordSwitchCaseID(SwitchCase *SC, unsigned ID)
void readOMPChildren(OMPChildren *Data)
Read an OpenMP children, advancing Idx.
OMPClause * readOMPClause()
Read an OpenMP clause, advancing Idx.
void readOpenACCClauseList(MutableArrayRef< const OpenACCClause * > Clauses)
Read a list of OpenACC clauses into the passed SmallVector.
Selector readSelector()
Read a selector from the Record, advancing Idx.
CXXTemporary * readCXXTemporary()
OMPTraitInfo * readOMPTraitInfo()
Read an OMPTraitInfo object, advancing Idx.
Qualifiers readQualifiers()
TemplateParameterList * readTemplateParameterList()
Read a template parameter list, advancing Idx.
OpenACCClause * readOpenACCClause()
Read an OpenACC clause, advancing Idx.
VersionTuple readVersionTuple()
Read a version tuple, advancing Idx.
llvm::SmallVector< Expr * > readOpenACCVarList()
Read a list of Exprs used for a var-list.
uint64_t back()
Returns the last value in this record.
serialization::SubmoduleID getGlobalSubmoduleID(unsigned LocalID)
Retrieve the global submodule ID its local ID number.
CXXCtorInitializer ** readCXXCtorInitializers()
Read a CXXCtorInitializer array, advancing Idx.
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
Stmt * readStmt()
Reads a statement.
const ASTTemplateArgumentListInfo * readASTTemplateArgumentListInfo()
Stmt * readSubStmt()
Reads a sub-statement operand during statement reading.
uint64_t readInt()
Returns the current value in this record, and advances to the next value.
Attr * readAttr()
Reads one attribute from the current stream position, advancing Idx.
Expr * readExpr()
Reads an expression.
ArrayRef< uint64_t > readIntArray(unsigned Len)
SourceLocation readSourceLocation(LocSeq *Seq=nullptr)
Read a source location, advancing Idx.
llvm::SmallVector< Expr * > readOpenACCIntExprList()
Read a list of Exprs used for a int-expr-list.
Expr * readSubExpr()
Reads a sub-expression operand during statement reading.
Attr - This represents one attribute.
Represents a base class of a C++ class.
Represents a C++ base or member initializer.
Represents a C++ temporary.
A reference to a concept and its template args, as it appears in the code.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
DeclarationNameLoc - Additional source/type location info for a declaration name.
The name of a declaration.
Store information needed for an explicit specifier.
This represents one expression.
One of these records is kept for each identifier that is lexed.
An UnresolvedSet-like class that might not have been loaded from the external AST source yet.
Describes a module or submodule.
A C++ nested-name-specifier augmented with source location information.
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...
This is the base type for all OpenACC Clauses.
A (possibly-)qualified type.
The collection of all-type qualifiers we support.
static Qualifiers fromOpaqueValue(uint64_t opaque)
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 convenient class for passing around template argument information.
Location wrapper for a TemplateArgument.
Represents a template argument.
ArgKind
The kind of template argument we're storing.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Token - This structure provides full information about a lexed token.
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
Base wrapper for a particular "section" of type source info.
A container of type source information.
DataStreamBasicReader provides convenience implementations for many BasicReader methods based on the ...
DataStreamBasicReader(ASTContext &ctx)
Information about a module that has been loaded by the ASTReader.
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
uint64_t TypeID
An ID number that refers to a type in an AST file.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
The JSON file list parser is used to communicate input to InstallAPI.
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
@ Result
The result type of a method or function.
const FunctionProtoType * T
ExplicitSpecKind
Define the meaning of possible values of the kind in ExplicitSpecifier.
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 ...
Helper class that saves the current stream position and then restores it when destroyed.
SavedStreamPosition(llvm::BitstreamCursor &Cursor)
Location information for a TemplateArgument.