};
QualType readTypeRecord(unsigned Index);
- void readExceptionSpec(ModuleFile &ModuleFile,
- SmallVectorImpl<QualType> &ExceptionStorage,
- FunctionProtoType::ExceptionSpecInfo &ESI,
- const RecordData &Record, unsigned &Index);
RecordLocation TypeCursorForIndex(unsigned Index);
void LoadedDecl(unsigned Index, Decl *D);
Decl *ReadDeclRecord(serialization::DeclID ID);
return Result;
}
- /// Reads a TemplateArgumentLocInfo appropriate for the
- /// given TemplateArgument kind.
- TemplateArgumentLocInfo
- GetTemplateArgumentLocInfo(ModuleFile &F, TemplateArgument::ArgKind Kind,
- const RecordData &Record, unsigned &Idx);
-
- /// Reads a TemplateArgumentLoc.
- TemplateArgumentLoc
- ReadTemplateArgumentLoc(ModuleFile &F,
- const RecordData &Record, unsigned &Idx);
-
- const ASTTemplateArgumentListInfo*
- ReadASTTemplateArgumentListInfo(ModuleFile &F,
- const RecordData &Record, unsigned &Index);
-
- /// Reads a declarator info from the given record.
- TypeSourceInfo *GetTypeSourceInfo(ModuleFile &F,
- const RecordData &Record, unsigned &Idx);
-
- /// Raad the type locations for the given TInfo.
- void ReadTypeLoc(ModuleFile &F, const RecordData &Record, unsigned &Idx,
- TypeLoc TL);
-
/// Resolve a type ID into a type, potentially building a new
/// type.
QualType GetType(serialization::TypeID ID);
IdentifierInfo *DecodeIdentifierInfo(serialization::IdentifierID ID);
- IdentifierInfo *GetIdentifierInfo(ModuleFile &M, const RecordData &Record,
- unsigned &Idx) {
+ IdentifierInfo *readIdentifier(ModuleFile &M, const RecordData &Record,
+ unsigned &Idx) {
return DecodeIdentifierInfo(getGlobalIdentifierID(M, Record[Idx++]));
}
serialization::SelectorID getGlobalSelectorID(ModuleFile &F,
unsigned LocalID) const;
- /// Read a declaration name.
- DeclarationName ReadDeclarationName(ModuleFile &F,
- const RecordData &Record, unsigned &Idx);
- void ReadDeclarationNameLoc(ModuleFile &F,
- DeclarationNameLoc &DNLoc, DeclarationName Name,
- const RecordData &Record, unsigned &Idx);
- void ReadDeclarationNameInfo(ModuleFile &F, DeclarationNameInfo &NameInfo,
- const RecordData &Record, unsigned &Idx);
-
- void ReadQualifierInfo(ModuleFile &F, QualifierInfo &Info,
- const RecordData &Record, unsigned &Idx);
-
- NestedNameSpecifier *ReadNestedNameSpecifier(ModuleFile &F,
- const RecordData &Record,
- unsigned &Idx);
-
- NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(ModuleFile &F,
- const RecordData &Record,
- unsigned &Idx);
-
- /// Read a template name.
- TemplateName ReadTemplateName(ModuleFile &F, const RecordData &Record,
- unsigned &Idx);
-
- /// Read a template argument.
- TemplateArgument ReadTemplateArgument(ModuleFile &F, const RecordData &Record,
- unsigned &Idx,
- bool Canonicalize = false);
-
- /// Read a template parameter list.
- TemplateParameterList *ReadTemplateParameterList(ModuleFile &F,
- const RecordData &Record,
- unsigned &Idx);
-
- /// Read a template argument array.
- void ReadTemplateArgumentList(SmallVectorImpl<TemplateArgument> &TemplArgs,
- ModuleFile &F, const RecordData &Record,
- unsigned &Idx, bool Canonicalize = false);
-
- /// Read a UnresolvedSet structure.
- void ReadUnresolvedSet(ModuleFile &F, LazyASTUnresolvedSet &Set,
- const RecordData &Record, unsigned &Idx);
-
- /// Read a C++ base specifier.
- CXXBaseSpecifier ReadCXXBaseSpecifier(ModuleFile &F,
- const RecordData &Record,unsigned &Idx);
-
- /// Read a CXXCtorInitializer array.
- CXXCtorInitializer **
- ReadCXXCtorInitializers(ModuleFile &F, const RecordData &Record,
- unsigned &Idx);
-
/// Read the contents of a CXXCtorInitializer array.
CXXCtorInitializer **GetExternalCXXCtorInitializers(uint64_t Offset) override;
SourceRange ReadSourceRange(ModuleFile &F,
const RecordData &Record, unsigned &Idx);
- /// Read an integral value
- llvm::APInt ReadAPInt(const RecordData &Record, unsigned &Idx);
-
- /// Read a signed integral value
- llvm::APSInt ReadAPSInt(const RecordData &Record, unsigned &Idx);
-
- /// Read a floating-point value
- llvm::APFloat ReadAPFloat(const RecordData &Record,
- const llvm::fltSemantics &Sem, unsigned &Idx);
-
- /// Read an APValue
- APValue ReadAPValue(const RecordData &Record, unsigned &Idx);
-
// Read a string
static std::string ReadString(const RecordData &Record, unsigned &Idx);
CXXTemporary *ReadCXXTemporary(ModuleFile &F, const RecordData &Record,
unsigned &Idx);
- /// Reads one attribute from the current stream position.
- Attr *ReadAttr(ModuleFile &M, const RecordData &Record, unsigned &Idx);
-
- /// Reads attributes from the current stream position.
- void ReadAttributes(ASTRecordReader &Record, AttrVec &Attrs);
-
/// Reads a statement.
Stmt *ReadStmt(ModuleFile &F);
/// An arbitrary index in this record.
const uint64_t &operator[](size_t N) { return Record[N]; }
- /// The last element in this record.
- const uint64_t &back() const { return Record.back(); }
+ /// Returns the last value in this record.
+ uint64_t back() { return Record.back(); }
/// Returns the current value in this record, and advances to the
/// next value.
- const uint64_t &readInt() { return Record[Idx++]; }
+ uint64_t readInt() { return Record[Idx++]; }
+
+ ArrayRef<uint64_t> readIntArray(unsigned Len) {
+ auto Array = llvm::makeArrayRef(Record).slice(Idx, Len);
+ Idx += Len;
+ return Array;
+ }
/// Returns the current value in this record, without advancing.
- const uint64_t &peekInt() { return Record[Idx]; }
+ uint64_t peekInt() { return Record[Idx]; }
/// Skips the specified number of values.
void skipInts(unsigned N) { Idx += N; }
static_cast<ExplicitSpecKind>(Kind));
}
- void readExceptionSpec(SmallVectorImpl<QualType> &ExceptionStorage,
- FunctionProtoType::ExceptionSpecInfo &ESI) {
- return Reader->readExceptionSpec(*F, ExceptionStorage, ESI, Record, Idx);
- }
+ FunctionProtoType::ExceptionSpecInfo
+ readExceptionSpecInfo(SmallVectorImpl<QualType> &ExceptionStorage);
/// Get the global offset corresponding to a local offset.
uint64_t getGlobalBitOffset(uint32_t LocalOffset) {
/// Reads a TemplateArgumentLocInfo appropriate for the
/// given TemplateArgument kind, advancing Idx.
TemplateArgumentLocInfo
- getTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind) {
- return Reader->GetTemplateArgumentLocInfo(*F, Kind, Record, Idx);
- }
+ readTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind);
/// Reads a TemplateArgumentLoc, advancing Idx.
- TemplateArgumentLoc
- readTemplateArgumentLoc() {
- return Reader->ReadTemplateArgumentLoc(*F, Record, Idx);
- }
+ TemplateArgumentLoc readTemplateArgumentLoc();
const ASTTemplateArgumentListInfo*
- readASTTemplateArgumentListInfo() {
- return Reader->ReadASTTemplateArgumentListInfo(*F, Record, Idx);
- }
+ readASTTemplateArgumentListInfo();
/// Reads a declarator info from the given record, advancing Idx.
- TypeSourceInfo *getTypeSourceInfo() {
- return Reader->GetTypeSourceInfo(*F, Record, Idx);
- }
+ TypeSourceInfo *readTypeSourceInfo();
/// Reads the location information for a type.
- void readTypeLoc(TypeLoc TL) {
- return Reader->ReadTypeLoc(*F, Record, Idx, TL);
- }
+ void readTypeLoc(TypeLoc TL);
+
/// Map a local type ID within a given AST file to a global type ID.
serialization::TypeID getGlobalTypeID(unsigned LocalID) const {
return Reader->getGlobalTypeID(*F, LocalID);
}
+ Qualifiers readQualifiers() {
+ return Qualifiers::fromOpaqueValue(readInt());
+ }
+
/// Read a type from the current position in the record.
QualType readType() {
return Reader->readType(*F, Record, Idx);
return Reader->ReadDeclAs<T>(*F, Record, Idx);
}
- IdentifierInfo *getIdentifierInfo() {
- return Reader->GetIdentifierInfo(*F, Record, Idx);
+ IdentifierInfo *readIdentifier() {
+ return Reader->readIdentifier(*F, Record, Idx);
}
/// Read a selector from the Record, advancing Idx.
}
/// Read a declaration name, advancing Idx.
- DeclarationName readDeclarationName() {
- return Reader->ReadDeclarationName(*F, Record, Idx);
- }
- void readDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name) {
- return Reader->ReadDeclarationNameLoc(*F, DNLoc, Name, Record, Idx);
- }
- void readDeclarationNameInfo(DeclarationNameInfo &NameInfo) {
- return Reader->ReadDeclarationNameInfo(*F, NameInfo, Record, Idx);
- }
+ DeclarationName readDeclarationName();
+ DeclarationNameLoc readDeclarationNameLoc(DeclarationName Name);
+ DeclarationNameInfo readDeclarationNameInfo();
- void readQualifierInfo(QualifierInfo &Info) {
- return Reader->ReadQualifierInfo(*F, Info, Record, Idx);
- }
+ void readQualifierInfo(QualifierInfo &Info);
- NestedNameSpecifier *readNestedNameSpecifier() {
- return Reader->ReadNestedNameSpecifier(*F, Record, Idx);
- }
+ NestedNameSpecifier *readNestedNameSpecifier();
- NestedNameSpecifierLoc readNestedNameSpecifierLoc() {
- return Reader->ReadNestedNameSpecifierLoc(*F, Record, Idx);
- }
+ NestedNameSpecifierLoc readNestedNameSpecifierLoc();
/// Read a template name, advancing Idx.
- TemplateName readTemplateName() {
- return Reader->ReadTemplateName(*F, Record, Idx);
- }
+ TemplateName readTemplateName();
/// Read a template argument, advancing Idx.
- TemplateArgument readTemplateArgument(bool Canonicalize = false) {
- return Reader->ReadTemplateArgument(*F, Record, Idx, Canonicalize);
- }
+ TemplateArgument readTemplateArgument(bool Canonicalize = false);
/// Read a template parameter list, advancing Idx.
- TemplateParameterList *readTemplateParameterList() {
- return Reader->ReadTemplateParameterList(*F, Record, Idx);
- }
+ TemplateParameterList *readTemplateParameterList();
/// Read a template argument array, advancing Idx.
void readTemplateArgumentList(SmallVectorImpl<TemplateArgument> &TemplArgs,
- bool Canonicalize = false) {
- return Reader->ReadTemplateArgumentList(TemplArgs, *F, Record, Idx,
- Canonicalize);
- }
+ bool Canonicalize = false);
/// Read a UnresolvedSet structure, advancing Idx.
- void readUnresolvedSet(LazyASTUnresolvedSet &Set) {
- return Reader->ReadUnresolvedSet(*F, Set, Record, Idx);
- }
+ void readUnresolvedSet(LazyASTUnresolvedSet &Set);
/// Read a C++ base specifier, advancing Idx.
- CXXBaseSpecifier readCXXBaseSpecifier() {
- return Reader->ReadCXXBaseSpecifier(*F, Record, Idx);
- }
+ CXXBaseSpecifier readCXXBaseSpecifier();
/// Read a CXXCtorInitializer array, advancing Idx.
- CXXCtorInitializer **readCXXCtorInitializers() {
- return Reader->ReadCXXCtorInitializers(*F, Record, Idx);
- }
+ CXXCtorInitializer **readCXXCtorInitializers();
CXXTemporary *readCXXTemporary() {
return Reader->ReadCXXTemporary(*F, Record, Idx);
return Reader->ReadSourceRange(*F, Record, Idx);
}
- APValue readAPValue() { return Reader->ReadAPValue(Record, Idx); }
+ /// Read an arbitrary constant value, advancing Idx.
+ APValue readAPValue();
/// Read an integral value, advancing Idx.
- llvm::APInt readAPInt() {
- return Reader->ReadAPInt(Record, Idx);
- }
+ llvm::APInt readAPInt();
/// Read a signed integral value, advancing Idx.
- llvm::APSInt readAPSInt() {
- return Reader->ReadAPSInt(Record, Idx);
- }
+ llvm::APSInt readAPSInt();
/// Read a floating-point value, advancing Idx.
- llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem) {
- return Reader->ReadAPFloat(Record, Sem,Idx);
- }
+ llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem);
+
+ /// Read a boolean value, advancing Idx.
+ bool readBool() { return readInt() != 0; }
/// Read a string, advancing Idx.
std::string readString() {
}
/// Reads one attribute from the current stream position, advancing Idx.
- Attr *readAttr() {
- return Reader->ReadAttr(*F, Record, Idx);
- }
+ Attr *readAttr();
/// Reads attributes from the current stream position, advancing Idx.
- void readAttributes(AttrVec &Attrs) {
- return Reader->ReadAttributes(*this, Attrs);
- }
+ void readAttributes(AttrVec &Attrs);
/// Reads a token out of a record, advancing Idx.
Token readToken() {
return RecordLocation(M, M->TypeOffsets[Index - M->BaseTypeIndex]);
}
+static FunctionType::ExtInfo readFunctionExtInfo(ASTRecordReader &Record) {
+ bool noreturn = Record.readBool();
+ bool hasregparm = Record.readBool();
+ unsigned regparm = Record.readInt();
+ auto cc = static_cast<CallingConv>(Record.readInt());
+ bool producesResult = Record.readBool();
+ bool nocallersavedregs = Record.readBool();
+ bool nocfcheck = Record.readBool();
+ return FunctionType::ExtInfo(noreturn, hasregparm, regparm, cc,
+ producesResult, nocallersavedregs, nocfcheck);
+}
+
/// Read and return the type with the given index..
///
/// The index is the type ID, shifted and minus the number of predefs. This
// Note that we are loading a type record.
Deserializing AType(this);
- unsigned Idx = 0;
if (llvm::Error Err = DeclsCursor.JumpToBit(Loc.Offset)) {
Error(std::move(Err));
return QualType();
}
- RecordData Record;
- Expected<unsigned> MaybeCode = DeclsCursor.ReadCode();
- if (!MaybeCode) {
- Error(MaybeCode.takeError());
+ Expected<unsigned> RawCode = DeclsCursor.ReadCode();
+ if (!RawCode) {
+ Error(RawCode.takeError());
return QualType();
}
- unsigned Code = MaybeCode.get();
- Expected<unsigned> MaybeTypeCode = DeclsCursor.readRecord(Code, Record);
- if (!MaybeTypeCode) {
- Error(MaybeTypeCode.takeError());
+ ASTRecordReader Record(*this, *Loc.F);
+ Expected<unsigned> Code = Record.readRecord(DeclsCursor, RawCode.get());
+ if (!Code) {
+ Error(Code.takeError());
return QualType();
}
- switch ((TypeCode)MaybeTypeCode.get()) {
+ switch ((TypeCode) Code.get()) {
case TYPE_EXT_QUAL: {
if (Record.size() != 2) {
Error("Incorrect encoding of extended qualifier type");
return QualType();
}
- QualType Base = readType(*Loc.F, Record, Idx);
- Qualifiers Quals = Qualifiers::fromOpaqueValue(Record[Idx++]);
+ QualType Base = Record.readType();
+ Qualifiers Quals = Record.readQualifiers();
return Context.getQualifiedType(Base, Quals);
}
Error("Incorrect encoding of complex type");
return QualType();
}
- QualType ElemType = readType(*Loc.F, Record, Idx);
+ QualType ElemType = Record.readType();
return Context.getComplexType(ElemType);
}
Error("Incorrect encoding of pointer type");
return QualType();
}
- QualType PointeeType = readType(*Loc.F, Record, Idx);
+ QualType PointeeType = Record.readType();
return Context.getPointerType(PointeeType);
}
Error("Incorrect encoding of decayed type");
return QualType();
}
- QualType OriginalType = readType(*Loc.F, Record, Idx);
+ QualType OriginalType = Record.readType();
QualType DT = Context.getAdjustedParameterType(OriginalType);
if (!isa<DecayedType>(DT))
Error("Decayed type does not decay");
Error("Incorrect encoding of adjusted type");
return QualType();
}
- QualType OriginalTy = readType(*Loc.F, Record, Idx);
- QualType AdjustedTy = readType(*Loc.F, Record, Idx);
+ QualType OriginalTy = Record.readType();
+ QualType AdjustedTy = Record.readType();
return Context.getAdjustedType(OriginalTy, AdjustedTy);
}
Error("Incorrect encoding of block pointer type");
return QualType();
}
- QualType PointeeType = readType(*Loc.F, Record, Idx);
+ QualType PointeeType = Record.readType();
return Context.getBlockPointerType(PointeeType);
}
Error("Incorrect encoding of lvalue reference type");
return QualType();
}
- QualType PointeeType = readType(*Loc.F, Record, Idx);
- return Context.getLValueReferenceType(PointeeType, Record[1]);
+ QualType PointeeType = Record.readType();
+ return Context.getLValueReferenceType(PointeeType, Record.readBool());
}
case TYPE_RVALUE_REFERENCE: {
Error("Incorrect encoding of rvalue reference type");
return QualType();
}
- QualType PointeeType = readType(*Loc.F, Record, Idx);
+ QualType PointeeType = Record.readType();
return Context.getRValueReferenceType(PointeeType);
}
Error("Incorrect encoding of member pointer type");
return QualType();
}
- QualType PointeeType = readType(*Loc.F, Record, Idx);
- QualType ClassType = readType(*Loc.F, Record, Idx);
+ QualType PointeeType = Record.readType();
+ QualType ClassType = Record.readType();
if (PointeeType.isNull() || ClassType.isNull())
return QualType();
}
case TYPE_CONSTANT_ARRAY: {
- QualType ElementType = readType(*Loc.F, Record, Idx);
- ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
- unsigned IndexTypeQuals = Record[2];
- unsigned Idx = 3;
- llvm::APInt Size = ReadAPInt(Record, Idx);
- Expr *SizeExpr = ReadExpr(*Loc.F);
+ QualType ElementType = Record.readType();
+ ArrayType::ArraySizeModifier ASM =
+ (ArrayType::ArraySizeModifier) Record.readInt();
+ unsigned IndexTypeQuals = Record.readInt();
+ llvm::APInt Size = Record.readAPInt();
+ Expr *SizeExpr = Record.readExpr();
return Context.getConstantArrayType(ElementType, Size, SizeExpr,
- ASM, IndexTypeQuals);
+ ASM, IndexTypeQuals);
}
case TYPE_INCOMPLETE_ARRAY: {
- QualType ElementType = readType(*Loc.F, Record, Idx);
- ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
- unsigned IndexTypeQuals = Record[2];
+ QualType ElementType = Record.readType();
+ ArrayType::ArraySizeModifier ASM =
+ (ArrayType::ArraySizeModifier) Record.readInt();
+ unsigned IndexTypeQuals = Record.readInt();
return Context.getIncompleteArrayType(ElementType, ASM, IndexTypeQuals);
}
case TYPE_VARIABLE_ARRAY: {
- QualType ElementType = readType(*Loc.F, Record, Idx);
- ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
- unsigned IndexTypeQuals = Record[2];
- SourceLocation LBLoc = ReadSourceLocation(*Loc.F, Record[3]);
- SourceLocation RBLoc = ReadSourceLocation(*Loc.F, Record[4]);
+ QualType ElementType = Record.readType();
+ ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record.readInt();
+ unsigned IndexTypeQuals = Record.readInt();
+ SourceLocation LBLoc = Record.readSourceLocation();
+ SourceLocation RBLoc = Record.readSourceLocation();
return Context.getVariableArrayType(ElementType, ReadExpr(*Loc.F),
ASM, IndexTypeQuals,
SourceRange(LBLoc, RBLoc));
return QualType();
}
- QualType ElementType = readType(*Loc.F, Record, Idx);
- unsigned NumElements = Record[1];
- unsigned VecKind = Record[2];
+ QualType ElementType = Record.readType();
+ unsigned NumElements = Record.readInt();
+ unsigned VecKind = Record.readInt();
return Context.getVectorType(ElementType, NumElements,
(VectorType::VectorKind)VecKind);
}
return QualType();
}
- QualType ElementType = readType(*Loc.F, Record, Idx);
- unsigned NumElements = Record[1];
+ QualType ElementType = Record.readType();
+ unsigned NumElements = Record.readInt();
return Context.getExtVectorType(ElementType, NumElements);
}
Error("incorrect encoding of no-proto function type");
return QualType();
}
- QualType ResultType = readType(*Loc.F, Record, Idx);
- FunctionType::ExtInfo Info(Record[1], Record[2], Record[3],
- (CallingConv)Record[4], Record[5], Record[6],
- Record[7]);
+ QualType ResultType = Record.readType();
+ FunctionType::ExtInfo Info = readFunctionExtInfo(Record);
return Context.getFunctionNoProtoType(ResultType, Info);
}
case TYPE_FUNCTION_PROTO: {
- QualType ResultType = readType(*Loc.F, Record, Idx);
+ QualType ResultType = Record.readType();
FunctionProtoType::ExtProtoInfo EPI;
- EPI.ExtInfo = FunctionType::ExtInfo(/*noreturn*/ Record[1],
- /*hasregparm*/ Record[2],
- /*regparm*/ Record[3],
- static_cast<CallingConv>(Record[4]),
- /*produces*/ Record[5],
- /*nocallersavedregs*/ Record[6],
- /*nocfcheck*/ Record[7]);
-
- unsigned Idx = 8;
-
- EPI.Variadic = Record[Idx++];
- EPI.HasTrailingReturn = Record[Idx++];
- EPI.TypeQuals = Qualifiers::fromOpaqueValue(Record[Idx++]);
- EPI.RefQualifier = static_cast<RefQualifierKind>(Record[Idx++]);
+ EPI.ExtInfo = readFunctionExtInfo(Record);
+ EPI.Variadic = Record.readBool();
+ EPI.HasTrailingReturn = Record.readBool();
+ EPI.TypeQuals = Record.readQualifiers();
+ EPI.RefQualifier = static_cast<RefQualifierKind>(Record.readInt());
SmallVector<QualType, 8> ExceptionStorage;
- readExceptionSpec(*Loc.F, ExceptionStorage, EPI.ExceptionSpec, Record, Idx);
+ EPI.ExceptionSpec = Record.readExceptionSpecInfo(ExceptionStorage);
- unsigned NumParams = Record[Idx++];
+ unsigned NumParams = Record.readInt();
SmallVector<QualType, 16> ParamTypes;
for (unsigned I = 0; I != NumParams; ++I)
- ParamTypes.push_back(readType(*Loc.F, Record, Idx));
+ ParamTypes.push_back(Record.readType());
SmallVector<FunctionProtoType::ExtParameterInfo, 4> ExtParameterInfos;
- if (Idx != Record.size()) {
+ if (Record.getIdx() != Record.size()) {
for (unsigned I = 0; I != NumParams; ++I)
ExtParameterInfos.push_back(
FunctionProtoType::ExtParameterInfo
- ::getFromOpaqueValue(Record[Idx++]));
+ ::getFromOpaqueValue(Record.readInt()));
EPI.ExtParameterInfos = ExtParameterInfos.data();
}
- assert(Idx == Record.size());
+ assert(Record.getIdx() == Record.size());
return Context.getFunctionType(ResultType, ParamTypes, EPI);
}
case TYPE_UNRESOLVED_USING: {
- unsigned Idx = 0;
return Context.getTypeDeclType(
- ReadDeclAs<UnresolvedUsingTypenameDecl>(*Loc.F, Record, Idx));
+ Record.readDeclAs<UnresolvedUsingTypenameDecl>());
}
case TYPE_TYPEDEF: {
Error("incorrect encoding of typedef type");
return QualType();
}
- unsigned Idx = 0;
- TypedefNameDecl *Decl = ReadDeclAs<TypedefNameDecl>(*Loc.F, Record, Idx);
- QualType Canonical = readType(*Loc.F, Record, Idx);
+ TypedefNameDecl *Decl = Record.readDeclAs<TypedefNameDecl>();
+ QualType Canonical = Record.readType();
if (!Canonical.isNull())
Canonical = Context.getCanonicalType(Canonical);
return Context.getTypedefType(Decl, Canonical);
Error("incorrect encoding of typeof(type) in AST file");
return QualType();
}
- QualType UnderlyingType = readType(*Loc.F, Record, Idx);
+ QualType UnderlyingType = Record.readType();
return Context.getTypeOfType(UnderlyingType);
}
case TYPE_DECLTYPE: {
- QualType UnderlyingType = readType(*Loc.F, Record, Idx);
- return Context.getDecltypeType(ReadExpr(*Loc.F), UnderlyingType);
+ QualType UnderlyingType = Record.readType();
+ return Context.getDecltypeType(Record.readExpr(), UnderlyingType);
}
case TYPE_UNARY_TRANSFORM: {
- QualType BaseType = readType(*Loc.F, Record, Idx);
- QualType UnderlyingType = readType(*Loc.F, Record, Idx);
- UnaryTransformType::UTTKind UKind = (UnaryTransformType::UTTKind)Record[2];
+ QualType BaseType = Record.readType();
+ QualType UnderlyingType = Record.readType();
+ UnaryTransformType::UTTKind UKind =
+ (UnaryTransformType::UTTKind)Record.readInt();
return Context.getUnaryTransformType(BaseType, UnderlyingType, UKind);
}
case TYPE_AUTO: {
- QualType Deduced = readType(*Loc.F, Record, Idx);
- AutoTypeKeyword Keyword = (AutoTypeKeyword)Record[Idx++];
+ QualType Deduced = Record.readType();
+ AutoTypeKeyword Keyword = (AutoTypeKeyword) Record.readInt();
bool IsDependent = false, IsPack = false;
if (Deduced.isNull()) {
- IsDependent = Record[Idx] > 0;
- IsPack = Record[Idx] > 1;
- ++Idx;
+ auto Dependence = Record.readInt();
+ IsDependent = Dependence > 0;
+ IsPack = Dependence > 1;
}
return Context.getAutoType(Deduced, Keyword, IsDependent, IsPack);
}
case TYPE_DEDUCED_TEMPLATE_SPECIALIZATION: {
- TemplateName Name = ReadTemplateName(*Loc.F, Record, Idx);
- QualType Deduced = readType(*Loc.F, Record, Idx);
- bool IsDependent = Deduced.isNull() ? Record[Idx++] : false;
+ TemplateName Name = Record.readTemplateName();
+ QualType Deduced = Record.readType();
+ bool IsDependent = Deduced.isNull() ? Record.readBool() : false;
return Context.getDeducedTemplateSpecializationType(Name, Deduced,
IsDependent);
}
Error("incorrect encoding of record type");
return QualType();
}
- unsigned Idx = 0;
- bool IsDependent = Record[Idx++];
- RecordDecl *RD = ReadDeclAs<RecordDecl>(*Loc.F, Record, Idx);
- RD = cast_or_null<RecordDecl>(RD->getCanonicalDecl());
+ bool IsDependent = Record.readBool();
+ RecordDecl *RD = Record.readDeclAs<RecordDecl>();
+ RD = cast<RecordDecl>(RD->getCanonicalDecl());
QualType T = Context.getRecordType(RD);
const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
return T;
Error("incorrect encoding of enum type");
return QualType();
}
- unsigned Idx = 0;
- bool IsDependent = Record[Idx++];
- QualType T
- = Context.getEnumType(ReadDeclAs<EnumDecl>(*Loc.F, Record, Idx));
+ bool IsDependent = Record.readBool();
+ QualType T = Context.getEnumType(Record.readDeclAs<EnumDecl>());
const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
return T;
}
Error("incorrect encoding of attributed type");
return QualType();
}
- QualType modifiedType = readType(*Loc.F, Record, Idx);
- QualType equivalentType = readType(*Loc.F, Record, Idx);
- AttributedType::Kind kind = static_cast<AttributedType::Kind>(Record[2]);
+ QualType modifiedType = Record.readType();
+ QualType equivalentType = Record.readType();
+ AttributedType::Kind kind = static_cast<AttributedType::Kind>(Record.readInt());
return Context.getAttributedType(kind, modifiedType, equivalentType);
}
Error("incorrect encoding of paren type");
return QualType();
}
- QualType InnerType = readType(*Loc.F, Record, Idx);
+ QualType InnerType = Record.readType();
return Context.getParenType(InnerType);
}
Error("incorrect encoding of macro defined type");
return QualType();
}
- QualType UnderlyingTy = readType(*Loc.F, Record, Idx);
- IdentifierInfo *MacroII = GetIdentifierInfo(*Loc.F, Record, Idx);
+ QualType UnderlyingTy = Record.readType();
+ IdentifierInfo *MacroII = Record.readIdentifier();
return Context.getMacroQualifiedType(UnderlyingTy, MacroII);
}
Error("incorrect encoding of pack expansion type");
return QualType();
}
- QualType Pattern = readType(*Loc.F, Record, Idx);
+ QualType Pattern = Record.readType();
if (Pattern.isNull())
return QualType();
Optional<unsigned> NumExpansions;
- if (Record[1])
- NumExpansions = Record[1] - 1;
+ unsigned RawNumExpansions = Record.readInt();
+ if (RawNumExpansions)
+ NumExpansions = RawNumExpansions - 1;
return Context.getPackExpansionType(Pattern, NumExpansions);
}
case TYPE_ELABORATED: {
- unsigned Idx = 0;
- ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
- NestedNameSpecifier *NNS = ReadNestedNameSpecifier(*Loc.F, Record, Idx);
- QualType NamedType = readType(*Loc.F, Record, Idx);
- TagDecl *OwnedTagDecl = ReadDeclAs<TagDecl>(*Loc.F, Record, Idx);
+ ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record.readInt();
+ NestedNameSpecifier *NNS = Record.readNestedNameSpecifier();
+ QualType NamedType = Record.readType();
+ TagDecl *OwnedTagDecl = Record.readDeclAs<TagDecl>();
return Context.getElaboratedType(Keyword, NNS, NamedType, OwnedTagDecl);
}
case TYPE_OBJC_INTERFACE: {
- unsigned Idx = 0;
- ObjCInterfaceDecl *ItfD
- = ReadDeclAs<ObjCInterfaceDecl>(*Loc.F, Record, Idx);
+ ObjCInterfaceDecl *ItfD = Record.readDeclAs<ObjCInterfaceDecl>();
return Context.getObjCInterfaceType(ItfD->getCanonicalDecl());
}
case TYPE_OBJC_TYPE_PARAM: {
- unsigned Idx = 0;
- ObjCTypeParamDecl *Decl
- = ReadDeclAs<ObjCTypeParamDecl>(*Loc.F, Record, Idx);
- unsigned NumProtos = Record[Idx++];
+ ObjCTypeParamDecl *Decl = Record.readDeclAs<ObjCTypeParamDecl>();
+ unsigned NumProtos = Record.readInt();
SmallVector<ObjCProtocolDecl*, 4> Protos;
for (unsigned I = 0; I != NumProtos; ++I)
- Protos.push_back(ReadDeclAs<ObjCProtocolDecl>(*Loc.F, Record, Idx));
+ Protos.push_back(Record.readDeclAs<ObjCProtocolDecl>());
return Context.getObjCTypeParamType(Decl, Protos);
}
case TYPE_OBJC_OBJECT: {
- unsigned Idx = 0;
- QualType Base = readType(*Loc.F, Record, Idx);
- unsigned NumTypeArgs = Record[Idx++];
+ QualType Base = Record.readType();
+ unsigned NumTypeArgs = Record.readInt();
SmallVector<QualType, 4> TypeArgs;
for (unsigned I = 0; I != NumTypeArgs; ++I)
- TypeArgs.push_back(readType(*Loc.F, Record, Idx));
- unsigned NumProtos = Record[Idx++];
+ TypeArgs.push_back(Record.readType());
+ unsigned NumProtos = Record.readInt();
SmallVector<ObjCProtocolDecl*, 4> Protos;
for (unsigned I = 0; I != NumProtos; ++I)
- Protos.push_back(ReadDeclAs<ObjCProtocolDecl>(*Loc.F, Record, Idx));
- bool IsKindOf = Record[Idx++];
+ Protos.push_back(Record.readDeclAs<ObjCProtocolDecl>());
+ bool IsKindOf = Record.readBool();
return Context.getObjCObjectType(Base, TypeArgs, Protos, IsKindOf);
}
case TYPE_OBJC_OBJECT_POINTER: {
- unsigned Idx = 0;
- QualType Pointee = readType(*Loc.F, Record, Idx);
+ QualType Pointee = Record.readType();
return Context.getObjCObjectPointerType(Pointee);
}
case TYPE_SUBST_TEMPLATE_TYPE_PARM: {
- unsigned Idx = 0;
- QualType Parm = readType(*Loc.F, Record, Idx);
- QualType Replacement = readType(*Loc.F, Record, Idx);
+ QualType Parm = Record.readType();
+ QualType Replacement = Record.readType();
return Context.getSubstTemplateTypeParmType(
cast<TemplateTypeParmType>(Parm),
Context.getCanonicalType(Replacement));
}
case TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK: {
- unsigned Idx = 0;
- QualType Parm = readType(*Loc.F, Record, Idx);
- TemplateArgument ArgPack = ReadTemplateArgument(*Loc.F, Record, Idx);
+ QualType Parm = Record.readType();
+ TemplateArgument ArgPack = Record.readTemplateArgument();
return Context.getSubstTemplateTypeParmPackType(
cast<TemplateTypeParmType>(Parm),
ArgPack);
}
case TYPE_INJECTED_CLASS_NAME: {
- CXXRecordDecl *D = ReadDeclAs<CXXRecordDecl>(*Loc.F, Record, Idx);
- QualType TST = readType(*Loc.F, Record, Idx); // probably derivable
+ CXXRecordDecl *D = Record.readDeclAs<CXXRecordDecl>();
+ QualType TST = Record.readType(); // probably derivable
// FIXME: ASTContext::getInjectedClassNameType is not currently suitable
// for AST reading, too much interdependencies.
const Type *T = nullptr;
}
case TYPE_TEMPLATE_TYPE_PARM: {
- unsigned Idx = 0;
- unsigned Depth = Record[Idx++];
- unsigned Index = Record[Idx++];
- bool Pack = Record[Idx++];
- TemplateTypeParmDecl *D
- = ReadDeclAs<TemplateTypeParmDecl>(*Loc.F, Record, Idx);
+ unsigned Depth = Record.readInt();
+ unsigned Index = Record.readInt();
+ bool Pack = Record.readBool();
+ auto D = Record.readDeclAs<TemplateTypeParmDecl>();
return Context.getTemplateTypeParmType(Depth, Index, Pack, D);
}
case TYPE_DEPENDENT_NAME: {
- unsigned Idx = 0;
- ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
- NestedNameSpecifier *NNS = ReadNestedNameSpecifier(*Loc.F, Record, Idx);
- const IdentifierInfo *Name = GetIdentifierInfo(*Loc.F, Record, Idx);
- QualType Canon = readType(*Loc.F, Record, Idx);
+ ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record.readInt();
+ NestedNameSpecifier *NNS = Record.readNestedNameSpecifier();
+ const IdentifierInfo *Name = Record.readIdentifier();
+ QualType Canon = Record.readType();
if (!Canon.isNull())
Canon = Context.getCanonicalType(Canon);
return Context.getDependentNameType(Keyword, NNS, Name, Canon);
}
case TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION: {
- unsigned Idx = 0;
- ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
- NestedNameSpecifier *NNS = ReadNestedNameSpecifier(*Loc.F, Record, Idx);
- const IdentifierInfo *Name = GetIdentifierInfo(*Loc.F, Record, Idx);
- unsigned NumArgs = Record[Idx++];
+ ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record.readInt();
+ NestedNameSpecifier *NNS = Record.readNestedNameSpecifier();
+ const IdentifierInfo *Name = Record.readIdentifier();
+ unsigned NumArgs = Record.readInt();
SmallVector<TemplateArgument, 8> Args;
Args.reserve(NumArgs);
while (NumArgs--)
- Args.push_back(ReadTemplateArgument(*Loc.F, Record, Idx));
+ Args.push_back(Record.readTemplateArgument());
return Context.getDependentTemplateSpecializationType(Keyword, NNS, Name,
Args);
}
case TYPE_DEPENDENT_SIZED_ARRAY: {
- unsigned Idx = 0;
-
// ArrayType
- QualType ElementType = readType(*Loc.F, Record, Idx);
+ QualType ElementType = Record.readType();
ArrayType::ArraySizeModifier ASM
- = (ArrayType::ArraySizeModifier)Record[Idx++];
- unsigned IndexTypeQuals = Record[Idx++];
+ = (ArrayType::ArraySizeModifier)Record.readInt();
+ unsigned IndexTypeQuals = Record.readInt();
// DependentSizedArrayType
- Expr *NumElts = ReadExpr(*Loc.F);
- SourceRange Brackets = ReadSourceRange(*Loc.F, Record, Idx);
+ Expr *NumElts = Record.readExpr();
+ SourceRange Brackets = Record.readSourceRange();
return Context.getDependentSizedArrayType(ElementType, NumElts, ASM,
IndexTypeQuals, Brackets);
}
case TYPE_TEMPLATE_SPECIALIZATION: {
- unsigned Idx = 0;
- bool IsDependent = Record[Idx++];
- TemplateName Name = ReadTemplateName(*Loc.F, Record, Idx);
+ bool IsDependent = Record.readBool();
+ TemplateName Name = Record.readTemplateName();
SmallVector<TemplateArgument, 8> Args;
- ReadTemplateArgumentList(Args, *Loc.F, Record, Idx);
- QualType Underlying = readType(*Loc.F, Record, Idx);
+ Record.readTemplateArgumentList(Args);
+ QualType Underlying = Record.readType();
QualType T;
if (Underlying.isNull())
T = Context.getCanonicalTemplateSpecializationType(Name, Args);
Error("Incorrect encoding of atomic type");
return QualType();
}
- QualType ValueType = readType(*Loc.F, Record, Idx);
+ QualType ValueType = Record.readType();
return Context.getAtomicType(ValueType);
}
}
// Reading the pipe element type.
- QualType ElementType = readType(*Loc.F, Record, Idx);
- unsigned ReadOnly = Record[1];
+ QualType ElementType = Record.readType();
+ unsigned ReadOnly = Record.readInt();
return Context.getPipeType(ElementType, ReadOnly);
}
case TYPE_DEPENDENT_SIZED_VECTOR: {
- unsigned Idx = 0;
- QualType ElementType = readType(*Loc.F, Record, Idx);
- Expr *SizeExpr = ReadExpr(*Loc.F);
- SourceLocation AttrLoc = ReadSourceLocation(*Loc.F, Record, Idx);
- unsigned VecKind = Record[Idx];
+ QualType ElementType = Record.readType();
+ Expr *SizeExpr = Record.readExpr();
+ SourceLocation AttrLoc = Record.readSourceLocation();
+ unsigned VecKind = Record.readInt();
return Context.getDependentVectorType(ElementType, SizeExpr, AttrLoc,
(VectorType::VectorKind)VecKind);
}
case TYPE_DEPENDENT_SIZED_EXT_VECTOR: {
- unsigned Idx = 0;
-
// DependentSizedExtVectorType
- QualType ElementType = readType(*Loc.F, Record, Idx);
- Expr *SizeExpr = ReadExpr(*Loc.F);
- SourceLocation AttrLoc = ReadSourceLocation(*Loc.F, Record, Idx);
+ QualType ElementType = Record.readType();
+ Expr *SizeExpr = Record.readExpr();
+ SourceLocation AttrLoc = Record.readSourceLocation();
return Context.getDependentSizedExtVectorType(ElementType, SizeExpr,
AttrLoc);
}
case TYPE_DEPENDENT_ADDRESS_SPACE: {
- unsigned Idx = 0;
-
// DependentAddressSpaceType
- QualType PointeeType = readType(*Loc.F, Record, Idx);
- Expr *AddrSpaceExpr = ReadExpr(*Loc.F);
- SourceLocation AttrLoc = ReadSourceLocation(*Loc.F, Record, Idx);
+ QualType PointeeType = Record.readType();
+ Expr *AddrSpaceExpr = Record.readExpr();
+ SourceLocation AttrLoc = Record.readSourceLocation();
return Context.getDependentAddressSpaceType(PointeeType, AddrSpaceExpr,
- AttrLoc);
+ AttrLoc);
}
}
llvm_unreachable("Invalid TypeCode!");
}
-void ASTReader::readExceptionSpec(ModuleFile &ModuleFile,
- SmallVectorImpl<QualType> &Exceptions,
- FunctionProtoType::ExceptionSpecInfo &ESI,
- const RecordData &Record, unsigned &Idx) {
+FunctionProtoType::ExceptionSpecInfo
+ASTRecordReader::readExceptionSpecInfo(SmallVectorImpl<QualType> &Exceptions) {
+ FunctionProtoType::ExceptionSpecInfo ESI;
ExceptionSpecificationType EST =
- static_cast<ExceptionSpecificationType>(Record[Idx++]);
+ static_cast<ExceptionSpecificationType>(readInt());
ESI.Type = EST;
if (EST == EST_Dynamic) {
- for (unsigned I = 0, N = Record[Idx++]; I != N; ++I)
- Exceptions.push_back(readType(ModuleFile, Record, Idx));
+ for (unsigned I = 0, N = readInt(); I != N; ++I)
+ Exceptions.push_back(readType());
ESI.Exceptions = Exceptions;
} else if (isComputedNoexcept(EST)) {
- ESI.NoexceptExpr = ReadExpr(ModuleFile);
+ ESI.NoexceptExpr = readExpr();
} else if (EST == EST_Uninstantiated) {
- ESI.SourceDecl = ReadDeclAs<FunctionDecl>(ModuleFile, Record, Idx);
- ESI.SourceTemplate = ReadDeclAs<FunctionDecl>(ModuleFile, Record, Idx);
+ ESI.SourceDecl = readDeclAs<FunctionDecl>();
+ ESI.SourceTemplate = readDeclAs<FunctionDecl>();
} else if (EST == EST_Unevaluated) {
- ESI.SourceDecl = ReadDeclAs<FunctionDecl>(ModuleFile, Record, Idx);
+ ESI.SourceDecl = readDeclAs<FunctionDecl>();
}
+ return ESI;
}
namespace clang {
class TypeLocReader : public TypeLocVisitor<TypeLocReader> {
- ModuleFile *F;
- ASTReader *Reader;
- const ASTReader::RecordData &Record;
- unsigned &Idx;
+ ASTRecordReader &Reader;
- SourceLocation ReadSourceLocation() {
- return Reader->ReadSourceLocation(*F, Record, Idx);
+ SourceLocation readSourceLocation() {
+ return Reader.readSourceLocation();
}
TypeSourceInfo *GetTypeSourceInfo() {
- return Reader->GetTypeSourceInfo(*F, Record, Idx);
+ return Reader.readTypeSourceInfo();
}
NestedNameSpecifierLoc ReadNestedNameSpecifierLoc() {
- return Reader->ReadNestedNameSpecifierLoc(*F, Record, Idx);
+ return Reader.readNestedNameSpecifierLoc();
}
Attr *ReadAttr() {
- return Reader->ReadAttr(*F, Record, Idx);
+ return Reader.readAttr();
}
public:
- TypeLocReader(ModuleFile &F, ASTReader &Reader,
- const ASTReader::RecordData &Record, unsigned &Idx)
- : F(&F), Reader(&Reader), Record(Record), Idx(Idx) {}
+ TypeLocReader(ASTRecordReader &Reader) : Reader(Reader) {}
// We want compile-time assurance that we've enumerated all of
// these, so unfortunately we have to declare them first, then
}
void TypeLocReader::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
- TL.setBuiltinLoc(ReadSourceLocation());
+ TL.setBuiltinLoc(readSourceLocation());
if (TL.needsExtraLocalData()) {
- TL.setWrittenTypeSpec(static_cast<DeclSpec::TST>(Record[Idx++]));
- TL.setWrittenSignSpec(static_cast<DeclSpec::TSS>(Record[Idx++]));
- TL.setWrittenWidthSpec(static_cast<DeclSpec::TSW>(Record[Idx++]));
- TL.setModeAttr(Record[Idx++]);
+ TL.setWrittenTypeSpec(static_cast<DeclSpec::TST>(Reader.readInt()));
+ TL.setWrittenSignSpec(static_cast<DeclSpec::TSS>(Reader.readInt()));
+ TL.setWrittenWidthSpec(static_cast<DeclSpec::TSW>(Reader.readInt()));
+ TL.setModeAttr(Reader.readInt());
}
}
void TypeLocReader::VisitComplexTypeLoc(ComplexTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitPointerTypeLoc(PointerTypeLoc TL) {
- TL.setStarLoc(ReadSourceLocation());
+ TL.setStarLoc(readSourceLocation());
}
void TypeLocReader::VisitDecayedTypeLoc(DecayedTypeLoc TL) {
}
void TypeLocReader::VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) {
- TL.setExpansionLoc(ReadSourceLocation());
+ TL.setExpansionLoc(readSourceLocation());
}
void TypeLocReader::VisitBlockPointerTypeLoc(BlockPointerTypeLoc TL) {
- TL.setCaretLoc(ReadSourceLocation());
+ TL.setCaretLoc(readSourceLocation());
}
void TypeLocReader::VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {
- TL.setAmpLoc(ReadSourceLocation());
+ TL.setAmpLoc(readSourceLocation());
}
void TypeLocReader::VisitRValueReferenceTypeLoc(RValueReferenceTypeLoc TL) {
- TL.setAmpAmpLoc(ReadSourceLocation());
+ TL.setAmpAmpLoc(readSourceLocation());
}
void TypeLocReader::VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL) {
- TL.setStarLoc(ReadSourceLocation());
+ TL.setStarLoc(readSourceLocation());
TL.setClassTInfo(GetTypeSourceInfo());
}
void TypeLocReader::VisitArrayTypeLoc(ArrayTypeLoc TL) {
- TL.setLBracketLoc(ReadSourceLocation());
- TL.setRBracketLoc(ReadSourceLocation());
- if (Record[Idx++])
- TL.setSizeExpr(Reader->ReadExpr(*F));
+ TL.setLBracketLoc(readSourceLocation());
+ TL.setRBracketLoc(readSourceLocation());
+ if (Reader.readBool())
+ TL.setSizeExpr(Reader.readExpr());
else
TL.setSizeExpr(nullptr);
}
void TypeLocReader::VisitDependentAddressSpaceTypeLoc(
DependentAddressSpaceTypeLoc TL) {
- TL.setAttrNameLoc(ReadSourceLocation());
- SourceRange range;
- range.setBegin(ReadSourceLocation());
- range.setEnd(ReadSourceLocation());
- TL.setAttrOperandParensRange(range);
- TL.setAttrExprOperand(Reader->ReadExpr(*F));
+ TL.setAttrNameLoc(readSourceLocation());
+ TL.setAttrOperandParensRange(Reader.readSourceRange());
+ TL.setAttrExprOperand(Reader.readExpr());
}
void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
DependentSizedExtVectorTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitVectorTypeLoc(VectorTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitDependentVectorTypeLoc(
DependentVectorTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
- TL.setLocalRangeBegin(ReadSourceLocation());
- TL.setLParenLoc(ReadSourceLocation());
- TL.setRParenLoc(ReadSourceLocation());
- TL.setExceptionSpecRange(SourceRange(Reader->ReadSourceLocation(*F, Record, Idx),
- Reader->ReadSourceLocation(*F, Record, Idx)));
- TL.setLocalRangeEnd(ReadSourceLocation());
+ TL.setLocalRangeBegin(readSourceLocation());
+ TL.setLParenLoc(readSourceLocation());
+ TL.setRParenLoc(readSourceLocation());
+ TL.setExceptionSpecRange(Reader.readSourceRange());
+ TL.setLocalRangeEnd(readSourceLocation());
for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) {
- TL.setParam(i, Reader->ReadDeclAs<ParmVarDecl>(*F, Record, Idx));
+ TL.setParam(i, Reader.readDeclAs<ParmVarDecl>());
}
}
}
void TypeLocReader::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitTypedefTypeLoc(TypedefTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) {
- TL.setTypeofLoc(ReadSourceLocation());
- TL.setLParenLoc(ReadSourceLocation());
- TL.setRParenLoc(ReadSourceLocation());
+ TL.setTypeofLoc(readSourceLocation());
+ TL.setLParenLoc(readSourceLocation());
+ TL.setRParenLoc(readSourceLocation());
}
void TypeLocReader::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {
- TL.setTypeofLoc(ReadSourceLocation());
- TL.setLParenLoc(ReadSourceLocation());
- TL.setRParenLoc(ReadSourceLocation());
+ TL.setTypeofLoc(readSourceLocation());
+ TL.setLParenLoc(readSourceLocation());
+ TL.setRParenLoc(readSourceLocation());
TL.setUnderlyingTInfo(GetTypeSourceInfo());
}
void TypeLocReader::VisitDecltypeTypeLoc(DecltypeTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitUnaryTransformTypeLoc(UnaryTransformTypeLoc TL) {
- TL.setKWLoc(ReadSourceLocation());
- TL.setLParenLoc(ReadSourceLocation());
- TL.setRParenLoc(ReadSourceLocation());
+ TL.setKWLoc(readSourceLocation());
+ TL.setLParenLoc(readSourceLocation());
+ TL.setRParenLoc(readSourceLocation());
TL.setUnderlyingTInfo(GetTypeSourceInfo());
}
void TypeLocReader::VisitAutoTypeLoc(AutoTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitDeducedTemplateSpecializationTypeLoc(
DeducedTemplateSpecializationTypeLoc TL) {
- TL.setTemplateNameLoc(ReadSourceLocation());
+ TL.setTemplateNameLoc(readSourceLocation());
}
void TypeLocReader::VisitRecordTypeLoc(RecordTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitEnumTypeLoc(EnumTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitAttributedTypeLoc(AttributedTypeLoc TL) {
}
void TypeLocReader::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
SubstTemplateTypeParmTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
SubstTemplateTypeParmPackTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitTemplateSpecializationTypeLoc(
TemplateSpecializationTypeLoc TL) {
- TL.setTemplateKeywordLoc(ReadSourceLocation());
- TL.setTemplateNameLoc(ReadSourceLocation());
- TL.setLAngleLoc(ReadSourceLocation());
- TL.setRAngleLoc(ReadSourceLocation());
+ TL.setTemplateKeywordLoc(readSourceLocation());
+ TL.setTemplateNameLoc(readSourceLocation());
+ TL.setLAngleLoc(readSourceLocation());
+ TL.setRAngleLoc(readSourceLocation());
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i)
TL.setArgLocInfo(
i,
- Reader->GetTemplateArgumentLocInfo(
- *F, TL.getTypePtr()->getArg(i).getKind(), Record, Idx));
+ Reader.readTemplateArgumentLocInfo(
+ TL.getTypePtr()->getArg(i).getKind()));
}
void TypeLocReader::VisitParenTypeLoc(ParenTypeLoc TL) {
- TL.setLParenLoc(ReadSourceLocation());
- TL.setRParenLoc(ReadSourceLocation());
+ TL.setLParenLoc(readSourceLocation());
+ TL.setRParenLoc(readSourceLocation());
}
void TypeLocReader::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
- TL.setElaboratedKeywordLoc(ReadSourceLocation());
+ TL.setElaboratedKeywordLoc(readSourceLocation());
TL.setQualifierLoc(ReadNestedNameSpecifierLoc());
}
void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
- TL.setElaboratedKeywordLoc(ReadSourceLocation());
+ TL.setElaboratedKeywordLoc(readSourceLocation());
TL.setQualifierLoc(ReadNestedNameSpecifierLoc());
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
DependentTemplateSpecializationTypeLoc TL) {
- TL.setElaboratedKeywordLoc(ReadSourceLocation());
+ TL.setElaboratedKeywordLoc(readSourceLocation());
TL.setQualifierLoc(ReadNestedNameSpecifierLoc());
- TL.setTemplateKeywordLoc(ReadSourceLocation());
- TL.setTemplateNameLoc(ReadSourceLocation());
- TL.setLAngleLoc(ReadSourceLocation());
- TL.setRAngleLoc(ReadSourceLocation());
+ TL.setTemplateKeywordLoc(readSourceLocation());
+ TL.setTemplateNameLoc(readSourceLocation());
+ TL.setLAngleLoc(readSourceLocation());
+ TL.setRAngleLoc(readSourceLocation());
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I)
TL.setArgLocInfo(
I,
- Reader->GetTemplateArgumentLocInfo(
- *F, TL.getTypePtr()->getArg(I).getKind(), Record, Idx));
+ Reader.readTemplateArgumentLocInfo(
+ TL.getTypePtr()->getArg(I).getKind()));
}
void TypeLocReader::VisitPackExpansionTypeLoc(PackExpansionTypeLoc TL) {
- TL.setEllipsisLoc(ReadSourceLocation());
+ TL.setEllipsisLoc(readSourceLocation());
}
void TypeLocReader::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {
- TL.setNameLoc(ReadSourceLocation());
+ TL.setNameLoc(readSourceLocation());
}
void TypeLocReader::VisitObjCTypeParamTypeLoc(ObjCTypeParamTypeLoc TL) {
if (TL.getNumProtocols()) {
- TL.setProtocolLAngleLoc(ReadSourceLocation());
- TL.setProtocolRAngleLoc(ReadSourceLocation());
+ TL.setProtocolLAngleLoc(readSourceLocation());
+ TL.setProtocolRAngleLoc(readSourceLocation());
}
for (unsigned i = 0, e = TL.getNumProtocols(); i != e; ++i)
- TL.setProtocolLoc(i, ReadSourceLocation());
+ TL.setProtocolLoc(i, readSourceLocation());
}
void TypeLocReader::VisitObjCObjectTypeLoc(ObjCObjectTypeLoc TL) {
- TL.setHasBaseTypeAsWritten(Record[Idx++]);
- TL.setTypeArgsLAngleLoc(ReadSourceLocation());
- TL.setTypeArgsRAngleLoc(ReadSourceLocation());
+ TL.setHasBaseTypeAsWritten(Reader.readBool());
+ TL.setTypeArgsLAngleLoc(readSourceLocation());
+ TL.setTypeArgsRAngleLoc(readSourceLocation());
for (unsigned i = 0, e = TL.getNumTypeArgs(); i != e; ++i)
TL.setTypeArgTInfo(i, GetTypeSourceInfo());
- TL.setProtocolLAngleLoc(ReadSourceLocation());
- TL.setProtocolRAngleLoc(ReadSourceLocation());
+ TL.setProtocolLAngleLoc(readSourceLocation());
+ TL.setProtocolRAngleLoc(readSourceLocation());
for (unsigned i = 0, e = TL.getNumProtocols(); i != e; ++i)
- TL.setProtocolLoc(i, ReadSourceLocation());
+ TL.setProtocolLoc(i, readSourceLocation());
}
void TypeLocReader::VisitObjCObjectPointerTypeLoc(ObjCObjectPointerTypeLoc TL) {
- TL.setStarLoc(ReadSourceLocation());
+ TL.setStarLoc(readSourceLocation());
}
void TypeLocReader::VisitAtomicTypeLoc(AtomicTypeLoc TL) {
- TL.setKWLoc(ReadSourceLocation());
- TL.setLParenLoc(ReadSourceLocation());
- TL.setRParenLoc(ReadSourceLocation());
+ TL.setKWLoc(readSourceLocation());
+ TL.setLParenLoc(readSourceLocation());
+ TL.setRParenLoc(readSourceLocation());
}
void TypeLocReader::VisitPipeTypeLoc(PipeTypeLoc TL) {
- TL.setKWLoc(ReadSourceLocation());
+ TL.setKWLoc(readSourceLocation());
}
-void ASTReader::ReadTypeLoc(ModuleFile &F, const ASTReader::RecordData &Record,
- unsigned &Idx, TypeLoc TL) {
- TypeLocReader TLR(F, *this, Record, Idx);
+void ASTRecordReader::readTypeLoc(TypeLoc TL) {
+ TypeLocReader TLR(*this);
for (; !TL.isNull(); TL = TL.getNextTypeLoc())
TLR.Visit(TL);
}
-TypeSourceInfo *
-ASTReader::GetTypeSourceInfo(ModuleFile &F, const ASTReader::RecordData &Record,
- unsigned &Idx) {
- QualType InfoTy = readType(F, Record, Idx);
+TypeSourceInfo *ASTRecordReader::readTypeSourceInfo() {
+ QualType InfoTy = readType();
if (InfoTy.isNull())
return nullptr;
TypeSourceInfo *TInfo = getContext().CreateTypeSourceInfo(InfoTy);
- ReadTypeLoc(F, Record, Idx, TInfo->getTypeLoc());
+ readTypeLoc(TInfo->getTypeLoc());
return TInfo;
}
}
TemplateArgumentLocInfo
-ASTReader::GetTemplateArgumentLocInfo(ModuleFile &F,
- TemplateArgument::ArgKind Kind,
- const RecordData &Record,
- unsigned &Index) {
+ASTRecordReader::readTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind) {
switch (Kind) {
case TemplateArgument::Expression:
- return ReadExpr(F);
+ return readExpr();
case TemplateArgument::Type:
- return GetTypeSourceInfo(F, Record, Index);
+ return readTypeSourceInfo();
case TemplateArgument::Template: {
- NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc(F, Record,
- Index);
- SourceLocation TemplateNameLoc = ReadSourceLocation(F, Record, Index);
+ NestedNameSpecifierLoc QualifierLoc =
+ readNestedNameSpecifierLoc();
+ SourceLocation TemplateNameLoc = readSourceLocation();
return TemplateArgumentLocInfo(QualifierLoc, TemplateNameLoc,
SourceLocation());
}
case TemplateArgument::TemplateExpansion: {
- NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc(F, Record,
- Index);
- SourceLocation TemplateNameLoc = ReadSourceLocation(F, Record, Index);
- SourceLocation EllipsisLoc = ReadSourceLocation(F, Record, Index);
+ NestedNameSpecifierLoc QualifierLoc = readNestedNameSpecifierLoc();
+ SourceLocation TemplateNameLoc = readSourceLocation();
+ SourceLocation EllipsisLoc = readSourceLocation();
return TemplateArgumentLocInfo(QualifierLoc, TemplateNameLoc,
EllipsisLoc);
}
llvm_unreachable("unexpected template argument loc");
}
-TemplateArgumentLoc
-ASTReader::ReadTemplateArgumentLoc(ModuleFile &F,
- const RecordData &Record, unsigned &Index) {
- TemplateArgument Arg = ReadTemplateArgument(F, Record, Index);
+TemplateArgumentLoc ASTRecordReader::readTemplateArgumentLoc() {
+ TemplateArgument Arg = readTemplateArgument();
if (Arg.getKind() == TemplateArgument::Expression) {
- if (Record[Index++]) // bool InfoHasSameExpr.
+ if (readBool()) // bool InfoHasSameExpr.
return TemplateArgumentLoc(Arg, TemplateArgumentLocInfo(Arg.getAsExpr()));
}
- return TemplateArgumentLoc(Arg, GetTemplateArgumentLocInfo(F, Arg.getKind(),
- Record, Index));
+ return TemplateArgumentLoc(Arg, readTemplateArgumentLocInfo(Arg.getKind()));
}
-const ASTTemplateArgumentListInfo*
-ASTReader::ReadASTTemplateArgumentListInfo(ModuleFile &F,
- const RecordData &Record,
- unsigned &Index) {
- SourceLocation LAngleLoc = ReadSourceLocation(F, Record, Index);
- SourceLocation RAngleLoc = ReadSourceLocation(F, Record, Index);
- unsigned NumArgsAsWritten = Record[Index++];
+const ASTTemplateArgumentListInfo *
+ASTRecordReader::readASTTemplateArgumentListInfo() {
+ SourceLocation LAngleLoc = readSourceLocation();
+ SourceLocation RAngleLoc = readSourceLocation();
+ unsigned NumArgsAsWritten = readInt();
TemplateArgumentListInfo TemplArgsInfo(LAngleLoc, RAngleLoc);
for (unsigned i = 0; i != NumArgsAsWritten; ++i)
- TemplArgsInfo.addArgument(ReadTemplateArgumentLoc(F, Record, Index));
+ TemplArgsInfo.addArgument(readTemplateArgumentLoc());
return ASTTemplateArgumentListInfo::Create(getContext(), TemplArgsInfo);
}
}
ReadingKindTracker ReadingKind(Read_Decl, *this);
- RecordData Record;
Expected<unsigned> MaybeCode = Cursor.ReadCode();
if (!MaybeCode) {
Error(MaybeCode.takeError());
}
unsigned Code = MaybeCode.get();
- Expected<unsigned> MaybeRecCode = Cursor.readRecord(Code, Record);
+ ASTRecordReader Record(*this, *Loc.F);
+ Expected<unsigned> MaybeRecCode = Record.readRecord(Cursor, Code);
if (!MaybeRecCode) {
Error(MaybeRecCode.takeError());
return nullptr;
return nullptr;
}
- unsigned Idx = 0;
- return ReadCXXCtorInitializers(*Loc.F, Record, Idx);
+ return Record.readCXXCtorInitializers();
}
CXXBaseSpecifier *ASTReader::GetExternalCXXBaseSpecifiers(uint64_t Offset) {
return nullptr;
}
ReadingKindTracker ReadingKind(Read_Decl, *this);
- RecordData Record;
Expected<unsigned> MaybeCode = Cursor.ReadCode();
if (!MaybeCode) {
}
unsigned Code = MaybeCode.get();
- Expected<unsigned> MaybeRecCode = Cursor.readRecord(Code, Record);
+ ASTRecordReader Record(*this, *Loc.F);
+ Expected<unsigned> MaybeRecCode = Record.readRecord(Cursor, Code);
if (!MaybeRecCode) {
Error(MaybeCode.takeError());
return nullptr;
return nullptr;
}
- unsigned Idx = 0;
- unsigned NumBases = Record[Idx++];
+ unsigned NumBases = Record.readInt();
void *Mem = Context.Allocate(sizeof(CXXBaseSpecifier) * NumBases);
CXXBaseSpecifier *Bases = new (Mem) CXXBaseSpecifier [NumBases];
for (unsigned I = 0; I != NumBases; ++I)
- Bases[I] = ReadCXXBaseSpecifier(*Loc.F, Record, Idx);
+ Bases[I] = Record.readCXXBaseSpecifier();
return Bases;
}
return LocalID + I->second;
}
-DeclarationName
-ASTReader::ReadDeclarationName(ModuleFile &F,
- const RecordData &Record, unsigned &Idx) {
+DeclarationName ASTRecordReader::readDeclarationName() {
ASTContext &Context = getContext();
- DeclarationName::NameKind Kind = (DeclarationName::NameKind)Record[Idx++];
+ DeclarationName::NameKind Kind = (DeclarationName::NameKind)readInt();
switch (Kind) {
case DeclarationName::Identifier:
- return DeclarationName(GetIdentifierInfo(F, Record, Idx));
+ return DeclarationName(readIdentifier());
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
case DeclarationName::ObjCMultiArgSelector:
- return DeclarationName(ReadSelector(F, Record, Idx));
+ return DeclarationName(readSelector());
case DeclarationName::CXXConstructorName:
return Context.DeclarationNames.getCXXConstructorName(
- Context.getCanonicalType(readType(F, Record, Idx)));
+ Context.getCanonicalType(readType()));
case DeclarationName::CXXDestructorName:
return Context.DeclarationNames.getCXXDestructorName(
- Context.getCanonicalType(readType(F, Record, Idx)));
+ Context.getCanonicalType(readType()));
case DeclarationName::CXXDeductionGuideName:
return Context.DeclarationNames.getCXXDeductionGuideName(
- ReadDeclAs<TemplateDecl>(F, Record, Idx));
+ readDeclAs<TemplateDecl>());
case DeclarationName::CXXConversionFunctionName:
return Context.DeclarationNames.getCXXConversionFunctionName(
- Context.getCanonicalType(readType(F, Record, Idx)));
+ Context.getCanonicalType(readType()));
case DeclarationName::CXXOperatorName:
return Context.DeclarationNames.getCXXOperatorName(
- (OverloadedOperatorKind)Record[Idx++]);
+ (OverloadedOperatorKind)readInt());
case DeclarationName::CXXLiteralOperatorName:
return Context.DeclarationNames.getCXXLiteralOperatorName(
- GetIdentifierInfo(F, Record, Idx));
+ readIdentifier());
case DeclarationName::CXXUsingDirective:
return DeclarationName::getUsingDirectiveName();
llvm_unreachable("Invalid NameKind!");
}
-void ASTReader::ReadDeclarationNameLoc(ModuleFile &F,
- DeclarationNameLoc &DNLoc,
- DeclarationName Name,
- const RecordData &Record, unsigned &Idx) {
+DeclarationNameLoc
+ASTRecordReader::readDeclarationNameLoc(DeclarationName Name) {
+ DeclarationNameLoc DNLoc;
switch (Name.getNameKind()) {
case DeclarationName::CXXConstructorName:
case DeclarationName::CXXDestructorName:
case DeclarationName::CXXConversionFunctionName:
- DNLoc.NamedType.TInfo = GetTypeSourceInfo(F, Record, Idx);
+ DNLoc.NamedType.TInfo = readTypeSourceInfo();
break;
case DeclarationName::CXXOperatorName:
DNLoc.CXXOperatorName.BeginOpNameLoc
- = ReadSourceLocation(F, Record, Idx).getRawEncoding();
+ = readSourceLocation().getRawEncoding();
DNLoc.CXXOperatorName.EndOpNameLoc
- = ReadSourceLocation(F, Record, Idx).getRawEncoding();
+ = readSourceLocation().getRawEncoding();
break;
case DeclarationName::CXXLiteralOperatorName:
DNLoc.CXXLiteralOperatorName.OpNameLoc
- = ReadSourceLocation(F, Record, Idx).getRawEncoding();
+ = readSourceLocation().getRawEncoding();
break;
case DeclarationName::Identifier:
case DeclarationName::CXXDeductionGuideName:
break;
}
+ return DNLoc;
}
-void ASTReader::ReadDeclarationNameInfo(ModuleFile &F,
- DeclarationNameInfo &NameInfo,
- const RecordData &Record, unsigned &Idx) {
- NameInfo.setName(ReadDeclarationName(F, Record, Idx));
- NameInfo.setLoc(ReadSourceLocation(F, Record, Idx));
- DeclarationNameLoc DNLoc;
- ReadDeclarationNameLoc(F, DNLoc, NameInfo.getName(), Record, Idx);
- NameInfo.setInfo(DNLoc);
+DeclarationNameInfo ASTRecordReader::readDeclarationNameInfo() {
+ DeclarationNameInfo NameInfo;
+ NameInfo.setName(readDeclarationName());
+ NameInfo.setLoc(readSourceLocation());
+ NameInfo.setInfo(readDeclarationNameLoc(NameInfo.getName()));
+ return NameInfo;
}
-void ASTReader::ReadQualifierInfo(ModuleFile &F, QualifierInfo &Info,
- const RecordData &Record, unsigned &Idx) {
- Info.QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, Idx);
- unsigned NumTPLists = Record[Idx++];
+void ASTRecordReader::readQualifierInfo(QualifierInfo &Info) {
+ Info.QualifierLoc = readNestedNameSpecifierLoc();
+ unsigned NumTPLists = readInt();
Info.NumTemplParamLists = NumTPLists;
if (NumTPLists) {
Info.TemplParamLists =
new (getContext()) TemplateParameterList *[NumTPLists];
for (unsigned i = 0; i != NumTPLists; ++i)
- Info.TemplParamLists[i] = ReadTemplateParameterList(F, Record, Idx);
+ Info.TemplParamLists[i] = readTemplateParameterList();
}
}
TemplateName
-ASTReader::ReadTemplateName(ModuleFile &F, const RecordData &Record,
- unsigned &Idx) {
+ASTRecordReader::readTemplateName() {
ASTContext &Context = getContext();
- TemplateName::NameKind Kind = (TemplateName::NameKind)Record[Idx++];
+ TemplateName::NameKind Kind = (TemplateName::NameKind)readInt();
switch (Kind) {
case TemplateName::Template:
- return TemplateName(ReadDeclAs<TemplateDecl>(F, Record, Idx));
+ return TemplateName(readDeclAs<TemplateDecl>());
case TemplateName::OverloadedTemplate: {
- unsigned size = Record[Idx++];
+ unsigned size = readInt();
UnresolvedSet<8> Decls;
while (size--)
- Decls.addDecl(ReadDeclAs<NamedDecl>(F, Record, Idx));
+ Decls.addDecl(readDeclAs<NamedDecl>());
return Context.getOverloadedTemplateName(Decls.begin(), Decls.end());
}
case TemplateName::AssumedTemplate: {
- DeclarationName Name = ReadDeclarationName(F, Record, Idx);
+ DeclarationName Name = readDeclarationName();
return Context.getAssumedTemplateName(Name);
}
case TemplateName::QualifiedTemplate: {
- NestedNameSpecifier *NNS = ReadNestedNameSpecifier(F, Record, Idx);
- bool hasTemplKeyword = Record[Idx++];
- TemplateDecl *Template = ReadDeclAs<TemplateDecl>(F, Record, Idx);
+ NestedNameSpecifier *NNS = readNestedNameSpecifier();
+ bool hasTemplKeyword = readBool();
+ TemplateDecl *Template = readDeclAs<TemplateDecl>();
return Context.getQualifiedTemplateName(NNS, hasTemplKeyword, Template);
}
case TemplateName::DependentTemplate: {
- NestedNameSpecifier *NNS = ReadNestedNameSpecifier(F, Record, Idx);
- if (Record[Idx++]) // isIdentifier
- return Context.getDependentTemplateName(NNS,
- GetIdentifierInfo(F, Record,
- Idx));
+ NestedNameSpecifier *NNS = readNestedNameSpecifier();
+ if (readBool()) // isIdentifier
+ return Context.getDependentTemplateName(NNS, readIdentifier());
return Context.getDependentTemplateName(NNS,
- (OverloadedOperatorKind)Record[Idx++]);
+ (OverloadedOperatorKind)readInt());
}
case TemplateName::SubstTemplateTemplateParm: {
- TemplateTemplateParmDecl *param
- = ReadDeclAs<TemplateTemplateParmDecl>(F, Record, Idx);
+ auto *param = readDeclAs<TemplateTemplateParmDecl>();
if (!param) return TemplateName();
- TemplateName replacement = ReadTemplateName(F, Record, Idx);
+ TemplateName replacement = readTemplateName();
return Context.getSubstTemplateTemplateParm(param, replacement);
}
case TemplateName::SubstTemplateTemplateParmPack: {
TemplateTemplateParmDecl *Param
- = ReadDeclAs<TemplateTemplateParmDecl>(F, Record, Idx);
+ = readDeclAs<TemplateTemplateParmDecl>();
if (!Param)
return TemplateName();
- TemplateArgument ArgPack = ReadTemplateArgument(F, Record, Idx);
+ TemplateArgument ArgPack = readTemplateArgument();
if (ArgPack.getKind() != TemplateArgument::Pack)
return TemplateName();
llvm_unreachable("Unhandled template name kind!");
}
-TemplateArgument ASTReader::ReadTemplateArgument(ModuleFile &F,
- const RecordData &Record,
- unsigned &Idx,
- bool Canonicalize) {
+TemplateArgument ASTRecordReader::readTemplateArgument(bool Canonicalize) {
ASTContext &Context = getContext();
if (Canonicalize) {
// The caller wants a canonical template argument. Sometimes the AST only
// wants template arguments in canonical form (particularly as the template
// argument lists of template specializations) so ensure we preserve that
// canonical form across serialization.
- TemplateArgument Arg = ReadTemplateArgument(F, Record, Idx, false);
+ TemplateArgument Arg = readTemplateArgument(false);
return Context.getCanonicalTemplateArgument(Arg);
}
- TemplateArgument::ArgKind Kind = (TemplateArgument::ArgKind)Record[Idx++];
+ TemplateArgument::ArgKind Kind = (TemplateArgument::ArgKind) readInt();
switch (Kind) {
case TemplateArgument::Null:
return TemplateArgument();
case TemplateArgument::Type:
- return TemplateArgument(readType(F, Record, Idx));
+ return TemplateArgument(readType());
case TemplateArgument::Declaration: {
- ValueDecl *D = ReadDeclAs<ValueDecl>(F, Record, Idx);
- return TemplateArgument(D, readType(F, Record, Idx));
+ ValueDecl *D = readDeclAs<ValueDecl>();
+ return TemplateArgument(D, readType());
}
case TemplateArgument::NullPtr:
- return TemplateArgument(readType(F, Record, Idx), /*isNullPtr*/true);
+ return TemplateArgument(readType(), /*isNullPtr*/true);
case TemplateArgument::Integral: {
- llvm::APSInt Value = ReadAPSInt(Record, Idx);
- QualType T = readType(F, Record, Idx);
+ llvm::APSInt Value = readAPSInt();
+ QualType T = readType();
return TemplateArgument(Context, Value, T);
}
case TemplateArgument::Template:
- return TemplateArgument(ReadTemplateName(F, Record, Idx));
+ return TemplateArgument(readTemplateName());
case TemplateArgument::TemplateExpansion: {
- TemplateName Name = ReadTemplateName(F, Record, Idx);
+ TemplateName Name = readTemplateName();
Optional<unsigned> NumTemplateExpansions;
- if (unsigned NumExpansions = Record[Idx++])
+ if (unsigned NumExpansions = readInt())
NumTemplateExpansions = NumExpansions - 1;
return TemplateArgument(Name, NumTemplateExpansions);
}
case TemplateArgument::Expression:
- return TemplateArgument(ReadExpr(F));
+ return TemplateArgument(readExpr());
case TemplateArgument::Pack: {
- unsigned NumArgs = Record[Idx++];
+ unsigned NumArgs = readInt();
TemplateArgument *Args = new (Context) TemplateArgument[NumArgs];
for (unsigned I = 0; I != NumArgs; ++I)
- Args[I] = ReadTemplateArgument(F, Record, Idx);
+ Args[I] = readTemplateArgument();
return TemplateArgument(llvm::makeArrayRef(Args, NumArgs));
}
}
}
TemplateParameterList *
-ASTReader::ReadTemplateParameterList(ModuleFile &F,
- const RecordData &Record, unsigned &Idx) {
- SourceLocation TemplateLoc = ReadSourceLocation(F, Record, Idx);
- SourceLocation LAngleLoc = ReadSourceLocation(F, Record, Idx);
- SourceLocation RAngleLoc = ReadSourceLocation(F, Record, Idx);
+ASTRecordReader::readTemplateParameterList() {
+ SourceLocation TemplateLoc = readSourceLocation();
+ SourceLocation LAngleLoc = readSourceLocation();
+ SourceLocation RAngleLoc = readSourceLocation();
- unsigned NumParams = Record[Idx++];
+ unsigned NumParams = readInt();
SmallVector<NamedDecl *, 16> Params;
Params.reserve(NumParams);
while (NumParams--)
- Params.push_back(ReadDeclAs<NamedDecl>(F, Record, Idx));
+ Params.push_back(readDeclAs<NamedDecl>());
- bool HasRequiresClause = Record[Idx++];
- Expr *RequiresClause = HasRequiresClause ? ReadExpr(F) : nullptr;
+ bool HasRequiresClause = readBool();
+ Expr *RequiresClause = HasRequiresClause ? readExpr() : nullptr;
TemplateParameterList *TemplateParams = TemplateParameterList::Create(
getContext(), TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause);
return TemplateParams;
}
-void
-ASTReader::
-ReadTemplateArgumentList(SmallVectorImpl<TemplateArgument> &TemplArgs,
- ModuleFile &F, const RecordData &Record,
- unsigned &Idx, bool Canonicalize) {
- unsigned NumTemplateArgs = Record[Idx++];
+void ASTRecordReader::readTemplateArgumentList(
+ SmallVectorImpl<TemplateArgument> &TemplArgs,
+ bool Canonicalize) {
+ unsigned NumTemplateArgs = readInt();
TemplArgs.reserve(NumTemplateArgs);
while (NumTemplateArgs--)
- TemplArgs.push_back(ReadTemplateArgument(F, Record, Idx, Canonicalize));
+ TemplArgs.push_back(readTemplateArgument(Canonicalize));
}
/// Read a UnresolvedSet structure.
-void ASTReader::ReadUnresolvedSet(ModuleFile &F, LazyASTUnresolvedSet &Set,
- const RecordData &Record, unsigned &Idx) {
- unsigned NumDecls = Record[Idx++];
+void ASTRecordReader::readUnresolvedSet(LazyASTUnresolvedSet &Set) {
+ unsigned NumDecls = readInt();
Set.reserve(getContext(), NumDecls);
while (NumDecls--) {
- DeclID ID = ReadDeclID(F, Record, Idx);
- AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
+ DeclID ID = readDeclID();
+ AccessSpecifier AS = (AccessSpecifier) readInt();
Set.addLazyDecl(getContext(), ID, AS);
}
}
CXXBaseSpecifier
-ASTReader::ReadCXXBaseSpecifier(ModuleFile &F,
- const RecordData &Record, unsigned &Idx) {
- bool isVirtual = static_cast<bool>(Record[Idx++]);
- bool isBaseOfClass = static_cast<bool>(Record[Idx++]);
- AccessSpecifier AS = static_cast<AccessSpecifier>(Record[Idx++]);
- bool inheritConstructors = static_cast<bool>(Record[Idx++]);
- TypeSourceInfo *TInfo = GetTypeSourceInfo(F, Record, Idx);
- SourceRange Range = ReadSourceRange(F, Record, Idx);
- SourceLocation EllipsisLoc = ReadSourceLocation(F, Record, Idx);
+ASTRecordReader::readCXXBaseSpecifier() {
+ bool isVirtual = readBool();
+ bool isBaseOfClass = readBool();
+ AccessSpecifier AS = static_cast<AccessSpecifier>(readInt());
+ bool inheritConstructors = readBool();
+ TypeSourceInfo *TInfo = readTypeSourceInfo();
+ SourceRange Range = readSourceRange();
+ SourceLocation EllipsisLoc = readSourceLocation();
CXXBaseSpecifier Result(Range, isVirtual, isBaseOfClass, AS, TInfo,
EllipsisLoc);
Result.setInheritConstructors(inheritConstructors);
}
CXXCtorInitializer **
-ASTReader::ReadCXXCtorInitializers(ModuleFile &F, const RecordData &Record,
- unsigned &Idx) {
+ASTRecordReader::readCXXCtorInitializers() {
ASTContext &Context = getContext();
- unsigned NumInitializers = Record[Idx++];
+ unsigned NumInitializers = readInt();
assert(NumInitializers && "wrote ctor initializers but have no inits");
auto **CtorInitializers = new (Context) CXXCtorInitializer*[NumInitializers];
for (unsigned i = 0; i != NumInitializers; ++i) {
FieldDecl *Member = nullptr;
IndirectFieldDecl *IndirectMember = nullptr;
- CtorInitializerType Type = (CtorInitializerType)Record[Idx++];
+ CtorInitializerType Type = (CtorInitializerType) readInt();
switch (Type) {
case CTOR_INITIALIZER_BASE:
- TInfo = GetTypeSourceInfo(F, Record, Idx);
- IsBaseVirtual = Record[Idx++];
+ TInfo = readTypeSourceInfo();
+ IsBaseVirtual = readBool();
break;
case CTOR_INITIALIZER_DELEGATING:
- TInfo = GetTypeSourceInfo(F, Record, Idx);
+ TInfo = readTypeSourceInfo();
break;
case CTOR_INITIALIZER_MEMBER:
- Member = ReadDeclAs<FieldDecl>(F, Record, Idx);
+ Member = readDeclAs<FieldDecl>();
break;
case CTOR_INITIALIZER_INDIRECT_MEMBER:
- IndirectMember = ReadDeclAs<IndirectFieldDecl>(F, Record, Idx);
+ IndirectMember = readDeclAs<IndirectFieldDecl>();
break;
}
- SourceLocation MemberOrEllipsisLoc = ReadSourceLocation(F, Record, Idx);
- Expr *Init = ReadExpr(F);
- SourceLocation LParenLoc = ReadSourceLocation(F, Record, Idx);
- SourceLocation RParenLoc = ReadSourceLocation(F, Record, Idx);
+ SourceLocation MemberOrEllipsisLoc = readSourceLocation();
+ Expr *Init = readExpr();
+ SourceLocation LParenLoc = readSourceLocation();
+ SourceLocation RParenLoc = readSourceLocation();
CXXCtorInitializer *BOMInit;
if (Type == CTOR_INITIALIZER_BASE)
CXXCtorInitializer(Context, IndirectMember, MemberOrEllipsisLoc,
LParenLoc, Init, RParenLoc);
- if (/*IsWritten*/Record[Idx++]) {
- unsigned SourceOrder = Record[Idx++];
+ if (/*IsWritten*/readBool()) {
+ unsigned SourceOrder = readInt();
BOMInit->setSourceOrder(SourceOrder);
}
}
NestedNameSpecifier *
-ASTReader::ReadNestedNameSpecifier(ModuleFile &F,
- const RecordData &Record, unsigned &Idx) {
+ASTRecordReader::readNestedNameSpecifier() {
ASTContext &Context = getContext();
- unsigned N = Record[Idx++];
+ unsigned N = readInt();
NestedNameSpecifier *NNS = nullptr, *Prev = nullptr;
for (unsigned I = 0; I != N; ++I) {
NestedNameSpecifier::SpecifierKind Kind
- = (NestedNameSpecifier::SpecifierKind)Record[Idx++];
+ = (NestedNameSpecifier::SpecifierKind)readInt();
switch (Kind) {
case NestedNameSpecifier::Identifier: {
- IdentifierInfo *II = GetIdentifierInfo(F, Record, Idx);
+ IdentifierInfo *II = readIdentifier();
NNS = NestedNameSpecifier::Create(Context, Prev, II);
break;
}
case NestedNameSpecifier::Namespace: {
- NamespaceDecl *NS = ReadDeclAs<NamespaceDecl>(F, Record, Idx);
+ NamespaceDecl *NS = readDeclAs<NamespaceDecl>();
NNS = NestedNameSpecifier::Create(Context, Prev, NS);
break;
}
case NestedNameSpecifier::NamespaceAlias: {
- NamespaceAliasDecl *Alias =ReadDeclAs<NamespaceAliasDecl>(F, Record, Idx);
+ NamespaceAliasDecl *Alias = readDeclAs<NamespaceAliasDecl>();
NNS = NestedNameSpecifier::Create(Context, Prev, Alias);
break;
}
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate: {
- const Type *T = readType(F, Record, Idx).getTypePtrOrNull();
+ const Type *T = readType().getTypePtrOrNull();
if (!T)
return nullptr;
- bool Template = Record[Idx++];
+ bool Template = readBool();
NNS = NestedNameSpecifier::Create(Context, Prev, Template, T);
break;
}
break;
case NestedNameSpecifier::Super: {
- CXXRecordDecl *RD = ReadDeclAs<CXXRecordDecl>(F, Record, Idx);
+ CXXRecordDecl *RD = readDeclAs<CXXRecordDecl>();
NNS = NestedNameSpecifier::SuperSpecifier(Context, RD);
break;
}
}
NestedNameSpecifierLoc
-ASTReader::ReadNestedNameSpecifierLoc(ModuleFile &F, const RecordData &Record,
- unsigned &Idx) {
+ASTRecordReader::readNestedNameSpecifierLoc() {
ASTContext &Context = getContext();
- unsigned N = Record[Idx++];
+ unsigned N = readInt();
NestedNameSpecifierLocBuilder Builder;
for (unsigned I = 0; I != N; ++I) {
- NestedNameSpecifier::SpecifierKind Kind
- = (NestedNameSpecifier::SpecifierKind)Record[Idx++];
+ auto Kind = (NestedNameSpecifier::SpecifierKind) readInt();
switch (Kind) {
case NestedNameSpecifier::Identifier: {
- IdentifierInfo *II = GetIdentifierInfo(F, Record, Idx);
- SourceRange Range = ReadSourceRange(F, Record, Idx);
+ IdentifierInfo *II = readIdentifier();
+ SourceRange Range = readSourceRange();
Builder.Extend(Context, II, Range.getBegin(), Range.getEnd());
break;
}
case NestedNameSpecifier::Namespace: {
- NamespaceDecl *NS = ReadDeclAs<NamespaceDecl>(F, Record, Idx);
- SourceRange Range = ReadSourceRange(F, Record, Idx);
+ NamespaceDecl *NS = readDeclAs<NamespaceDecl>();
+ SourceRange Range = readSourceRange();
Builder.Extend(Context, NS, Range.getBegin(), Range.getEnd());
break;
}
case NestedNameSpecifier::NamespaceAlias: {
- NamespaceAliasDecl *Alias =ReadDeclAs<NamespaceAliasDecl>(F, Record, Idx);
- SourceRange Range = ReadSourceRange(F, Record, Idx);
+ NamespaceAliasDecl *Alias = readDeclAs<NamespaceAliasDecl>();
+ SourceRange Range = readSourceRange();
Builder.Extend(Context, Alias, Range.getBegin(), Range.getEnd());
break;
}
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate: {
- bool Template = Record[Idx++];
- TypeSourceInfo *T = GetTypeSourceInfo(F, Record, Idx);
+ bool Template = readBool();
+ TypeSourceInfo *T = readTypeSourceInfo();
if (!T)
return NestedNameSpecifierLoc();
- SourceLocation ColonColonLoc = ReadSourceLocation(F, Record, Idx);
+ SourceLocation ColonColonLoc = readSourceLocation();
// FIXME: 'template' keyword location not saved anywhere, so we fake it.
Builder.Extend(Context,
}
case NestedNameSpecifier::Global: {
- SourceLocation ColonColonLoc = ReadSourceLocation(F, Record, Idx);
+ SourceLocation ColonColonLoc = readSourceLocation();
Builder.MakeGlobal(Context, ColonColonLoc);
break;
}
case NestedNameSpecifier::Super: {
- CXXRecordDecl *RD = ReadDeclAs<CXXRecordDecl>(F, Record, Idx);
- SourceRange Range = ReadSourceRange(F, Record, Idx);
+ CXXRecordDecl *RD = readDeclAs<CXXRecordDecl>();
+ SourceRange Range = readSourceRange();
Builder.MakeSuper(Context, RD, Range.getBegin(), Range.getEnd());
break;
}
HasUnsignedPadding);
}
-APValue ASTReader::ReadAPValue(const RecordData &Record, unsigned &Idx) {
- unsigned Kind = Record[Idx++];
+static const llvm::fltSemantics &
+readAPFloatSemantics(ASTRecordReader &reader) {
+ return llvm::APFloatBase::EnumToSemantics(
+ static_cast<llvm::APFloatBase::Semantics>(reader.readInt()));
+}
+
+APValue ASTRecordReader::readAPValue() {
+ unsigned Kind = readInt();
switch (Kind) {
case APValue::None:
return APValue();
case APValue::Indeterminate:
return APValue::IndeterminateValue();
case APValue::Int:
- return APValue(ReadAPSInt(Record, Idx));
+ return APValue(readAPSInt());
case APValue::Float: {
- const llvm::fltSemantics &FloatSema = llvm::APFloatBase::EnumToSemantics(
- static_cast<llvm::APFloatBase::Semantics>(Record[Idx++]));
- return APValue(ReadAPFloat(Record, FloatSema, Idx));
+ const llvm::fltSemantics &FloatSema = readAPFloatSemantics(*this);
+ return APValue(readAPFloat(FloatSema));
}
case APValue::FixedPoint: {
FixedPointSemantics FPSema = ReadFixedPointSemantics(Record, Idx);
- return APValue(APFixedPoint(ReadAPInt(Record, Idx), FPSema));
+ return APValue(APFixedPoint(readAPInt(), FPSema));
}
case APValue::ComplexInt: {
- llvm::APSInt First = ReadAPSInt(Record, Idx);
- return APValue(std::move(First), ReadAPSInt(Record, Idx));
+ llvm::APSInt First = readAPSInt();
+ return APValue(std::move(First), readAPSInt());
}
case APValue::ComplexFloat: {
- const llvm::fltSemantics &FloatSema1 = llvm::APFloatBase::EnumToSemantics(
- static_cast<llvm::APFloatBase::Semantics>(Record[Idx++]));
- llvm::APFloat First = ReadAPFloat(Record, FloatSema1, Idx);
- const llvm::fltSemantics &FloatSema2 = llvm::APFloatBase::EnumToSemantics(
- static_cast<llvm::APFloatBase::Semantics>(Record[Idx++]));
- return APValue(std::move(First), ReadAPFloat(Record, FloatSema2, Idx));
+ const llvm::fltSemantics &FloatSema1 = readAPFloatSemantics(*this);
+ llvm::APFloat First = readAPFloat(FloatSema1);
+ const llvm::fltSemantics &FloatSema2 = readAPFloatSemantics(*this);
+ return APValue(std::move(First), readAPFloat(FloatSema2));
}
case APValue::LValue:
case APValue::Vector:
}
/// Read an integral value
-llvm::APInt ASTReader::ReadAPInt(const RecordData &Record, unsigned &Idx) {
- unsigned BitWidth = Record[Idx++];
+llvm::APInt ASTRecordReader::readAPInt() {
+ unsigned BitWidth = readInt();
unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
- llvm::APInt Result(BitWidth, NumWords, &Record[Idx]);
- Idx += NumWords;
+ llvm::APInt Result(BitWidth, NumWords, readIntArray(NumWords).data());
return Result;
}
/// Read a signed integral value
-llvm::APSInt ASTReader::ReadAPSInt(const RecordData &Record, unsigned &Idx) {
- bool isUnsigned = Record[Idx++];
- return llvm::APSInt(ReadAPInt(Record, Idx), isUnsigned);
+llvm::APSInt ASTRecordReader::readAPSInt() {
+ bool isUnsigned = readBool();
+ return llvm::APSInt(readAPInt(), isUnsigned);
}
/// Read a floating-point value
-llvm::APFloat ASTReader::ReadAPFloat(const RecordData &Record,
- const llvm::fltSemantics &Sem,
- unsigned &Idx) {
- return llvm::APFloat(Sem, ReadAPInt(Record, Idx));
+llvm::APFloat ASTRecordReader::readAPFloat(const llvm::fltSemantics &Sem) {
+ return llvm::APFloat(Sem, readAPInt());
}
// Read a string
C->setLParenLoc(Record.readSourceLocation());
C->setColonLoc(Record.readSourceLocation());
NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc();
- DeclarationNameInfo DNI;
- Record.readDeclarationNameInfo(DNI);
+ DeclarationNameInfo DNI = Record.readDeclarationNameInfo();
C->setQualifierLoc(NNSL);
C->setNameInfo(DNI);
C->setLParenLoc(Record.readSourceLocation());
C->setColonLoc(Record.readSourceLocation());
NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc();
- DeclarationNameInfo DNI;
- Record.readDeclarationNameInfo(DNI);
+ DeclarationNameInfo DNI = Record.readDeclarationNameInfo();
C->setQualifierLoc(NNSL);
C->setNameInfo(DNI);
C->setLParenLoc(Record.readSourceLocation());
C->setColonLoc(Record.readSourceLocation());
NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc();
- DeclarationNameInfo DNI;
- Record.readDeclarationNameInfo(DNI);
+ DeclarationNameInfo DNI = Record.readDeclarationNameInfo();
C->setQualifierLoc(NNSL);
C->setNameInfo(DNI);
C->setMapTypeModifierLoc(I, Record.readSourceLocation());
}
C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
- DeclarationNameInfo DNI;
- Record.readDeclarationNameInfo(DNI);
- C->setMapperIdInfo(DNI);
+ C->setMapperIdInfo(Record.readDeclarationNameInfo());
C->setMapType(
static_cast<OpenMPMapClauseKind>(Record.readInt()));
C->setMapLoc(Record.readSourceLocation());
void OMPClauseReader::VisitOMPToClause(OMPToClause *C) {
C->setLParenLoc(Record.readSourceLocation());
C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
- DeclarationNameInfo DNI;
- Record.readDeclarationNameInfo(DNI);
- C->setMapperIdInfo(DNI);
+ C->setMapperIdInfo(Record.readDeclarationNameInfo());
auto NumVars = C->varlist_size();
auto UniqueDecls = C->getUniqueDeclarationsNum();
auto TotalLists = C->getTotalComponentListNum();
void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) {
C->setLParenLoc(Record.readSourceLocation());
C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
- DeclarationNameInfo DNI;
- Record.readDeclarationNameInfo(DNI);
- C->setMapperIdInfo(DNI);
+ C->setMapperIdInfo(Record.readDeclarationNameInfo());
auto NumVars = C->varlist_size();
auto UniqueDecls = C->getUniqueDeclarationsNum();
auto TotalLists = C->getTotalComponentListNum();
//
//===----------------------------------------------------------------------===//
//
-// This file implements the ASTReader::ReadDeclRecord method, which is the
+// This file implements the ASTReader::readDeclRecord method, which is the
// entrypoint for loading a decl.
//
//===----------------------------------------------------------------------===//
return Local ? Record.getGlobalBitOffset(Local) : 0;
}
- SourceLocation ReadSourceLocation() {
+ SourceLocation readSourceLocation() {
return Record.readSourceLocation();
}
- SourceRange ReadSourceRange() {
+ SourceRange readSourceRange() {
return Record.readSourceRange();
}
- TypeSourceInfo *GetTypeSourceInfo() {
- return Record.getTypeSourceInfo();
+ TypeSourceInfo *readTypeSourceInfo() {
+ return Record.readTypeSourceInfo();
}
- serialization::DeclID ReadDeclID() {
+ serialization::DeclID readDeclID() {
return Record.readDeclID();
}
- std::string ReadString() {
+ std::string readString() {
return Record.readString();
}
- void ReadDeclIDList(SmallVectorImpl<DeclID> &IDs) {
+ void readDeclIDList(SmallVectorImpl<DeclID> &IDs) {
for (unsigned I = 0, Size = Record.readInt(); I != Size; ++I)
- IDs.push_back(ReadDeclID());
+ IDs.push_back(readDeclID());
}
- Decl *ReadDecl() {
+ Decl *readDecl() {
return Record.readDecl();
}
template<typename T>
- T *ReadDeclAs() {
+ T *readDeclAs() {
return Record.readDeclAs<T>();
}
- void ReadQualifierInfo(QualifierInfo &Info) {
- Record.readQualifierInfo(Info);
- }
-
- void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name) {
- Record.readDeclarationNameLoc(DNLoc, Name);
- }
-
serialization::SubmoduleID readSubmoduleID() {
if (Record.getIdx() == Record.size())
return 0;
// example, a function parameter can be used in decltype() in trailing
// return type of the function). Use the translation unit DeclContext as a
// placeholder.
- GlobalDeclID SemaDCIDForTemplateParmDecl = ReadDeclID();
- GlobalDeclID LexicalDCIDForTemplateParmDecl = ReadDeclID();
+ GlobalDeclID SemaDCIDForTemplateParmDecl = readDeclID();
+ GlobalDeclID LexicalDCIDForTemplateParmDecl = readDeclID();
if (!LexicalDCIDForTemplateParmDecl)
LexicalDCIDForTemplateParmDecl = SemaDCIDForTemplateParmDecl;
Reader.addPendingDeclContextInfo(D,
LexicalDCIDForTemplateParmDecl);
D->setDeclContext(Reader.getContext().getTranslationUnitDecl());
} else {
- auto *SemaDC = ReadDeclAs<DeclContext>();
- auto *LexicalDC = ReadDeclAs<DeclContext>();
+ auto *SemaDC = readDeclAs<DeclContext>();
+ auto *LexicalDC = readDeclAs<DeclContext>();
if (!LexicalDC)
LexicalDC = SemaDC;
DeclContext *MergedSemaDC = Reader.MergedDeclContexts.lookup(SemaDC);
void ASTDeclReader::VisitPragmaCommentDecl(PragmaCommentDecl *D) {
VisitDecl(D);
- D->setLocation(ReadSourceLocation());
+ D->setLocation(readSourceLocation());
D->CommentKind = (PragmaMSCommentKind)Record.readInt();
- std::string Arg = ReadString();
+ std::string Arg = readString();
memcpy(D->getTrailingObjects<char>(), Arg.data(), Arg.size());
D->getTrailingObjects<char>()[Arg.size()] = '\0';
}
void ASTDeclReader::VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D) {
VisitDecl(D);
- D->setLocation(ReadSourceLocation());
- std::string Name = ReadString();
+ D->setLocation(readSourceLocation());
+ std::string Name = readString();
memcpy(D->getTrailingObjects<char>(), Name.data(), Name.size());
D->getTrailingObjects<char>()[Name.size()] = '\0';
D->ValueStart = Name.size() + 1;
- std::string Value = ReadString();
+ std::string Value = readString();
memcpy(D->getTrailingObjects<char>() + D->ValueStart, Value.data(),
Value.size());
D->getTrailingObjects<char>()[D->ValueStart + Value.size()] = '\0';
void ASTDeclReader::VisitTypeDecl(TypeDecl *TD) {
VisitNamedDecl(TD);
- TD->setLocStart(ReadSourceLocation());
+ TD->setLocStart(readSourceLocation());
// Delay type reading until after we have fully initialized the decl.
DeferredTypeID = Record.getGlobalTypeID(Record.readInt());
}
ASTDeclReader::VisitTypedefNameDecl(TypedefNameDecl *TD) {
RedeclarableResult Redecl = VisitRedeclarable(TD);
VisitTypeDecl(TD);
- TypeSourceInfo *TInfo = GetTypeSourceInfo();
+ TypeSourceInfo *TInfo = readTypeSourceInfo();
if (Record.readInt()) { // isModed
QualType modedT = Record.readType();
TD->setModedTypeSourceInfo(TInfo, modedT);
// linkage, if it exists. We cannot rely on our type to pull in this decl,
// because it might have been merged with a type from another module and
// thus might not refer to our version of the declaration.
- ReadDecl();
+ readDecl();
return Redecl;
}
void ASTDeclReader::VisitTypeAliasDecl(TypeAliasDecl *TD) {
RedeclarableResult Redecl = VisitTypedefNameDecl(TD);
- if (auto *Template = ReadDeclAs<TypeAliasTemplateDecl>())
+ if (auto *Template = readDeclAs<TypeAliasTemplateDecl>())
// Merged when we merge the template.
TD->setDescribedAliasTemplate(Template);
else
TD->setEmbeddedInDeclarator(Record.readInt());
TD->setFreeStanding(Record.readInt());
TD->setCompleteDefinitionRequired(Record.readInt());
- TD->setBraceRange(ReadSourceRange());
+ TD->setBraceRange(readSourceRange());
switch (Record.readInt()) {
case 0:
break;
case 1: { // ExtInfo
auto *Info = new (Reader.getContext()) TagDecl::ExtInfo();
- ReadQualifierInfo(*Info);
+ Record.readQualifierInfo(*Info);
TD->TypedefNameDeclOrQualifier = Info;
break;
}
case 2: // TypedefNameForAnonDecl
- NamedDeclForTagDecl = ReadDeclID();
- TypedefNameForLinkage = Record.getIdentifierInfo();
+ NamedDeclForTagDecl = readDeclID();
+ TypedefNameForLinkage = Record.readIdentifier();
break;
default:
llvm_unreachable("unexpected tag info kind");
void ASTDeclReader::VisitEnumDecl(EnumDecl *ED) {
VisitTagDecl(ED);
- if (TypeSourceInfo *TI = GetTypeSourceInfo())
+ if (TypeSourceInfo *TI = readTypeSourceInfo())
ED->setIntegerTypeSourceInfo(TI);
else
ED->setIntegerType(Record.readType());
}
}
- if (auto *InstED = ReadDeclAs<EnumDecl>()) {
+ if (auto *InstED = readDeclAs<EnumDecl>()) {
auto TSK = (TemplateSpecializationKind)Record.readInt();
- SourceLocation POI = ReadSourceLocation();
+ SourceLocation POI = readSourceLocation();
ED->setInstantiationOfMemberEnum(Reader.getContext(), InstED, TSK);
ED->getMemberSpecializationInfo()->setPointOfInstantiation(POI);
}
void ASTDeclReader::VisitDeclaratorDecl(DeclaratorDecl *DD) {
VisitValueDecl(DD);
- DD->setInnerLocStart(ReadSourceLocation());
+ DD->setInnerLocStart(readSourceLocation());
if (Record.readInt()) { // hasExtInfo
auto *Info = new (Reader.getContext()) DeclaratorDecl::ExtInfo();
- ReadQualifierInfo(*Info);
+ Record.readQualifierInfo(*Info);
DD->DeclInfo = Info;
}
QualType TSIType = Record.readType();
}
DeferredTypeID = 0;
- ReadDeclarationNameLoc(FD->DNLoc, FD->getDeclName());
+ FD->DNLoc = Record.readDeclarationNameLoc(FD->getDeclName());
FD->IdentifierNamespace = Record.readInt();
// FunctionDecl's body is handled last at ASTDeclReader::Visit,
FD->setLateTemplateParsed(Record.readInt());
FD->setCachedLinkage(static_cast<Linkage>(Record.readInt()));
- FD->EndRangeLoc = ReadSourceLocation();
+ FD->EndRangeLoc = readSourceLocation();
FD->ODRHash = Record.readInt();
FD->setHasODRHash(true);
break;
case FunctionDecl::TK_FunctionTemplate:
// Merged when we merge the template.
- FD->setDescribedFunctionTemplate(ReadDeclAs<FunctionTemplateDecl>());
+ FD->setDescribedFunctionTemplate(readDeclAs<FunctionTemplateDecl>());
break;
case FunctionDecl::TK_MemberSpecialization: {
- auto *InstFD = ReadDeclAs<FunctionDecl>();
+ auto *InstFD = readDeclAs<FunctionDecl>();
auto TSK = (TemplateSpecializationKind)Record.readInt();
- SourceLocation POI = ReadSourceLocation();
+ SourceLocation POI = readSourceLocation();
FD->setInstantiationOfMemberFunction(Reader.getContext(), InstFD, TSK);
FD->getMemberSpecializationInfo()->setPointOfInstantiation(POI);
mergeRedeclarable(FD, Redecl);
break;
}
case FunctionDecl::TK_FunctionTemplateSpecialization: {
- auto *Template = ReadDeclAs<FunctionTemplateDecl>();
+ auto *Template = readDeclAs<FunctionTemplateDecl>();
auto TSK = (TemplateSpecializationKind)Record.readInt();
// Template arguments.
for (unsigned i = 0; i != NumTemplateArgLocs; ++i)
TemplArgLocs.push_back(Record.readTemplateArgumentLoc());
- LAngleLoc = ReadSourceLocation();
- RAngleLoc = ReadSourceLocation();
+ LAngleLoc = readSourceLocation();
+ RAngleLoc = readSourceLocation();
}
- SourceLocation POI = ReadSourceLocation();
+ SourceLocation POI = readSourceLocation();
ASTContext &C = Reader.getContext();
TemplateArgumentList *TemplArgList
MemberSpecializationInfo *MSInfo = nullptr;
if (Record.readInt()) {
- auto *FD = ReadDeclAs<FunctionDecl>();
+ auto *FD = readDeclAs<FunctionDecl>();
auto TSK = (TemplateSpecializationKind)Record.readInt();
- SourceLocation POI = ReadSourceLocation();
+ SourceLocation POI = readSourceLocation();
MSInfo = new (C) MemberSpecializationInfo(FD, TSK);
MSInfo->setPointOfInstantiation(POI);
if (FD->isCanonicalDecl()) { // if canonical add to template's set.
// The template that contains the specializations set. It's not safe to
// use getCanonicalDecl on Template since it may still be initializing.
- auto *CanonTemplate = ReadDeclAs<FunctionTemplateDecl>();
+ auto *CanonTemplate = readDeclAs<FunctionTemplateDecl>();
// Get the InsertPos by FindNodeOrInsertPos() instead of calling
// InsertNode(FTInfo) directly to avoid the getASTContext() call in
// FunctionTemplateSpecializationInfo's Profile().
UnresolvedSet<8> TemplDecls;
unsigned NumTemplates = Record.readInt();
while (NumTemplates--)
- TemplDecls.addDecl(ReadDeclAs<NamedDecl>());
+ TemplDecls.addDecl(readDeclAs<NamedDecl>());
// Templates args.
TemplateArgumentListInfo TemplArgs;
unsigned NumArgs = Record.readInt();
while (NumArgs--)
TemplArgs.addArgument(Record.readTemplateArgumentLoc());
- TemplArgs.setLAngleLoc(ReadSourceLocation());
- TemplArgs.setRAngleLoc(ReadSourceLocation());
+ TemplArgs.setLAngleLoc(readSourceLocation());
+ TemplArgs.setRAngleLoc(readSourceLocation());
FD->setDependentTemplateSpecialization(Reader.getContext(),
TemplDecls, TemplArgs);
SmallVector<ParmVarDecl *, 16> Params;
Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I)
- Params.push_back(ReadDeclAs<ParmVarDecl>());
+ Params.push_back(readDeclAs<ParmVarDecl>());
FD->setParams(Reader.getContext(), Params);
}
Reader.PendingBodies[MD] = GetCurrentCursorOffset();
HasPendingBody = true;
}
- MD->setSelfDecl(ReadDeclAs<ImplicitParamDecl>());
- MD->setCmdDecl(ReadDeclAs<ImplicitParamDecl>());
+ MD->setSelfDecl(readDeclAs<ImplicitParamDecl>());
+ MD->setCmdDecl(readDeclAs<ImplicitParamDecl>());
MD->setInstanceMethod(Record.readInt());
MD->setVariadic(Record.readInt());
MD->setPropertyAccessor(Record.readInt());
MD->setHasRedeclaration(Record.readInt());
if (MD->hasRedeclaration())
Reader.getContext().setObjCMethodRedeclaration(MD,
- ReadDeclAs<ObjCMethodDecl>());
+ readDeclAs<ObjCMethodDecl>());
MD->setDeclImplementation((ObjCMethodDecl::ImplementationControl)Record.readInt());
MD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record.readInt());
MD->setRelatedResultType(Record.readInt());
MD->setReturnType(Record.readType());
- MD->setReturnTypeSourceInfo(GetTypeSourceInfo());
- MD->DeclEndLoc = ReadSourceLocation();
+ MD->setReturnTypeSourceInfo(readTypeSourceInfo());
+ MD->DeclEndLoc = readSourceLocation();
unsigned NumParams = Record.readInt();
SmallVector<ParmVarDecl *, 16> Params;
Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I)
- Params.push_back(ReadDeclAs<ParmVarDecl>());
+ Params.push_back(readDeclAs<ParmVarDecl>());
MD->setSelLocsKind((SelectorLocationsKind)Record.readInt());
unsigned NumStoredSelLocs = Record.readInt();
SmallVector<SourceLocation, 16> SelLocs;
SelLocs.reserve(NumStoredSelLocs);
for (unsigned i = 0; i != NumStoredSelLocs; ++i)
- SelLocs.push_back(ReadSourceLocation());
+ SelLocs.push_back(readSourceLocation());
MD->setParamsAndSelLocs(Reader.getContext(), Params, SelLocs);
}
D->Variance = Record.readInt();
D->Index = Record.readInt();
- D->VarianceLoc = ReadSourceLocation();
- D->ColonLoc = ReadSourceLocation();
+ D->VarianceLoc = readSourceLocation();
+ D->ColonLoc = readSourceLocation();
}
void ASTDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) {
VisitNamedDecl(CD);
- CD->setAtStartLoc(ReadSourceLocation());
- CD->setAtEndRange(ReadSourceRange());
+ CD->setAtStartLoc(readSourceLocation());
+ CD->setAtEndRange(readSourceRange());
}
ObjCTypeParamList *ASTDeclReader::ReadObjCTypeParamList() {
SmallVector<ObjCTypeParamDecl *, 4> typeParams;
typeParams.reserve(numParams);
for (unsigned i = 0; i != numParams; ++i) {
- auto *typeParam = ReadDeclAs<ObjCTypeParamDecl>();
+ auto *typeParam = readDeclAs<ObjCTypeParamDecl>();
if (!typeParam)
return nullptr;
typeParams.push_back(typeParam);
}
- SourceLocation lAngleLoc = ReadSourceLocation();
- SourceLocation rAngleLoc = ReadSourceLocation();
+ SourceLocation lAngleLoc = readSourceLocation();
+ SourceLocation rAngleLoc = readSourceLocation();
return ObjCTypeParamList::create(Reader.getContext(), lAngleLoc,
typeParams, rAngleLoc);
void ASTDeclReader::ReadObjCDefinitionData(
struct ObjCInterfaceDecl::DefinitionData &Data) {
// Read the superclass.
- Data.SuperClassTInfo = GetTypeSourceInfo();
+ Data.SuperClassTInfo = readTypeSourceInfo();
- Data.EndLoc = ReadSourceLocation();
+ Data.EndLoc = readSourceLocation();
Data.HasDesignatedInitializers = Record.readInt();
// Read the directly referenced protocols and their SourceLocations.
SmallVector<ObjCProtocolDecl *, 16> Protocols;
Protocols.reserve(NumProtocols);
for (unsigned I = 0; I != NumProtocols; ++I)
- Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>());
+ Protocols.push_back(readDeclAs<ObjCProtocolDecl>());
SmallVector<SourceLocation, 16> ProtoLocs;
ProtoLocs.reserve(NumProtocols);
for (unsigned I = 0; I != NumProtocols; ++I)
- ProtoLocs.push_back(ReadSourceLocation());
+ ProtoLocs.push_back(readSourceLocation());
Data.ReferencedProtocols.set(Protocols.data(), NumProtocols, ProtoLocs.data(),
Reader.getContext());
Protocols.clear();
Protocols.reserve(NumProtocols);
for (unsigned I = 0; I != NumProtocols; ++I)
- Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>());
+ Protocols.push_back(readDeclAs<ObjCProtocolDecl>());
Data.AllReferencedProtocols.set(Protocols.data(), NumProtocols,
Reader.getContext());
}
SmallVector<ObjCProtocolDecl *, 16> ProtoRefs;
ProtoRefs.reserve(NumProtoRefs);
for (unsigned I = 0; I != NumProtoRefs; ++I)
- ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>());
+ ProtoRefs.push_back(readDeclAs<ObjCProtocolDecl>());
SmallVector<SourceLocation, 16> ProtoLocs;
ProtoLocs.reserve(NumProtoRefs);
for (unsigned I = 0; I != NumProtoRefs; ++I)
- ProtoLocs.push_back(ReadSourceLocation());
+ ProtoLocs.push_back(readSourceLocation());
Data.ReferencedProtocols.set(ProtoRefs.data(), NumProtoRefs,
ProtoLocs.data(), Reader.getContext());
}
void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
VisitObjCContainerDecl(CD);
- CD->setCategoryNameLoc(ReadSourceLocation());
- CD->setIvarLBraceLoc(ReadSourceLocation());
- CD->setIvarRBraceLoc(ReadSourceLocation());
+ CD->setCategoryNameLoc(readSourceLocation());
+ CD->setIvarLBraceLoc(readSourceLocation());
+ CD->setIvarRBraceLoc(readSourceLocation());
// Note that this category has been deserialized. We do this before
// deserializing the interface declaration, so that it will consider this
/// category.
Reader.CategoriesDeserialized.insert(CD);
- CD->ClassInterface = ReadDeclAs<ObjCInterfaceDecl>();
+ CD->ClassInterface = readDeclAs<ObjCInterfaceDecl>();
CD->TypeParamList = ReadObjCTypeParamList();
unsigned NumProtoRefs = Record.readInt();
SmallVector<ObjCProtocolDecl *, 16> ProtoRefs;
ProtoRefs.reserve(NumProtoRefs);
for (unsigned I = 0; I != NumProtoRefs; ++I)
- ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>());
+ ProtoRefs.push_back(readDeclAs<ObjCProtocolDecl>());
SmallVector<SourceLocation, 16> ProtoLocs;
ProtoLocs.reserve(NumProtoRefs);
for (unsigned I = 0; I != NumProtoRefs; ++I)
- ProtoLocs.push_back(ReadSourceLocation());
+ ProtoLocs.push_back(readSourceLocation());
CD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
Reader.getContext());
void ASTDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) {
VisitNamedDecl(CAD);
- CAD->setClassInterface(ReadDeclAs<ObjCInterfaceDecl>());
+ CAD->setClassInterface(readDeclAs<ObjCInterfaceDecl>());
}
void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
VisitNamedDecl(D);
- D->setAtLoc(ReadSourceLocation());
- D->setLParenLoc(ReadSourceLocation());
+ D->setAtLoc(readSourceLocation());
+ D->setLParenLoc(readSourceLocation());
QualType T = Record.readType();
- TypeSourceInfo *TSI = GetTypeSourceInfo();
+ TypeSourceInfo *TSI = readTypeSourceInfo();
D->setType(T, TSI);
D->setPropertyAttributes(
(ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
D->setPropertyImplementation(
(ObjCPropertyDecl::PropertyControl)Record.readInt());
DeclarationName GetterName = Record.readDeclarationName();
- SourceLocation GetterLoc = ReadSourceLocation();
+ SourceLocation GetterLoc = readSourceLocation();
D->setGetterName(GetterName.getObjCSelector(), GetterLoc);
DeclarationName SetterName = Record.readDeclarationName();
- SourceLocation SetterLoc = ReadSourceLocation();
+ SourceLocation SetterLoc = readSourceLocation();
D->setSetterName(SetterName.getObjCSelector(), SetterLoc);
- D->setGetterMethodDecl(ReadDeclAs<ObjCMethodDecl>());
- D->setSetterMethodDecl(ReadDeclAs<ObjCMethodDecl>());
- D->setPropertyIvarDecl(ReadDeclAs<ObjCIvarDecl>());
+ D->setGetterMethodDecl(readDeclAs<ObjCMethodDecl>());
+ D->setSetterMethodDecl(readDeclAs<ObjCMethodDecl>());
+ D->setPropertyIvarDecl(readDeclAs<ObjCIvarDecl>());
}
void ASTDeclReader::VisitObjCImplDecl(ObjCImplDecl *D) {
VisitObjCContainerDecl(D);
- D->setClassInterface(ReadDeclAs<ObjCInterfaceDecl>());
+ D->setClassInterface(readDeclAs<ObjCInterfaceDecl>());
}
void ASTDeclReader::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
VisitObjCImplDecl(D);
- D->CategoryNameLoc = ReadSourceLocation();
+ D->CategoryNameLoc = readSourceLocation();
}
void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
VisitObjCImplDecl(D);
- D->setSuperClass(ReadDeclAs<ObjCInterfaceDecl>());
- D->SuperLoc = ReadSourceLocation();
- D->setIvarLBraceLoc(ReadSourceLocation());
- D->setIvarRBraceLoc(ReadSourceLocation());
+ D->setSuperClass(readDeclAs<ObjCInterfaceDecl>());
+ D->SuperLoc = readSourceLocation();
+ D->setIvarLBraceLoc(readSourceLocation());
+ D->setIvarRBraceLoc(readSourceLocation());
D->setHasNonZeroConstructors(Record.readInt());
D->setHasDestructors(Record.readInt());
D->NumIvarInitializers = Record.readInt();
void ASTDeclReader::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
VisitDecl(D);
- D->setAtLoc(ReadSourceLocation());
- D->setPropertyDecl(ReadDeclAs<ObjCPropertyDecl>());
- D->PropertyIvarDecl = ReadDeclAs<ObjCIvarDecl>();
- D->IvarLoc = ReadSourceLocation();
- D->setGetterMethodDecl(ReadDeclAs<ObjCMethodDecl>());
- D->setSetterMethodDecl(ReadDeclAs<ObjCMethodDecl>());
+ D->setAtLoc(readSourceLocation());
+ D->setPropertyDecl(readDeclAs<ObjCPropertyDecl>());
+ D->PropertyIvarDecl = readDeclAs<ObjCIvarDecl>();
+ D->IvarLoc = readSourceLocation();
+ D->setGetterMethodDecl(readDeclAs<ObjCMethodDecl>());
+ D->setSetterMethodDecl(readDeclAs<ObjCMethodDecl>());
D->setGetterCXXConstructor(Record.readExpr());
D->setSetterCXXAssignment(Record.readExpr());
}
FD->setBitWidth(BW);
if (!FD->getDeclName()) {
- if (auto *Tmpl = ReadDeclAs<FieldDecl>())
+ if (auto *Tmpl = readDeclAs<FieldDecl>())
Reader.getContext().setInstantiatedFromUnnamedFieldDecl(FD, Tmpl);
}
mergeMergeable(FD);
void ASTDeclReader::VisitMSPropertyDecl(MSPropertyDecl *PD) {
VisitDeclaratorDecl(PD);
- PD->GetterId = Record.getIdentifierInfo();
- PD->SetterId = Record.getIdentifierInfo();
+ PD->GetterId = Record.readIdentifier();
+ PD->SetterId = Record.readIdentifier();
}
void ASTDeclReader::VisitIndirectFieldDecl(IndirectFieldDecl *FD) {
FD->Chaining = new (Reader.getContext())NamedDecl*[FD->ChainingSize];
for (unsigned I = 0; I != FD->ChainingSize; ++I)
- FD->Chaining[I] = ReadDeclAs<NamedDecl>();
+ FD->Chaining[I] = readDeclAs<NamedDecl>();
mergeMergeable(FD);
}
break;
case VarTemplate:
// Merged when we merge the template.
- VD->setDescribedVarTemplate(ReadDeclAs<VarTemplateDecl>());
+ VD->setDescribedVarTemplate(readDeclAs<VarTemplateDecl>());
break;
case StaticDataMemberSpecialization: { // HasMemberSpecializationInfo.
- auto *Tmpl = ReadDeclAs<VarDecl>();
+ auto *Tmpl = readDeclAs<VarDecl>();
auto TSK = (TemplateSpecializationKind)Record.readInt();
- SourceLocation POI = ReadSourceLocation();
+ SourceLocation POI = readSourceLocation();
Reader.getContext().setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
mergeRedeclarable(VD, Redecl);
break;
VisitVarDecl(DD);
auto **BDs = DD->getTrailingObjects<BindingDecl *>();
for (unsigned I = 0; I != DD->NumBindings; ++I) {
- BDs[I] = ReadDeclAs<BindingDecl>();
+ BDs[I] = readDeclAs<BindingDecl>();
BDs[I]->setDecomposedDecl(DD);
}
}
void ASTDeclReader::VisitFileScopeAsmDecl(FileScopeAsmDecl *AD) {
VisitDecl(AD);
AD->setAsmString(cast<StringLiteral>(Record.readExpr()));
- AD->setRParenLoc(ReadSourceLocation());
+ AD->setRParenLoc(readSourceLocation());
}
void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) {
VisitDecl(BD);
BD->setBody(cast_or_null<CompoundStmt>(Record.readStmt()));
- BD->setSignatureAsWritten(GetTypeSourceInfo());
+ BD->setSignatureAsWritten(readTypeSourceInfo());
unsigned NumParams = Record.readInt();
SmallVector<ParmVarDecl *, 16> Params;
Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I)
- Params.push_back(ReadDeclAs<ParmVarDecl>());
+ Params.push_back(readDeclAs<ParmVarDecl>());
BD->setParams(Params);
BD->setIsVariadic(Record.readInt());
SmallVector<BlockDecl::Capture, 16> captures;
captures.reserve(numCaptures);
for (unsigned i = 0; i != numCaptures; ++i) {
- auto *decl = ReadDeclAs<VarDecl>();
+ auto *decl = readDeclAs<VarDecl>();
unsigned flags = Record.readInt();
bool byRef = (flags & 1);
bool nested = (flags & 2);
// Body is set by VisitCapturedStmt.
for (unsigned I = 0; I < CD->NumParams; ++I) {
if (I != ContextParamPos)
- CD->setParam(I, ReadDeclAs<ImplicitParamDecl>());
+ CD->setParam(I, readDeclAs<ImplicitParamDecl>());
else
- CD->setContextParam(I, ReadDeclAs<ImplicitParamDecl>());
+ CD->setContextParam(I, readDeclAs<ImplicitParamDecl>());
}
}
void ASTDeclReader::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
VisitDecl(D);
D->setLanguage((LinkageSpecDecl::LanguageIDs)Record.readInt());
- D->setExternLoc(ReadSourceLocation());
- D->setRBraceLoc(ReadSourceLocation());
+ D->setExternLoc(readSourceLocation());
+ D->setRBraceLoc(readSourceLocation());
}
void ASTDeclReader::VisitExportDecl(ExportDecl *D) {
VisitDecl(D);
- D->RBraceLoc = ReadSourceLocation();
+ D->RBraceLoc = readSourceLocation();
}
void ASTDeclReader::VisitLabelDecl(LabelDecl *D) {
VisitNamedDecl(D);
- D->setLocStart(ReadSourceLocation());
+ D->setLocStart(readSourceLocation());
}
void ASTDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
RedeclarableResult Redecl = VisitRedeclarable(D);
VisitNamedDecl(D);
D->setInline(Record.readInt());
- D->LocStart = ReadSourceLocation();
- D->RBraceLoc = ReadSourceLocation();
+ D->LocStart = readSourceLocation();
+ D->RBraceLoc = readSourceLocation();
// Defer loading the anonymous namespace until we've finished merging
// this namespace; loading it might load a later declaration of the
// get merged before newer ones try to merge.
GlobalDeclID AnonNamespace = 0;
if (Redecl.getFirstID() == ThisDeclID) {
- AnonNamespace = ReadDeclID();
+ AnonNamespace = readDeclID();
} else {
// Link this namespace back to the first declaration, which has already
// been deserialized.
void ASTDeclReader::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
RedeclarableResult Redecl = VisitRedeclarable(D);
VisitNamedDecl(D);
- D->NamespaceLoc = ReadSourceLocation();
- D->IdentLoc = ReadSourceLocation();
+ D->NamespaceLoc = readSourceLocation();
+ D->IdentLoc = readSourceLocation();
D->QualifierLoc = Record.readNestedNameSpecifierLoc();
- D->Namespace = ReadDeclAs<NamedDecl>();
+ D->Namespace = readDeclAs<NamedDecl>();
mergeRedeclarable(D, Redecl);
}
void ASTDeclReader::VisitUsingDecl(UsingDecl *D) {
VisitNamedDecl(D);
- D->setUsingLoc(ReadSourceLocation());
+ D->setUsingLoc(readSourceLocation());
D->QualifierLoc = Record.readNestedNameSpecifierLoc();
- ReadDeclarationNameLoc(D->DNLoc, D->getDeclName());
- D->FirstUsingShadow.setPointer(ReadDeclAs<UsingShadowDecl>());
+ D->DNLoc = Record.readDeclarationNameLoc(D->getDeclName());
+ D->FirstUsingShadow.setPointer(readDeclAs<UsingShadowDecl>());
D->setTypename(Record.readInt());
- if (auto *Pattern = ReadDeclAs<NamedDecl>())
+ if (auto *Pattern = readDeclAs<NamedDecl>())
Reader.getContext().setInstantiatedFromUsingDecl(D, Pattern);
mergeMergeable(D);
}
void ASTDeclReader::VisitUsingPackDecl(UsingPackDecl *D) {
VisitNamedDecl(D);
- D->InstantiatedFrom = ReadDeclAs<NamedDecl>();
+ D->InstantiatedFrom = readDeclAs<NamedDecl>();
auto **Expansions = D->getTrailingObjects<NamedDecl *>();
for (unsigned I = 0; I != D->NumExpansions; ++I)
- Expansions[I] = ReadDeclAs<NamedDecl>();
+ Expansions[I] = readDeclAs<NamedDecl>();
mergeMergeable(D);
}
void ASTDeclReader::VisitUsingShadowDecl(UsingShadowDecl *D) {
RedeclarableResult Redecl = VisitRedeclarable(D);
VisitNamedDecl(D);
- D->Underlying = ReadDeclAs<NamedDecl>();
+ D->Underlying = readDeclAs<NamedDecl>();
D->IdentifierNamespace = Record.readInt();
- D->UsingOrNextShadow = ReadDeclAs<NamedDecl>();
- auto *Pattern = ReadDeclAs<UsingShadowDecl>();
+ D->UsingOrNextShadow = readDeclAs<NamedDecl>();
+ auto *Pattern = readDeclAs<UsingShadowDecl>();
if (Pattern)
Reader.getContext().setInstantiatedFromUsingShadowDecl(D, Pattern);
mergeRedeclarable(D, Redecl);
void ASTDeclReader::VisitConstructorUsingShadowDecl(
ConstructorUsingShadowDecl *D) {
VisitUsingShadowDecl(D);
- D->NominatedBaseClassShadowDecl = ReadDeclAs<ConstructorUsingShadowDecl>();
- D->ConstructedBaseClassShadowDecl = ReadDeclAs<ConstructorUsingShadowDecl>();
+ D->NominatedBaseClassShadowDecl = readDeclAs<ConstructorUsingShadowDecl>();
+ D->ConstructedBaseClassShadowDecl = readDeclAs<ConstructorUsingShadowDecl>();
D->IsVirtual = Record.readInt();
}
void ASTDeclReader::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
VisitNamedDecl(D);
- D->UsingLoc = ReadSourceLocation();
- D->NamespaceLoc = ReadSourceLocation();
+ D->UsingLoc = readSourceLocation();
+ D->NamespaceLoc = readSourceLocation();
D->QualifierLoc = Record.readNestedNameSpecifierLoc();
- D->NominatedNamespace = ReadDeclAs<NamedDecl>();
- D->CommonAncestor = ReadDeclAs<DeclContext>();
+ D->NominatedNamespace = readDeclAs<NamedDecl>();
+ D->CommonAncestor = readDeclAs<DeclContext>();
}
void ASTDeclReader::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
VisitValueDecl(D);
- D->setUsingLoc(ReadSourceLocation());
+ D->setUsingLoc(readSourceLocation());
D->QualifierLoc = Record.readNestedNameSpecifierLoc();
- ReadDeclarationNameLoc(D->DNLoc, D->getDeclName());
- D->EllipsisLoc = ReadSourceLocation();
+ D->DNLoc = Record.readDeclarationNameLoc(D->getDeclName());
+ D->EllipsisLoc = readSourceLocation();
mergeMergeable(D);
}
void ASTDeclReader::VisitUnresolvedUsingTypenameDecl(
UnresolvedUsingTypenameDecl *D) {
VisitTypeDecl(D);
- D->TypenameLocation = ReadSourceLocation();
+ D->TypenameLocation = readSourceLocation();
D->QualifierLoc = Record.readNestedNameSpecifierLoc();
- D->EllipsisLoc = ReadSourceLocation();
+ D->EllipsisLoc = readSourceLocation();
mergeMergeable(D);
}
if (Data.ComputedVisibleConversions)
Record.readUnresolvedSet(Data.VisibleConversions);
assert(Data.Definition && "Data.Definition should be already set!");
- Data.FirstFriend = ReadDeclID();
+ Data.FirstFriend = readDeclID();
if (Data.IsLambda) {
using Capture = LambdaCapture;
Lambda.NumExplicitCaptures = Record.readInt();
Lambda.HasKnownInternalLinkage = Record.readInt();
Lambda.ManglingNumber = Record.readInt();
- Lambda.ContextDecl = ReadDeclID();
+ Lambda.ContextDecl = readDeclID();
Lambda.Captures = (Capture *)Reader.getContext().Allocate(
sizeof(Capture) * Lambda.NumCaptures);
Capture *ToCapture = Lambda.Captures;
- Lambda.MethodTyInfo = GetTypeSourceInfo();
+ Lambda.MethodTyInfo = readTypeSourceInfo();
for (unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
- SourceLocation Loc = ReadSourceLocation();
+ SourceLocation Loc = readSourceLocation();
bool IsImplicit = Record.readInt();
auto Kind = static_cast<LambdaCaptureKind>(Record.readInt());
switch (Kind) {
break;
case LCK_ByCopy:
case LCK_ByRef:
- auto *Var = ReadDeclAs<VarDecl>();
- SourceLocation EllipsisLoc = ReadSourceLocation();
+ auto *Var = readDeclAs<VarDecl>();
+ SourceLocation EllipsisLoc = readSourceLocation();
*ToCapture++ = Capture(Loc, IsImplicit, Kind, Var, EllipsisLoc);
break;
}
break;
case CXXRecTemplate: {
// Merged when we merge the template.
- auto *Template = ReadDeclAs<ClassTemplateDecl>();
+ auto *Template = readDeclAs<ClassTemplateDecl>();
D->TemplateOrInstantiation = Template;
if (!Template->getTemplatedDecl()) {
// We've not actually loaded the ClassTemplateDecl yet, because we're
break;
}
case CXXRecMemberSpecialization: {
- auto *RD = ReadDeclAs<CXXRecordDecl>();
+ auto *RD = readDeclAs<CXXRecordDecl>();
auto TSK = (TemplateSpecializationKind)Record.readInt();
- SourceLocation POI = ReadSourceLocation();
+ SourceLocation POI = readSourceLocation();
MemberSpecializationInfo *MSI = new (C) MemberSpecializationInfo(RD, TSK);
MSI->setPointOfInstantiation(POI);
D->TemplateOrInstantiation = MSI;
// Lazily load the key function to avoid deserializing every method so we can
// compute it.
if (WasDefinition) {
- DeclID KeyFn = ReadDeclID();
+ DeclID KeyFn = readDeclID();
if (KeyFn && D->isCompleteDefinition())
// FIXME: This is wrong for the ARM ABI, where some other module may have
// made this function no longer be a key function. We need an update
while (NumOverridenMethods--) {
// Avoid invariant checking of CXXMethodDecl::addOverriddenMethod,
// MD may be initializing.
- if (auto *MD = ReadDeclAs<CXXMethodDecl>())
+ if (auto *MD = readDeclAs<CXXMethodDecl>())
Reader.getContext().addOverriddenMethod(D, MD->getCanonicalDecl());
}
} else {
// so we have to read it before we call VisitCXXMethodDecl.
D->setExplicitSpecifier(Record.readExplicitSpec());
if (D->isInheritingConstructor()) {
- auto *Shadow = ReadDeclAs<ConstructorUsingShadowDecl>();
- auto *Ctor = ReadDeclAs<CXXConstructorDecl>();
+ auto *Shadow = readDeclAs<ConstructorUsingShadowDecl>();
+ auto *Ctor = readDeclAs<CXXConstructorDecl>();
*D->getTrailingObjects<InheritedConstructor>() =
InheritedConstructor(Shadow, Ctor);
}
void ASTDeclReader::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
VisitCXXMethodDecl(D);
- if (auto *OperatorDelete = ReadDeclAs<FunctionDecl>()) {
+ if (auto *OperatorDelete = readDeclAs<FunctionDecl>()) {
CXXDestructorDecl *Canon = D->getCanonicalDecl();
auto *ThisArg = Record.readExpr();
// FIXME: Check consistency if we have an old and new operator delete.
D->ImportedAndComplete.setInt(Record.readInt());
auto *StoredLocs = D->getTrailingObjects<SourceLocation>();
for (unsigned I = 0, N = Record.back(); I != N; ++I)
- StoredLocs[I] = ReadSourceLocation();
+ StoredLocs[I] = readSourceLocation();
Record.skipInts(1); // The number of stored source locations.
}
void ASTDeclReader::VisitAccessSpecDecl(AccessSpecDecl *D) {
VisitDecl(D);
- D->setColonLoc(ReadSourceLocation());
+ D->setColonLoc(readSourceLocation());
}
void ASTDeclReader::VisitFriendDecl(FriendDecl *D) {
VisitDecl(D);
if (Record.readInt()) // hasFriendDecl
- D->Friend = ReadDeclAs<NamedDecl>();
+ D->Friend = readDeclAs<NamedDecl>();
else
- D->Friend = GetTypeSourceInfo();
+ D->Friend = readTypeSourceInfo();
for (unsigned i = 0; i != D->NumTPLists; ++i)
D->getTrailingObjects<TemplateParameterList *>()[i] =
Record.readTemplateParameterList();
- D->NextFriend = ReadDeclID();
+ D->NextFriend = readDeclID();
D->UnsupportedFriend = (Record.readInt() != 0);
- D->FriendLoc = ReadSourceLocation();
+ D->FriendLoc = readSourceLocation();
}
void ASTDeclReader::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
for (unsigned i = 0; i != NumParams; ++i)
D->Params[i] = Record.readTemplateParameterList();
if (Record.readInt()) // HasFriendDecl
- D->Friend = ReadDeclAs<NamedDecl>();
+ D->Friend = readDeclAs<NamedDecl>();
else
- D->Friend = GetTypeSourceInfo();
- D->FriendLoc = ReadSourceLocation();
+ D->Friend = readTypeSourceInfo();
+ D->FriendLoc = readSourceLocation();
}
DeclID ASTDeclReader::VisitTemplateDecl(TemplateDecl *D) {
VisitNamedDecl(D);
- DeclID PatternID = ReadDeclID();
+ DeclID PatternID = readDeclID();
auto *TemplatedDecl = cast_or_null<NamedDecl>(Reader.GetDecl(PatternID));
TemplateParameterList *TemplateParams = Record.readTemplateParameterList();
D->init(TemplatedDecl, TemplateParams);
// If this is the first declaration of the template, fill in the information
// for the 'common' pointer.
if (ThisDeclID == Redecl.getFirstID()) {
- if (auto *RTD = ReadDeclAs<RedeclarableTemplateDecl>()) {
+ if (auto *RTD = readDeclAs<RedeclarableTemplateDecl>()) {
assert(RTD->getKind() == D->getKind() &&
"InstantiatedFromMemberTemplate kind mismatch");
D->setInstantiatedFromMemberTemplate(RTD);
// This ClassTemplateDecl owns a CommonPtr; read it to keep track of all of
// the specializations.
SmallVector<serialization::DeclID, 32> SpecIDs;
- ReadDeclIDList(SpecIDs);
+ readDeclIDList(SpecIDs);
ASTDeclReader::AddLazySpecializations(D, SpecIDs);
}
// This VarTemplateDecl owns a CommonPtr; read it to keep track of all of
// the specializations.
SmallVector<serialization::DeclID, 32> SpecIDs;
- ReadDeclIDList(SpecIDs);
+ readDeclIDList(SpecIDs);
ASTDeclReader::AddLazySpecializations(D, SpecIDs);
}
}
RedeclarableResult Redecl = VisitCXXRecordDeclImpl(D);
ASTContext &C = Reader.getContext();
- if (Decl *InstD = ReadDecl()) {
+ if (Decl *InstD = readDecl()) {
if (auto *CTD = dyn_cast<ClassTemplateDecl>(InstD)) {
D->SpecializedTemplate = CTD;
} else {
SmallVector<TemplateArgument, 8> TemplArgs;
Record.readTemplateArgumentList(TemplArgs, /*Canonicalize*/ true);
D->TemplateArgs = TemplateArgumentList::CreateCopy(C, TemplArgs);
- D->PointOfInstantiation = ReadSourceLocation();
+ D->PointOfInstantiation = readSourceLocation();
D->SpecializationKind = (TemplateSpecializationKind)Record.readInt();
bool writtenAsCanonicalDecl = Record.readInt();
if (writtenAsCanonicalDecl) {
- auto *CanonPattern = ReadDeclAs<ClassTemplateDecl>();
+ auto *CanonPattern = readDeclAs<ClassTemplateDecl>();
if (D->isCanonicalDecl()) { // It's kept in the folding set.
// Set this as, or find, the canonical declaration for this specialization
ClassTemplateSpecializationDecl *CanonSpec;
}
// Explicit info.
- if (TypeSourceInfo *TyInfo = GetTypeSourceInfo()) {
+ if (TypeSourceInfo *TyInfo = readTypeSourceInfo()) {
auto *ExplicitInfo =
new (C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
ExplicitInfo->TypeAsWritten = TyInfo;
- ExplicitInfo->ExternLoc = ReadSourceLocation();
- ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation();
+ ExplicitInfo->ExternLoc = readSourceLocation();
+ ExplicitInfo->TemplateKeywordLoc = readSourceLocation();
D->ExplicitInfo = ExplicitInfo;
}
// These are read/set from/to the first declaration.
if (ThisDeclID == Redecl.getFirstID()) {
D->InstantiatedFromMember.setPointer(
- ReadDeclAs<ClassTemplatePartialSpecializationDecl>());
+ readDeclAs<ClassTemplatePartialSpecializationDecl>());
D->InstantiatedFromMember.setInt(Record.readInt());
}
}
void ASTDeclReader::VisitClassScopeFunctionSpecializationDecl(
ClassScopeFunctionSpecializationDecl *D) {
VisitDecl(D);
- D->Specialization = ReadDeclAs<CXXMethodDecl>();
+ D->Specialization = readDeclAs<CXXMethodDecl>();
if (Record.readInt())
D->TemplateArgs = Record.readASTTemplateArgumentListInfo();
}
if (ThisDeclID == Redecl.getFirstID()) {
// This FunctionTemplateDecl owns a CommonPtr; read it.
SmallVector<serialization::DeclID, 32> SpecIDs;
- ReadDeclIDList(SpecIDs);
+ readDeclIDList(SpecIDs);
ASTDeclReader::AddLazySpecializations(D, SpecIDs);
}
}
RedeclarableResult Redecl = VisitVarDeclImpl(D);
ASTContext &C = Reader.getContext();
- if (Decl *InstD = ReadDecl()) {
+ if (Decl *InstD = readDecl()) {
if (auto *VTD = dyn_cast<VarTemplateDecl>(InstD)) {
D->SpecializedTemplate = VTD;
} else {
}
// Explicit info.
- if (TypeSourceInfo *TyInfo = GetTypeSourceInfo()) {
+ if (TypeSourceInfo *TyInfo = readTypeSourceInfo()) {
auto *ExplicitInfo =
new (C) VarTemplateSpecializationDecl::ExplicitSpecializationInfo;
ExplicitInfo->TypeAsWritten = TyInfo;
- ExplicitInfo->ExternLoc = ReadSourceLocation();
- ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation();
+ ExplicitInfo->ExternLoc = readSourceLocation();
+ ExplicitInfo->TemplateKeywordLoc = readSourceLocation();
D->ExplicitInfo = ExplicitInfo;
}
SmallVector<TemplateArgument, 8> TemplArgs;
Record.readTemplateArgumentList(TemplArgs, /*Canonicalize*/ true);
D->TemplateArgs = TemplateArgumentList::CreateCopy(C, TemplArgs);
- D->PointOfInstantiation = ReadSourceLocation();
+ D->PointOfInstantiation = readSourceLocation();
D->SpecializationKind = (TemplateSpecializationKind)Record.readInt();
D->IsCompleteDefinition = Record.readInt();
bool writtenAsCanonicalDecl = Record.readInt();
if (writtenAsCanonicalDecl) {
- auto *CanonPattern = ReadDeclAs<VarTemplateDecl>();
+ auto *CanonPattern = readDeclAs<VarTemplateDecl>();
if (D->isCanonicalDecl()) { // It's kept in the folding set.
// FIXME: If it's already present, merge it.
if (auto *Partial = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
// These are read/set from/to the first declaration.
if (ThisDeclID == Redecl.getFirstID()) {
D->InstantiatedFromMember.setPointer(
- ReadDeclAs<VarTemplatePartialSpecializationDecl>());
+ readDeclAs<VarTemplatePartialSpecializationDecl>());
D->InstantiatedFromMember.setInt(Record.readInt());
}
}
// TODO: Concepts: Immediately introduced constraint
if (Record.readInt())
- D->setDefaultArgument(GetTypeSourceInfo());
+ D->setDefaultArgument(readTypeSourceInfo());
}
void ASTDeclReader::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
D->getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
new (&TypesAndInfos[I].first) QualType(Record.readType());
- TypesAndInfos[I].second = GetTypeSourceInfo();
+ TypesAndInfos[I].second = readTypeSourceInfo();
}
} else {
// Rest of NonTypeTemplateParmDecl.
D->AssertExprAndFailed.setPointer(Record.readExpr());
D->AssertExprAndFailed.setInt(Record.readInt());
D->Message = cast_or_null<StringLiteral>(Record.readExpr());
- D->RParenLoc = ReadSourceLocation();
+ D->RParenLoc = readSourceLocation();
}
void ASTDeclReader::VisitEmptyDecl(EmptyDecl *D) {
void ASTDeclReader::VisitLifetimeExtendedTemporaryDecl(
LifetimeExtendedTemporaryDecl *D) {
VisitDecl(D);
- D->ExtendingDecl = ReadDeclAs<ValueDecl>();
+ D->ExtendingDecl = readDeclAs<ValueDecl>();
D->ExprWithTemporary = Record.readStmt();
if (Record.readInt())
D->Value = new (D->getASTContext()) APValue(Record.readAPValue());
template <typename T>
ASTDeclReader::RedeclarableResult
ASTDeclReader::VisitRedeclarable(Redeclarable<T> *D) {
- DeclID FirstDeclID = ReadDeclID();
+ DeclID FirstDeclID = readDeclID();
Decl *MergeWith = nullptr;
bool IsKeyDecl = ThisDeclID == FirstDeclID;
// FIXME: Provide a known merge target to the second and subsequent such
// declaration.
for (unsigned I = 0; I != N - 1; ++I)
- MergeWith = ReadDecl();
+ MergeWith = readDecl();
RedeclOffset = ReadLocalOffset();
} else {
// This declaration was not the first local declaration. Read the first
// local declaration now, to trigger the import of other redeclarations.
- (void)ReadDecl();
+ (void)readDecl();
}
auto *FirstDecl = cast_or_null<T>(Reader.GetDecl(FirstDeclID));
void ASTDeclReader::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
VisitValueDecl(D);
- D->setLocation(ReadSourceLocation());
+ D->setLocation(readSourceLocation());
Expr *In = Record.readExpr();
Expr *Out = Record.readExpr();
D->setCombinerData(In, Out);
Expr *Init = Record.readExpr();
auto IK = static_cast<OMPDeclareReductionDecl::InitKind>(Record.readInt());
D->setInitializer(Init, IK);
- D->PrevDeclInScope = ReadDeclID();
+ D->PrevDeclInScope = readDeclID();
}
void ASTDeclReader::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
VisitValueDecl(D);
- D->setLocation(ReadSourceLocation());
+ D->setLocation(readSourceLocation());
Expr *MapperVarRefE = Record.readExpr();
D->setMapperVarRef(MapperVarRefE);
D->VarName = Record.readDeclarationName();
- D->PrevDeclInScope = ReadDeclID();
+ D->PrevDeclInScope = readDeclID();
unsigned NumClauses = D->clauselist_size();
SmallVector<OMPClause *, 8> Clauses;
Clauses.reserve(NumClauses);
namespace {
class AttrReader {
- ModuleFile *F;
- ASTReader *Reader;
- const ASTReader::RecordData &Record;
- unsigned &Idx;
+ ASTRecordReader &Reader;
public:
- AttrReader(ModuleFile &F, ASTReader &Reader,
- const ASTReader::RecordData &Record, unsigned &Idx)
- : F(&F), Reader(&Reader), Record(Record), Idx(Idx) {}
+ AttrReader(ASTRecordReader &Reader) : Reader(Reader) {}
- const uint64_t &readInt() { return Record[Idx++]; }
+ uint64_t readInt() {
+ return Reader.readInt();
+ }
SourceRange readSourceRange() {
- return Reader->ReadSourceRange(*F, Record, Idx);
+ return Reader.readSourceRange();
}
SourceLocation readSourceLocation() {
- return Reader->ReadSourceLocation(*F, Record, Idx);
+ return Reader.readSourceLocation();
}
- Expr *readExpr() { return Reader->ReadExpr(*F); }
+ Expr *readExpr() { return Reader.readExpr(); }
std::string readString() {
- return Reader->ReadString(Record, Idx);
+ return Reader.readString();
}
- TypeSourceInfo *getTypeSourceInfo() {
- return Reader->GetTypeSourceInfo(*F, Record, Idx);
+ TypeSourceInfo *readTypeSourceInfo() {
+ return Reader.readTypeSourceInfo();
}
- IdentifierInfo *getIdentifierInfo() {
- return Reader->GetIdentifierInfo(*F, Record, Idx);
+ IdentifierInfo *readIdentifier() {
+ return Reader.readIdentifier();
}
VersionTuple readVersionTuple() {
- return ASTReader::ReadVersionTuple(Record, Idx);
+ return Reader.readVersionTuple();
}
template <typename T> T *GetLocalDeclAs(uint32_t LocalID) {
- return cast_or_null<T>(Reader->GetLocalDecl(*F, LocalID));
+ return Reader.GetLocalDeclAs<T>(LocalID);
}
};
}
-Attr *ASTReader::ReadAttr(ModuleFile &M, const RecordData &Rec,
- unsigned &Idx) {
- AttrReader Record(M, *this, Rec, Idx);
+Attr *ASTRecordReader::readAttr() {
+ AttrReader Record(*this);
auto V = Record.readInt();
if (!V)
return nullptr;
auto Kind = static_cast<attr::Kind>(V - 1);
ASTContext &Context = getContext();
- IdentifierInfo *AttrName = Record.getIdentifierInfo();
- IdentifierInfo *ScopeName = Record.getIdentifierInfo();
+ IdentifierInfo *AttrName = Record.readIdentifier();
+ IdentifierInfo *ScopeName = Record.readIdentifier();
SourceRange AttrRange = Record.readSourceRange();
SourceLocation ScopeLoc = Record.readSourceLocation();
unsigned ParsedKind = Record.readInt();
}
/// Reads attributes from the current stream position.
-void ASTReader::ReadAttributes(ASTRecordReader &Record, AttrVec &Attrs) {
- for (unsigned I = 0, E = Record.readInt(); I != E; ++I)
- Attrs.push_back(Record.readAttr());
+void ASTRecordReader::readAttributes(AttrVec &Attrs) {
+ for (unsigned I = 0, E = readInt(); I != E; ++I)
+ Attrs.push_back(readAttr());
}
//===----------------------------------------------------------------------===//
Deserializing ADecl(this);
auto Fail = [](const char *what, llvm::Error &&Err) {
- llvm::report_fatal_error(Twine("ASTReader::ReadDeclRecord failed ") + what +
+ llvm::report_fatal_error(Twine("ASTReader::readDeclRecord failed ") + what +
": " + toString(std::move(Err)));
};
Expected<unsigned> MaybeDeclCode = Record.readRecord(DeclsCursor, Code);
if (!MaybeDeclCode)
llvm::report_fatal_error(
- "ASTReader::ReadDeclRecord failed reading decl code: " +
+ "ASTReader::readDeclRecord failed reading decl code: " +
toString(MaybeDeclCode.takeError()));
switch ((DeclCode)MaybeDeclCode.get()) {
case DECL_CONTEXT_LEXICAL:
case DECL_CONTEXT_VISIBLE:
- llvm_unreachable("Record cannot be de-serialized with ReadDeclRecord");
+ llvm_unreachable("Record cannot be de-serialized with readDeclRecord");
case DECL_TYPEDEF:
D = TypedefDecl::CreateDeserialized(Context, ID);
break;
case UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION:
// It will be added to the template's lazy specialization set.
- PendingLazySpecializationIDs.push_back(ReadDeclID());
+ PendingLazySpecializationIDs.push_back(readDeclID());
break;
case UPD_CXX_ADDED_ANONYMOUS_NAMESPACE: {
- auto *Anon = ReadDeclAs<NamespaceDecl>();
+ auto *Anon = readDeclAs<NamespaceDecl>();
// Each module has its own anonymous namespace, which is disjoint from
// any other module's anonymous namespaces, so don't attach the anonymous
FD->setImplicitlyInline();
});
}
- FD->setInnerLocStart(ReadSourceLocation());
+ FD->setInnerLocStart(readSourceLocation());
ReadFunctionDefinition(FD);
assert(Record.getIdx() == Record.size() && "lazy body must be last");
break;
}
auto TSK = (TemplateSpecializationKind)Record.readInt();
- SourceLocation POI = ReadSourceLocation();
+ SourceLocation POI = readSourceLocation();
if (MemberSpecializationInfo *MSInfo =
RD->getMemberSpecializationInfo()) {
MSInfo->setTemplateSpecializationKind(TSK);
if (Record.readInt()) {
auto *PartialSpec =
- ReadDeclAs<ClassTemplatePartialSpecializationDecl>();
+ readDeclAs<ClassTemplatePartialSpecializationDecl>();
SmallVector<TemplateArgument, 8> TemplArgs;
Record.readTemplateArgumentList(TemplArgs);
auto *TemplArgList = TemplateArgumentList::CreateCopy(
}
RD->setTagKind((TagTypeKind)Record.readInt());
- RD->setLocation(ReadSourceLocation());
- RD->setLocStart(ReadSourceLocation());
- RD->setBraceRange(ReadSourceRange());
+ RD->setLocation(readSourceLocation());
+ RD->setLocStart(readSourceLocation());
+ RD->setBraceRange(readSourceRange());
if (Record.readInt()) {
AttrVec Attrs;
case UPD_CXX_RESOLVED_DTOR_DELETE: {
// Set the 'operator delete' directly to avoid emitting another update
// record.
- auto *Del = ReadDeclAs<FunctionDecl>();
+ auto *Del = readDeclAs<FunctionDecl>();
auto *First = cast<CXXDestructorDecl>(D->getCanonicalDecl());
auto *ThisArg = Record.readExpr();
// FIXME: Check consistency if we have an old and new operator delete.
}
case UPD_CXX_RESOLVED_EXCEPTION_SPEC: {
- FunctionProtoType::ExceptionSpecInfo ESI;
SmallVector<QualType, 8> ExceptionStorage;
- Record.readExceptionSpec(ExceptionStorage, ESI);
+ auto ESI = Record.readExceptionSpecInfo(ExceptionStorage);
// Update this declaration's exception specification, if needed.
auto *FD = cast<FunctionDecl>(D);
case UPD_DECL_MARKED_OPENMP_THREADPRIVATE:
D->addAttr(OMPThreadPrivateDeclAttr::CreateImplicit(
- Reader.getContext(), ReadSourceRange(),
+ Reader.getContext(), readSourceRange(),
AttributeCommonInfo::AS_Pragma));
break;
auto AllocatorKind =
static_cast<OMPAllocateDeclAttr::AllocatorTypeTy>(Record.readInt());
Expr *Allocator = Record.readExpr();
- SourceRange SR = ReadSourceRange();
+ SourceRange SR = readSourceRange();
D->addAttr(OMPAllocateDeclAttr::CreateImplicit(
Reader.getContext(), AllocatorKind, Allocator, SR,
AttributeCommonInfo::AS_Pragma));
OMPDeclareTargetDeclAttr::DevTypeTy DevType =
static_cast<OMPDeclareTargetDeclAttr::DevTypeTy>(Record.readInt());
D->addAttr(OMPDeclareTargetDeclAttr::CreateImplicit(
- Reader.getContext(), MapType, DevType, ReadSourceRange(),
+ Reader.getContext(), MapType, DevType, readSourceRange(),
AttributeCommonInfo::AS_Pragma));
break;
}
ASTRecordReader &Record;
llvm::BitstreamCursor &DeclsCursor;
- SourceLocation ReadSourceLocation() {
+ SourceLocation readSourceLocation() {
return Record.readSourceLocation();
}
- SourceRange ReadSourceRange() {
+ SourceRange readSourceRange() {
return Record.readSourceRange();
}
- std::string ReadString() {
+ std::string readString() {
return Record.readString();
}
- TypeSourceInfo *GetTypeSourceInfo() {
- return Record.getTypeSourceInfo();
+ TypeSourceInfo *readTypeSourceInfo() {
+ return Record.readTypeSourceInfo();
}
- Decl *ReadDecl() {
+ Decl *readDecl() {
return Record.readDecl();
}
template<typename T>
- T *ReadDeclAs() {
+ T *readDeclAs() {
return Record.readDeclAs<T>();
}
- void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc,
- DeclarationName Name) {
- Record.readDeclarationNameLoc(DNLoc, Name);
- }
-
- void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo) {
- Record.readDeclarationNameInfo(NameInfo);
- }
-
public:
ASTStmtReader(ASTRecordReader &Record, llvm::BitstreamCursor &Cursor)
: Record(Record), DeclsCursor(Cursor) {}
void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
TemplateArgumentLoc *ArgsLocArray,
unsigned NumTemplateArgs) {
- SourceLocation TemplateKWLoc = ReadSourceLocation();
+ SourceLocation TemplateKWLoc = readSourceLocation();
TemplateArgumentListInfo ArgInfo;
- ArgInfo.setLAngleLoc(ReadSourceLocation());
- ArgInfo.setRAngleLoc(ReadSourceLocation());
+ ArgInfo.setLAngleLoc(readSourceLocation());
+ ArgInfo.setRAngleLoc(readSourceLocation());
for (unsigned i = 0; i != NumTemplateArgs; ++i)
ArgInfo.addArgument(Record.readTemplateArgumentLoc());
Args.initializeFrom(TemplateKWLoc, ArgInfo, ArgsLocArray);
void ASTStmtReader::VisitNullStmt(NullStmt *S) {
VisitStmt(S);
- S->setSemiLoc(ReadSourceLocation());
+ S->setSemiLoc(readSourceLocation());
S->NullStmtBits.HasLeadingEmptyMacro = Record.readInt();
}
while (NumStmts--)
Stmts.push_back(Record.readSubStmt());
S->setStmts(Stmts);
- S->CompoundStmtBits.LBraceLoc = ReadSourceLocation();
- S->RBraceLoc = ReadSourceLocation();
+ S->CompoundStmtBits.LBraceLoc = readSourceLocation();
+ S->RBraceLoc = readSourceLocation();
}
void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
VisitStmt(S);
Record.recordSwitchCaseID(S, Record.readInt());
- S->setKeywordLoc(ReadSourceLocation());
- S->setColonLoc(ReadSourceLocation());
+ S->setKeywordLoc(readSourceLocation());
+ S->setColonLoc(readSourceLocation());
}
void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
S->setSubStmt(Record.readSubStmt());
if (CaseStmtIsGNURange) {
S->setRHS(Record.readSubExpr());
- S->setEllipsisLoc(ReadSourceLocation());
+ S->setEllipsisLoc(readSourceLocation());
}
}
void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
VisitStmt(S);
- auto *LD = ReadDeclAs<LabelDecl>();
+ auto *LD = readDeclAs<LabelDecl>();
LD->setStmt(S);
S->setDecl(LD);
S->setSubStmt(Record.readSubStmt());
- S->setIdentLoc(ReadSourceLocation());
+ S->setIdentLoc(readSourceLocation());
}
void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
assert(NumAttrs == Attrs.size());
std::copy(Attrs.begin(), Attrs.end(), S->getAttrArrayPtr());
S->SubStmt = Record.readSubStmt();
- S->AttributedStmtBits.AttrLoc = ReadSourceLocation();
+ S->AttributedStmtBits.AttrLoc = readSourceLocation();
}
void ASTStmtReader::VisitIfStmt(IfStmt *S) {
if (HasElse)
S->setElse(Record.readSubStmt());
if (HasVar)
- S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
+ S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
if (HasInit)
S->setInit(Record.readSubStmt());
- S->setIfLoc(ReadSourceLocation());
+ S->setIfLoc(readSourceLocation());
if (HasElse)
- S->setElseLoc(ReadSourceLocation());
+ S->setElseLoc(readSourceLocation());
}
void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
if (HasInit)
S->setInit(Record.readSubStmt());
if (HasVar)
- S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
+ S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
- S->setSwitchLoc(ReadSourceLocation());
+ S->setSwitchLoc(readSourceLocation());
SwitchCase *PrevSC = nullptr;
for (auto E = Record.size(); Record.getIdx() != E; ) {
S->setCond(Record.readSubExpr());
S->setBody(Record.readSubStmt());
if (HasVar)
- S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
+ S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
- S->setWhileLoc(ReadSourceLocation());
+ S->setWhileLoc(readSourceLocation());
}
void ASTStmtReader::VisitDoStmt(DoStmt *S) {
VisitStmt(S);
S->setCond(Record.readSubExpr());
S->setBody(Record.readSubStmt());
- S->setDoLoc(ReadSourceLocation());
- S->setWhileLoc(ReadSourceLocation());
- S->setRParenLoc(ReadSourceLocation());
+ S->setDoLoc(readSourceLocation());
+ S->setWhileLoc(readSourceLocation());
+ S->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitForStmt(ForStmt *S) {
VisitStmt(S);
S->setInit(Record.readSubStmt());
S->setCond(Record.readSubExpr());
- S->setConditionVariable(Record.getContext(), ReadDeclAs<VarDecl>());
+ S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
S->setInc(Record.readSubExpr());
S->setBody(Record.readSubStmt());
- S->setForLoc(ReadSourceLocation());
- S->setLParenLoc(ReadSourceLocation());
- S->setRParenLoc(ReadSourceLocation());
+ S->setForLoc(readSourceLocation());
+ S->setLParenLoc(readSourceLocation());
+ S->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
VisitStmt(S);
- S->setLabel(ReadDeclAs<LabelDecl>());
- S->setGotoLoc(ReadSourceLocation());
- S->setLabelLoc(ReadSourceLocation());
+ S->setLabel(readDeclAs<LabelDecl>());
+ S->setGotoLoc(readSourceLocation());
+ S->setLabelLoc(readSourceLocation());
}
void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
VisitStmt(S);
- S->setGotoLoc(ReadSourceLocation());
- S->setStarLoc(ReadSourceLocation());
+ S->setGotoLoc(readSourceLocation());
+ S->setStarLoc(readSourceLocation());
S->setTarget(Record.readSubExpr());
}
void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
VisitStmt(S);
- S->setContinueLoc(ReadSourceLocation());
+ S->setContinueLoc(readSourceLocation());
}
void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
VisitStmt(S);
- S->setBreakLoc(ReadSourceLocation());
+ S->setBreakLoc(readSourceLocation());
}
void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
S->setRetValue(Record.readSubExpr());
if (HasNRVOCandidate)
- S->setNRVOCandidate(ReadDeclAs<VarDecl>());
+ S->setNRVOCandidate(readDeclAs<VarDecl>());
- S->setReturnLoc(ReadSourceLocation());
+ S->setReturnLoc(readSourceLocation());
}
void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
VisitStmt(S);
- S->setStartLoc(ReadSourceLocation());
- S->setEndLoc(ReadSourceLocation());
+ S->setStartLoc(readSourceLocation());
+ S->setEndLoc(readSourceLocation());
if (Record.size() - Record.getIdx() == 1) {
// Single declaration
- S->setDeclGroup(DeclGroupRef(ReadDecl()));
+ S->setDeclGroup(DeclGroupRef(readDecl()));
} else {
SmallVector<Decl *, 16> Decls;
int N = Record.size() - Record.getIdx();
Decls.reserve(N);
for (int I = 0; I < N; ++I)
- Decls.push_back(ReadDecl());
+ Decls.push_back(readDecl());
S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Record.getContext(),
Decls.data(),
Decls.size())));
S->NumOutputs = Record.readInt();
S->NumInputs = Record.readInt();
S->NumClobbers = Record.readInt();
- S->setAsmLoc(ReadSourceLocation());
+ S->setAsmLoc(readSourceLocation());
S->setVolatile(Record.readInt());
S->setSimple(Record.readInt());
}
void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
VisitAsmStmt(S);
S->NumLabels = Record.readInt();
- S->setRParenLoc(ReadSourceLocation());
+ S->setRParenLoc(readSourceLocation());
S->setAsmString(cast_or_null<StringLiteral>(Record.readSubStmt()));
unsigned NumOutputs = S->getNumOutputs();
SmallVector<StringLiteral*, 16> Constraints;
SmallVector<Stmt*, 16> Exprs;
for (unsigned I = 0, N = NumOutputs + NumInputs; I != N; ++I) {
- Names.push_back(Record.getIdentifierInfo());
+ Names.push_back(Record.readIdentifier());
Constraints.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
Exprs.push_back(Record.readSubStmt());
}
void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
VisitAsmStmt(S);
- S->LBraceLoc = ReadSourceLocation();
- S->EndLoc = ReadSourceLocation();
+ S->LBraceLoc = readSourceLocation();
+ S->EndLoc = readSourceLocation();
S->NumAsmToks = Record.readInt();
- std::string AsmStr = ReadString();
+ std::string AsmStr = readString();
// Read the tokens.
SmallVector<Token, 16> AsmToks;
ClobbersData.reserve(S->NumClobbers);
Clobbers.reserve(S->NumClobbers);
for (unsigned i = 0, e = S->NumClobbers; i != e; ++i) {
- ClobbersData.push_back(ReadString());
+ ClobbersData.push_back(readString());
Clobbers.push_back(ClobbersData.back());
}
Constraints.reserve(NumOperands);
for (unsigned i = 0; i != NumOperands; ++i) {
Exprs.push_back(cast<Expr>(Record.readSubStmt()));
- ConstraintsData.push_back(ReadString());
+ ConstraintsData.push_back(readString());
Constraints.push_back(ConstraintsData.back());
}
void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) {
VisitExpr(E);
- E->KeywordLoc = ReadSourceLocation();
+ E->KeywordLoc = readSourceLocation();
for (auto &SubExpr: E->SubExprs)
SubExpr = Record.readSubStmt();
E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) {
VisitExpr(E);
- E->KeywordLoc = ReadSourceLocation();
+ E->KeywordLoc = readSourceLocation();
for (auto &SubExpr: E->SubExprs)
SubExpr = Record.readSubStmt();
E->OpaqueValue = cast_or_null<OpaqueValueExpr>(Record.readSubStmt());
void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
VisitExpr(E);
- E->KeywordLoc = ReadSourceLocation();
+ E->KeywordLoc = readSourceLocation();
for (auto &SubExpr: E->SubExprs)
SubExpr = Record.readSubStmt();
}
void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
VisitStmt(S);
Record.skipInts(1);
- S->setCapturedDecl(ReadDeclAs<CapturedDecl>());
+ S->setCapturedDecl(readDeclAs<CapturedDecl>());
S->setCapturedRegionKind(static_cast<CapturedRegionKind>(Record.readInt()));
- S->setCapturedRecordDecl(ReadDeclAs<RecordDecl>());
+ S->setCapturedRecordDecl(readDeclAs<RecordDecl>());
// Capture inits
for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(),
// Captures
for (auto &I : S->captures()) {
- I.VarAndKind.setPointer(ReadDeclAs<VarDecl>());
+ I.VarAndKind.setPointer(readDeclAs<VarDecl>());
I.VarAndKind.setInt(
static_cast<CapturedStmt::VariableCaptureKind>(Record.readInt()));
- I.Loc = ReadSourceLocation();
+ I.Loc = readSourceLocation();
}
}
bool HasFunctionName = Record.readInt();
E->PredefinedExprBits.HasFunctionName = HasFunctionName;
E->PredefinedExprBits.Kind = Record.readInt();
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
if (HasFunctionName)
E->setFunctionName(cast<StringLiteral>(Record.readSubExpr()));
}
NestedNameSpecifierLoc(Record.readNestedNameSpecifierLoc());
if (E->hasFoundDecl())
- *E->getTrailingObjects<NamedDecl *>() = ReadDeclAs<NamedDecl>();
+ *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
if (E->hasTemplateKWAndArgsInfo())
ReadTemplateKWAndArgsInfo(
*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
E->getTrailingObjects<TemplateArgumentLoc>(), NumTemplateArgs);
- E->setDecl(ReadDeclAs<ValueDecl>());
- E->setLocation(ReadSourceLocation());
- ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName());
+ E->setDecl(readDeclAs<ValueDecl>());
+ E->setLocation(readSourceLocation());
+ E->DNLoc = Record.readDeclarationNameLoc(E->getDecl()->getDeclName());
}
void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
VisitExpr(E);
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
E->setValue(Record.getContext(), Record.readAPInt());
}
void ASTStmtReader::VisitFixedPointLiteral(FixedPointLiteral *E) {
VisitExpr(E);
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
E->setValue(Record.getContext(), Record.readAPInt());
}
static_cast<llvm::APFloatBase::Semantics>(Record.readInt()));
E->setExact(Record.readInt());
E->setValue(Record.getContext(), Record.readAPFloat(E->getSemantics()));
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
}
void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
// Deserialize the trailing array of SourceLocation.
for (unsigned I = 0; I < NumConcatenated; ++I)
- E->setStrTokenLoc(I, ReadSourceLocation());
+ E->setStrTokenLoc(I, readSourceLocation());
// Deserialize the trailing array of char holding the string data.
char *StrData = E->getStrDataAsChar();
void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
VisitExpr(E);
E->setValue(Record.readInt());
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
E->setKind(static_cast<CharacterLiteral::CharacterKind>(Record.readInt()));
}
void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
VisitExpr(E);
- E->setLParen(ReadSourceLocation());
- E->setRParen(ReadSourceLocation());
+ E->setLParen(readSourceLocation());
+ E->setRParen(readSourceLocation());
E->setSubExpr(Record.readSubExpr());
}
assert((NumExprs == E->getNumExprs()) && "Wrong NumExprs!");
for (unsigned I = 0; I != NumExprs; ++I)
E->getTrailingObjects<Stmt *>()[I] = Record.readSubStmt();
- E->LParenLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
+ E->LParenLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
}
void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
VisitExpr(E);
E->setSubExpr(Record.readSubExpr());
E->setOpcode((UnaryOperator::Opcode)Record.readInt());
- E->setOperatorLoc(ReadSourceLocation());
+ E->setOperatorLoc(readSourceLocation());
E->setCanOverflow(Record.readInt());
}
Record.skipInts(1);
assert(E->getNumExpressions() == Record.peekInt());
Record.skipInts(1);
- E->setOperatorLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
- E->setTypeSourceInfo(GetTypeSourceInfo());
+ E->setOperatorLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
+ E->setTypeSourceInfo(readTypeSourceInfo());
for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
- SourceLocation Start = ReadSourceLocation();
- SourceLocation End = ReadSourceLocation();
+ SourceLocation Start = readSourceLocation();
+ SourceLocation End = readSourceLocation();
switch (Kind) {
case OffsetOfNode::Array:
E->setComponent(I, OffsetOfNode(Start, Record.readInt(), End));
case OffsetOfNode::Field:
E->setComponent(
- I, OffsetOfNode(Start, ReadDeclAs<FieldDecl>(), End));
+ I, OffsetOfNode(Start, readDeclAs<FieldDecl>(), End));
break;
case OffsetOfNode::Identifier:
E->setComponent(
I,
- OffsetOfNode(Start, Record.getIdentifierInfo(), End));
+ OffsetOfNode(Start, Record.readIdentifier(), End));
break;
case OffsetOfNode::Base: {
E->setArgument(Record.readSubExpr());
Record.skipInts(1);
} else {
- E->setArgument(GetTypeSourceInfo());
+ E->setArgument(readTypeSourceInfo());
}
- E->setOperatorLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setOperatorLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitConceptSpecializationExpr(
E->NestedNameSpec = Record.readNestedNameSpecifierLoc();
E->TemplateKWLoc = Record.readSourceLocation();
E->ConceptNameLoc = Record.readSourceLocation();
- E->FoundDecl = ReadDeclAs<NamedDecl>();
- E->NamedConcept = ReadDeclAs<ConceptDecl>();
+ E->FoundDecl = readDeclAs<NamedDecl>();
+ E->NamedConcept = readDeclAs<ConceptDecl>();
const ASTTemplateArgumentListInfo *ArgsAsWritten =
Record.readASTTemplateArgumentListInfo();
llvm::SmallVector<TemplateArgument, 4> Args;
VisitExpr(E);
E->setLHS(Record.readSubExpr());
E->setRHS(Record.readSubExpr());
- E->setRBracketLoc(ReadSourceLocation());
+ E->setRBracketLoc(readSourceLocation());
}
void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) {
E->setBase(Record.readSubExpr());
E->setLowerBound(Record.readSubExpr());
E->setLength(Record.readSubExpr());
- E->setColonLoc(ReadSourceLocation());
- E->setRBracketLoc(ReadSourceLocation());
+ E->setColonLoc(readSourceLocation());
+ E->setRBracketLoc(readSourceLocation());
}
void ASTStmtReader::VisitCallExpr(CallExpr *E) {
VisitExpr(E);
unsigned NumArgs = Record.readInt();
assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
- E->setRParenLoc(ReadSourceLocation());
+ E->setRParenLoc(readSourceLocation());
E->setCallee(Record.readSubExpr());
for (unsigned I = 0; I != NumArgs; ++I)
E->setArg(I, Record.readSubExpr());
E->Base = Record.readSubExpr();
E->MemberDecl = Record.readDeclAs<ValueDecl>();
- Record.readDeclarationNameLoc(E->MemberDNLoc, E->MemberDecl->getDeclName());
+ E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->getDeclName());
E->MemberLoc = Record.readSourceLocation();
E->MemberExprBits.IsArrow = Record.readInt();
E->MemberExprBits.HasQualifierOrFoundDecl = HasQualifier || HasFoundDecl;
void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
VisitExpr(E);
E->setBase(Record.readSubExpr());
- E->setIsaMemberLoc(ReadSourceLocation());
- E->setOpLoc(ReadSourceLocation());
+ E->setIsaMemberLoc(readSourceLocation());
+ E->setOpLoc(readSourceLocation());
E->setArrow(Record.readInt());
}
void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
VisitExplicitCastExpr(E);
- E->LParenLoc = ReadSourceLocation();
- E->BridgeKeywordLoc = ReadSourceLocation();
+ E->LParenLoc = readSourceLocation();
+ E->BridgeKeywordLoc = readSourceLocation();
E->Kind = Record.readInt();
}
E->setLHS(Record.readSubExpr());
E->setRHS(Record.readSubExpr());
E->setOpcode((BinaryOperator::Opcode)Record.readInt());
- E->setOperatorLoc(ReadSourceLocation());
+ E->setOperatorLoc(readSourceLocation());
E->setFPFeatures(FPOptions(Record.readInt()));
}
E->SubExprs[ConditionalOperator::COND] = Record.readSubExpr();
E->SubExprs[ConditionalOperator::LHS] = Record.readSubExpr();
E->SubExprs[ConditionalOperator::RHS] = Record.readSubExpr();
- E->QuestionLoc = ReadSourceLocation();
- E->ColonLoc = ReadSourceLocation();
+ E->QuestionLoc = readSourceLocation();
+ E->ColonLoc = readSourceLocation();
}
void
E->SubExprs[BinaryConditionalOperator::COND] = Record.readSubExpr();
E->SubExprs[BinaryConditionalOperator::LHS] = Record.readSubExpr();
E->SubExprs[BinaryConditionalOperator::RHS] = Record.readSubExpr();
- E->QuestionLoc = ReadSourceLocation();
- E->ColonLoc = ReadSourceLocation();
+ E->QuestionLoc = readSourceLocation();
+ E->ColonLoc = readSourceLocation();
}
void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
VisitCastExpr(E);
- E->setTypeInfoAsWritten(GetTypeSourceInfo());
+ E->setTypeInfoAsWritten(readTypeSourceInfo());
}
void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
VisitExplicitCastExpr(E);
- E->setLParenLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setLParenLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
VisitExpr(E);
- E->setLParenLoc(ReadSourceLocation());
- E->setTypeSourceInfo(GetTypeSourceInfo());
+ E->setLParenLoc(readSourceLocation());
+ E->setTypeSourceInfo(readTypeSourceInfo());
E->setInitializer(Record.readSubExpr());
E->setFileScope(Record.readInt());
}
void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
VisitExpr(E);
E->setBase(Record.readSubExpr());
- E->setAccessor(Record.getIdentifierInfo());
- E->setAccessorLoc(ReadSourceLocation());
+ E->setAccessor(Record.readIdentifier());
+ E->setAccessorLoc(readSourceLocation());
}
void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
VisitExpr(E);
if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
E->setSyntacticForm(SyntForm);
- E->setLBraceLoc(ReadSourceLocation());
- E->setRBraceLoc(ReadSourceLocation());
+ E->setLBraceLoc(readSourceLocation());
+ E->setRBraceLoc(readSourceLocation());
bool isArrayFiller = Record.readInt();
Expr *filler = nullptr;
if (isArrayFiller) {
filler = Record.readSubExpr();
E->ArrayFillerOrUnionFieldInit = filler;
} else
- E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>();
+ E->ArrayFillerOrUnionFieldInit = readDeclAs<FieldDecl>();
E->sawArrayRangeDesignator(Record.readInt());
unsigned NumInits = Record.readInt();
E->reserveInits(Record.getContext(), NumInits);
assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
for (unsigned I = 0; I != NumSubExprs; ++I)
E->setSubExpr(I, Record.readSubExpr());
- E->setEqualOrColonLoc(ReadSourceLocation());
+ E->setEqualOrColonLoc(readSourceLocation());
E->setGNUSyntax(Record.readInt());
SmallVector<Designator, 4> Designators;
while (Record.getIdx() < Record.size()) {
switch ((DesignatorTypes)Record.readInt()) {
case DESIG_FIELD_DECL: {
- auto *Field = ReadDeclAs<FieldDecl>();
- SourceLocation DotLoc = ReadSourceLocation();
- SourceLocation FieldLoc = ReadSourceLocation();
+ auto *Field = readDeclAs<FieldDecl>();
+ SourceLocation DotLoc = readSourceLocation();
+ SourceLocation FieldLoc = readSourceLocation();
Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
FieldLoc));
Designators.back().setField(Field);
}
case DESIG_FIELD_NAME: {
- const IdentifierInfo *Name = Record.getIdentifierInfo();
- SourceLocation DotLoc = ReadSourceLocation();
- SourceLocation FieldLoc = ReadSourceLocation();
+ const IdentifierInfo *Name = Record.readIdentifier();
+ SourceLocation DotLoc = readSourceLocation();
+ SourceLocation FieldLoc = readSourceLocation();
Designators.push_back(Designator(Name, DotLoc, FieldLoc));
break;
}
case DESIG_ARRAY: {
unsigned Index = Record.readInt();
- SourceLocation LBracketLoc = ReadSourceLocation();
- SourceLocation RBracketLoc = ReadSourceLocation();
+ SourceLocation LBracketLoc = readSourceLocation();
+ SourceLocation RBracketLoc = readSourceLocation();
Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
break;
}
case DESIG_ARRAY_RANGE: {
unsigned Index = Record.readInt();
- SourceLocation LBracketLoc = ReadSourceLocation();
- SourceLocation EllipsisLoc = ReadSourceLocation();
- SourceLocation RBracketLoc = ReadSourceLocation();
+ SourceLocation LBracketLoc = readSourceLocation();
+ SourceLocation EllipsisLoc = readSourceLocation();
+ SourceLocation RBracketLoc = readSourceLocation();
Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
RBracketLoc));
break;
void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
VisitExpr(E);
E->setSubExpr(Record.readSubExpr());
- E->setWrittenTypeInfo(GetTypeSourceInfo());
- E->setBuiltinLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setWrittenTypeInfo(readTypeSourceInfo());
+ E->setBuiltinLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
E->setIsMicrosoftABI(Record.readInt());
}
void ASTStmtReader::VisitSourceLocExpr(SourceLocExpr *E) {
VisitExpr(E);
- E->ParentContext = ReadDeclAs<DeclContext>();
- E->BuiltinLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
+ E->ParentContext = readDeclAs<DeclContext>();
+ E->BuiltinLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
E->SourceLocExprBits.Kind =
static_cast<SourceLocExpr::IdentKind>(Record.readInt());
}
void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
VisitExpr(E);
- E->setAmpAmpLoc(ReadSourceLocation());
- E->setLabelLoc(ReadSourceLocation());
- E->setLabel(ReadDeclAs<LabelDecl>());
+ E->setAmpAmpLoc(readSourceLocation());
+ E->setLabelLoc(readSourceLocation());
+ E->setLabel(readDeclAs<LabelDecl>());
}
void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
VisitExpr(E);
- E->setLParenLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setLParenLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
E->setSubStmt(cast_or_null<CompoundStmt>(Record.readSubStmt()));
}
E->setCond(Record.readSubExpr());
E->setLHS(Record.readSubExpr());
E->setRHS(Record.readSubExpr());
- E->setBuiltinLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setBuiltinLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
E->setIsConditionTrue(Record.readInt());
}
void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
VisitExpr(E);
- E->setTokenLocation(ReadSourceLocation());
+ E->setTokenLocation(readSourceLocation());
}
void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
while (NumExprs--)
Exprs.push_back(Record.readSubExpr());
E->setExprs(Record.getContext(), Exprs);
- E->setBuiltinLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setBuiltinLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitConvertVectorExpr(ConvertVectorExpr *E) {
VisitExpr(E);
- E->BuiltinLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
- E->TInfo = GetTypeSourceInfo();
+ E->BuiltinLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
+ E->TInfo = readTypeSourceInfo();
E->SrcExpr = Record.readSubExpr();
}
void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
VisitExpr(E);
- E->setBlockDecl(ReadDeclAs<BlockDecl>());
+ E->setBlockDecl(readDeclAs<BlockDecl>());
}
void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
unsigned NumAssocs = Record.readInt();
assert(NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!");
E->ResultIndex = Record.readInt();
- E->GenericSelectionExprBits.GenericLoc = ReadSourceLocation();
- E->DefaultLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
+ E->GenericSelectionExprBits.GenericLoc = readSourceLocation();
+ E->DefaultLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
Stmt **Stmts = E->getTrailingObjects<Stmt *>();
// Add 1 to account for the controlling expression which is the first
TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>();
for (unsigned I = 0, N = NumAssocs; I < N; ++I)
- TSIs[I] = GetTypeSourceInfo();
+ TSIs[I] = readTypeSourceInfo();
}
void ASTStmtReader::VisitPseudoObjectExpr(PseudoObjectExpr *E) {
E->NumSubExprs = AtomicExpr::getNumSubExprs(E->Op);
for (unsigned I = 0; I != E->NumSubExprs; ++I)
E->SubExprs[I] = Record.readSubExpr();
- E->BuiltinLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
+ E->BuiltinLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
}
//===----------------------------------------------------------------------===//
void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
VisitExpr(E);
E->setString(cast<StringLiteral>(Record.readSubStmt()));
- E->setAtLoc(ReadSourceLocation());
+ E->setAtLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
VisitExpr(E);
// could be one of several IntegerLiteral, FloatLiteral, etc.
E->SubExpr = Record.readSubStmt();
- E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>();
- E->Range = ReadSourceRange();
+ E->BoxingMethod = readDeclAs<ObjCMethodDecl>();
+ E->Range = readSourceRange();
}
void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
Expr **Elements = E->getElements();
for (unsigned I = 0, N = NumElements; I != N; ++I)
Elements[I] = Record.readSubExpr();
- E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
- E->Range = ReadSourceRange();
+ E->ArrayWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
+ E->Range = readSourceRange();
}
void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
KeyValues[I].Key = Record.readSubExpr();
KeyValues[I].Value = Record.readSubExpr();
if (HasPackExpansions) {
- Expansions[I].EllipsisLoc = ReadSourceLocation();
+ Expansions[I].EllipsisLoc = readSourceLocation();
Expansions[I].NumExpansionsPlusOne = Record.readInt();
}
}
- E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>();
- E->Range = ReadSourceRange();
+ E->DictWithObjectsMethod = readDeclAs<ObjCMethodDecl>();
+ E->Range = readSourceRange();
}
void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
VisitExpr(E);
- E->setEncodedTypeSourceInfo(GetTypeSourceInfo());
- E->setAtLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setEncodedTypeSourceInfo(readTypeSourceInfo());
+ E->setAtLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
VisitExpr(E);
E->setSelector(Record.readSelector());
- E->setAtLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setAtLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
VisitExpr(E);
- E->setProtocol(ReadDeclAs<ObjCProtocolDecl>());
- E->setAtLoc(ReadSourceLocation());
- E->ProtoLoc = ReadSourceLocation();
- E->setRParenLoc(ReadSourceLocation());
+ E->setProtocol(readDeclAs<ObjCProtocolDecl>());
+ E->setAtLoc(readSourceLocation());
+ E->ProtoLoc = readSourceLocation();
+ E->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
VisitExpr(E);
- E->setDecl(ReadDeclAs<ObjCIvarDecl>());
- E->setLocation(ReadSourceLocation());
- E->setOpLoc(ReadSourceLocation());
+ E->setDecl(readDeclAs<ObjCIvarDecl>());
+ E->setLocation(readSourceLocation());
+ E->setOpLoc(readSourceLocation());
E->setBase(Record.readSubExpr());
E->setIsArrow(Record.readInt());
E->setIsFreeIvar(Record.readInt());
unsigned MethodRefFlags = Record.readInt();
bool Implicit = Record.readInt() != 0;
if (Implicit) {
- auto *Getter = ReadDeclAs<ObjCMethodDecl>();
- auto *Setter = ReadDeclAs<ObjCMethodDecl>();
+ auto *Getter = readDeclAs<ObjCMethodDecl>();
+ auto *Setter = readDeclAs<ObjCMethodDecl>();
E->setImplicitProperty(Getter, Setter, MethodRefFlags);
} else {
- E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
+ E->setExplicitProperty(readDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
}
- E->setLocation(ReadSourceLocation());
- E->setReceiverLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
+ E->setReceiverLocation(readSourceLocation());
switch (Record.readInt()) {
case 0:
E->setBase(Record.readSubExpr());
E->setSuperReceiver(Record.readType());
break;
case 2:
- E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>());
+ E->setClassReceiver(readDeclAs<ObjCInterfaceDecl>());
break;
}
}
void ASTStmtReader::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
VisitExpr(E);
- E->setRBracket(ReadSourceLocation());
+ E->setRBracket(readSourceLocation());
E->setBaseExpr(Record.readSubExpr());
E->setKeyExpr(Record.readSubExpr());
- E->GetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
- E->SetAtIndexMethodDecl = ReadDeclAs<ObjCMethodDecl>();
+ E->GetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
+ E->SetAtIndexMethodDecl = readDeclAs<ObjCMethodDecl>();
}
void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
break;
case ObjCMessageExpr::Class:
- E->setClassReceiver(GetTypeSourceInfo());
+ E->setClassReceiver(readTypeSourceInfo());
break;
case ObjCMessageExpr::SuperClass:
case ObjCMessageExpr::SuperInstance: {
QualType T = Record.readType();
- SourceLocation SuperLoc = ReadSourceLocation();
+ SourceLocation SuperLoc = readSourceLocation();
E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
break;
}
assert(Kind == E->getReceiverKind());
if (Record.readInt())
- E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>());
+ E->setMethodDecl(readDeclAs<ObjCMethodDecl>());
else
E->setSelector(Record.readSelector());
- E->LBracLoc = ReadSourceLocation();
- E->RBracLoc = ReadSourceLocation();
+ E->LBracLoc = readSourceLocation();
+ E->RBracLoc = readSourceLocation();
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
E->setArg(I, Record.readSubExpr());
SourceLocation *Locs = E->getStoredSelLocs();
for (unsigned I = 0; I != NumStoredSelLocs; ++I)
- Locs[I] = ReadSourceLocation();
+ Locs[I] = readSourceLocation();
}
void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
S->setElement(Record.readSubStmt());
S->setCollection(Record.readSubExpr());
S->setBody(Record.readSubStmt());
- S->setForLoc(ReadSourceLocation());
- S->setRParenLoc(ReadSourceLocation());
+ S->setForLoc(readSourceLocation());
+ S->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
VisitStmt(S);
S->setCatchBody(Record.readSubStmt());
- S->setCatchParamDecl(ReadDeclAs<VarDecl>());
- S->setAtCatchLoc(ReadSourceLocation());
- S->setRParenLoc(ReadSourceLocation());
+ S->setCatchParamDecl(readDeclAs<VarDecl>());
+ S->setAtCatchLoc(readSourceLocation());
+ S->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
VisitStmt(S);
S->setFinallyBody(Record.readSubStmt());
- S->setAtFinallyLoc(ReadSourceLocation());
+ S->setAtFinallyLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
VisitStmt(S); // FIXME: no test coverage.
S->setSubStmt(Record.readSubStmt());
- S->setAtLoc(ReadSourceLocation());
+ S->setAtLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
if (HasFinally)
S->setFinallyStmt(Record.readSubStmt());
- S->setAtTryLoc(ReadSourceLocation());
+ S->setAtTryLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
VisitStmt(S); // FIXME: no test coverage.
S->setSynchExpr(Record.readSubStmt());
S->setSynchBody(Record.readSubStmt());
- S->setAtSynchronizedLoc(ReadSourceLocation());
+ S->setAtSynchronizedLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
VisitStmt(S); // FIXME: no test coverage.
S->setThrowExpr(Record.readSubStmt());
- S->setThrowLoc(ReadSourceLocation());
+ S->setThrowLoc(readSourceLocation());
}
void ASTStmtReader::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
VisitExpr(E);
E->setValue(Record.readInt());
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
}
void ASTStmtReader::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
VisitStmt(S);
- S->CatchLoc = ReadSourceLocation();
- S->ExceptionDecl = ReadDeclAs<VarDecl>();
+ S->CatchLoc = readSourceLocation();
+ S->ExceptionDecl = readDeclAs<VarDecl>();
S->HandlerBlock = Record.readSubStmt();
}
VisitStmt(S);
assert(Record.peekInt() == S->getNumHandlers() && "NumStmtFields is wrong ?");
Record.skipInts(1);
- S->TryLoc = ReadSourceLocation();
+ S->TryLoc = readSourceLocation();
S->getStmts()[0] = Record.readSubStmt();
for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
S->getStmts()[i + 1] = Record.readSubStmt();
void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
VisitStmt(S);
- S->ForLoc = ReadSourceLocation();
- S->CoawaitLoc = ReadSourceLocation();
- S->ColonLoc = ReadSourceLocation();
- S->RParenLoc = ReadSourceLocation();
+ S->ForLoc = readSourceLocation();
+ S->CoawaitLoc = readSourceLocation();
+ S->ColonLoc = readSourceLocation();
+ S->RParenLoc = readSourceLocation();
S->setInit(Record.readSubStmt());
S->setRangeStmt(Record.readSubStmt());
S->setBeginStmt(Record.readSubStmt());
void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) {
VisitStmt(S);
- S->KeywordLoc = ReadSourceLocation();
+ S->KeywordLoc = readSourceLocation();
S->IsIfExists = Record.readInt();
S->QualifierLoc = Record.readNestedNameSpecifierLoc();
- ReadDeclarationNameInfo(S->NameInfo);
+ S->NameInfo = Record.readDeclarationNameInfo();
S->SubStmt = Record.readSubStmt();
}
E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
E->CXXConstructExprBits.ConstructionKind = Record.readInt();
- E->CXXConstructExprBits.Loc = ReadSourceLocation();
- E->Constructor = ReadDeclAs<CXXConstructorDecl>();
- E->ParenOrBraceRange = ReadSourceRange();
+ E->CXXConstructExprBits.Loc = readSourceLocation();
+ E->Constructor = readDeclAs<CXXConstructorDecl>();
+ E->ParenOrBraceRange = readSourceRange();
for (unsigned I = 0; I != NumArgs; ++I)
E->setArg(I, Record.readSubExpr());
void ASTStmtReader::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
VisitExpr(E);
- E->Constructor = ReadDeclAs<CXXConstructorDecl>();
- E->Loc = ReadSourceLocation();
+ E->Constructor = readDeclAs<CXXConstructorDecl>();
+ E->Loc = readSourceLocation();
E->ConstructsVirtualBase = Record.readInt();
E->InheritedFromVirtualBase = Record.readInt();
}
void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
VisitCXXConstructExpr(E);
- E->TSI = GetTypeSourceInfo();
+ E->TSI = readTypeSourceInfo();
}
void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {
VisitExpr(E);
unsigned NumCaptures = Record.readInt();
assert(NumCaptures == E->NumCaptures);(void)NumCaptures;
- E->IntroducerRange = ReadSourceRange();
+ E->IntroducerRange = readSourceRange();
E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record.readInt());
- E->CaptureDefaultLoc = ReadSourceLocation();
+ E->CaptureDefaultLoc = readSourceLocation();
E->ExplicitParams = Record.readInt();
E->ExplicitResultType = Record.readInt();
- E->ClosingBrace = ReadSourceLocation();
+ E->ClosingBrace = readSourceLocation();
// Read capture initializers.
for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
VisitExplicitCastExpr(E);
- SourceRange R = ReadSourceRange();
+ SourceRange R = readSourceRange();
E->Loc = R.getBegin();
E->RParenLoc = R.getEnd();
- R = ReadSourceRange();
+ R = readSourceRange();
E->AngleBrackets = R;
}
void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
VisitExplicitCastExpr(E);
- E->setLParenLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->setLParenLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *E) {
VisitExplicitCastExpr(E);
- E->KWLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
+ E->KWLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
}
void ASTStmtReader::VisitUserDefinedLiteral(UserDefinedLiteral *E) {
VisitCallExpr(E);
- E->UDSuffixLoc = ReadSourceLocation();
+ E->UDSuffixLoc = readSourceLocation();
}
void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
VisitExpr(E);
E->setValue(Record.readInt());
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
}
void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
VisitExpr(E);
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
}
void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
VisitExpr(E);
- E->setSourceRange(ReadSourceRange());
+ E->setSourceRange(readSourceRange());
if (E->isTypeOperand()) { // typeid(int)
E->setTypeOperandSourceInfo(
- GetTypeSourceInfo());
+ readTypeSourceInfo());
return;
}
void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
VisitExpr(E);
- E->setLocation(ReadSourceLocation());
+ E->setLocation(readSourceLocation());
E->setImplicit(Record.readInt());
}
void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
VisitExpr(E);
- E->CXXThrowExprBits.ThrowLoc = ReadSourceLocation();
+ E->CXXThrowExprBits.ThrowLoc = readSourceLocation();
E->Operand = Record.readSubExpr();
E->CXXThrowExprBits.IsThrownVariableInScope = Record.readInt();
}
void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
VisitExpr(E);
- E->Param = ReadDeclAs<ParmVarDecl>();
- E->UsedContext = ReadDeclAs<DeclContext>();
- E->CXXDefaultArgExprBits.Loc = ReadSourceLocation();
+ E->Param = readDeclAs<ParmVarDecl>();
+ E->UsedContext = readDeclAs<DeclContext>();
+ E->CXXDefaultArgExprBits.Loc = readSourceLocation();
}
void ASTStmtReader::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
VisitExpr(E);
- E->Field = ReadDeclAs<FieldDecl>();
- E->UsedContext = ReadDeclAs<DeclContext>();
- E->CXXDefaultInitExprBits.Loc = ReadSourceLocation();
+ E->Field = readDeclAs<FieldDecl>();
+ E->UsedContext = readDeclAs<DeclContext>();
+ E->CXXDefaultInitExprBits.Loc = readSourceLocation();
}
void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
VisitExpr(E);
- E->TypeInfo = GetTypeSourceInfo();
- E->CXXScalarValueInitExprBits.RParenLoc = ReadSourceLocation();
+ E->TypeInfo = readTypeSourceInfo();
+ E->CXXScalarValueInitExprBits.RParenLoc = readSourceLocation();
}
void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
(void)HasInit;
(void)NumPlacementArgs;
- E->setOperatorNew(ReadDeclAs<FunctionDecl>());
- E->setOperatorDelete(ReadDeclAs<FunctionDecl>());
- E->AllocatedTypeInfo = GetTypeSourceInfo();
+ E->setOperatorNew(readDeclAs<FunctionDecl>());
+ E->setOperatorDelete(readDeclAs<FunctionDecl>());
+ E->AllocatedTypeInfo = readTypeSourceInfo();
if (IsParenTypeId)
- E->getTrailingObjects<SourceRange>()[0] = ReadSourceRange();
- E->Range = ReadSourceRange();
- E->DirectInitRange = ReadSourceRange();
+ E->getTrailingObjects<SourceRange>()[0] = readSourceRange();
+ E->Range = readSourceRange();
+ E->DirectInitRange = readSourceRange();
// Install all the subexpressions.
for (CXXNewExpr::raw_arg_iterator I = E->raw_arg_begin(),
E->CXXDeleteExprBits.ArrayForm = Record.readInt();
E->CXXDeleteExprBits.ArrayFormAsWritten = Record.readInt();
E->CXXDeleteExprBits.UsualArrayDeleteWantsSize = Record.readInt();
- E->OperatorDelete = ReadDeclAs<FunctionDecl>();
+ E->OperatorDelete = readDeclAs<FunctionDecl>();
E->Argument = Record.readSubExpr();
- E->CXXDeleteExprBits.Loc = ReadSourceLocation();
+ E->CXXDeleteExprBits.Loc = readSourceLocation();
}
void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
E->Base = Record.readSubExpr();
E->IsArrow = Record.readInt();
- E->OperatorLoc = ReadSourceLocation();
+ E->OperatorLoc = readSourceLocation();
E->QualifierLoc = Record.readNestedNameSpecifierLoc();
- E->ScopeType = GetTypeSourceInfo();
- E->ColonColonLoc = ReadSourceLocation();
- E->TildeLoc = ReadSourceLocation();
+ E->ScopeType = readTypeSourceInfo();
+ E->ColonColonLoc = readSourceLocation();
+ E->TildeLoc = readSourceLocation();
- IdentifierInfo *II = Record.getIdentifierInfo();
+ IdentifierInfo *II = Record.readIdentifier();
if (II)
- E->setDestroyedType(II, ReadSourceLocation());
+ E->setDestroyedType(II, readSourceLocation());
else
- E->setDestroyedType(GetTypeSourceInfo());
+ E->setDestroyedType(readTypeSourceInfo());
}
void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
assert(NumObjects == E->getNumObjects());
for (unsigned i = 0; i != NumObjects; ++i)
E->getTrailingObjects<BlockDecl *>()[i] =
- ReadDeclAs<BlockDecl>();
+ readDeclAs<BlockDecl>();
E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record.readInt();
E->SubExpr = Record.readSubExpr();
"Wrong NumTemplateArgs!");
E->CXXDependentScopeMemberExprBits.IsArrow = Record.readInt();
- E->CXXDependentScopeMemberExprBits.OperatorLoc = ReadSourceLocation();
+ E->CXXDependentScopeMemberExprBits.OperatorLoc = readSourceLocation();
E->BaseType = Record.readType();
E->QualifierLoc = Record.readNestedNameSpecifierLoc();
E->Base = Record.readSubExpr();
if (HasFirstQualifierFoundInScope)
- *E->getTrailingObjects<NamedDecl *>() = ReadDeclAs<NamedDecl>();
+ *E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
- ReadDeclarationNameInfo(E->MemberNameInfo);
+ E->MemberNameInfo = Record.readDeclarationNameInfo();
}
void
/*NumTemplateArgs=*/Record.readInt());
E->QualifierLoc = Record.readNestedNameSpecifierLoc();
- ReadDeclarationNameInfo(E->NameInfo);
+ E->NameInfo = Record.readDeclarationNameInfo();
}
void
Record.skipInts(1);
for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
E->setArg(I, Record.readSubExpr());
- E->TSI = GetTypeSourceInfo();
- E->setLParenLoc(ReadSourceLocation());
- E->setRParenLoc(ReadSourceLocation());
+ E->TSI = readTypeSourceInfo();
+ E->setLParenLoc(readSourceLocation());
+ E->setRParenLoc(readSourceLocation());
}
void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
UnresolvedSet<8> Decls;
for (unsigned I = 0; I != NumResults; ++I) {
- auto *D = ReadDeclAs<NamedDecl>();
+ auto *D = readDeclAs<NamedDecl>();
auto AS = (AccessSpecifier)Record.readInt();
Decls.addDecl(D, AS);
}
Results[I] = (Iter + I).getPair();
}
- ReadDeclarationNameInfo(E->NameInfo);
+ E->NameInfo = Record.readDeclarationNameInfo();
E->QualifierLoc = Record.readNestedNameSpecifierLoc();
}
E->UnresolvedMemberExprBits.HasUnresolvedUsing = Record.readInt();
E->Base = Record.readSubExpr();
E->BaseType = Record.readType();
- E->OperatorLoc = ReadSourceLocation();
+ E->OperatorLoc = readSourceLocation();
}
void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
VisitOverloadExpr(E);
E->UnresolvedLookupExprBits.RequiresADL = Record.readInt();
E->UnresolvedLookupExprBits.Overloaded = Record.readInt();
- E->NamingClass = ReadDeclAs<CXXRecordDecl>();
+ E->NamingClass = readDeclAs<CXXRecordDecl>();
}
void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
E->TypeTraitExprBits.NumArgs = Record.readInt();
E->TypeTraitExprBits.Kind = Record.readInt();
E->TypeTraitExprBits.Value = Record.readInt();
- SourceRange Range = ReadSourceRange();
+ SourceRange Range = readSourceRange();
E->Loc = Range.getBegin();
E->RParenLoc = Range.getEnd();
auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
- Args[I] = GetTypeSourceInfo();
+ Args[I] = readTypeSourceInfo();
}
void ASTStmtReader::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
VisitExpr(E);
E->ATT = (ArrayTypeTrait)Record.readInt();
E->Value = (unsigned int)Record.readInt();
- SourceRange Range = ReadSourceRange();
+ SourceRange Range = readSourceRange();
E->Loc = Range.getBegin();
E->RParen = Range.getEnd();
- E->QueriedType = GetTypeSourceInfo();
+ E->QueriedType = readTypeSourceInfo();
E->Dimension = Record.readSubExpr();
}
VisitExpr(E);
E->ET = (ExpressionTrait)Record.readInt();
E->Value = (bool)Record.readInt();
- SourceRange Range = ReadSourceRange();
+ SourceRange Range = readSourceRange();
E->QueriedExpression = Record.readSubExpr();
E->Loc = Range.getBegin();
E->RParen = Range.getEnd();
void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
VisitExpr(E);
E->CXXNoexceptExprBits.Value = Record.readInt();
- E->Range = ReadSourceRange();
+ E->Range = readSourceRange();
E->Operand = Record.readSubExpr();
}
void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) {
VisitExpr(E);
- E->EllipsisLoc = ReadSourceLocation();
+ E->EllipsisLoc = readSourceLocation();
E->NumExpansions = Record.readInt();
E->Pattern = Record.readSubExpr();
}
void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
VisitExpr(E);
unsigned NumPartialArgs = Record.readInt();
- E->OperatorLoc = ReadSourceLocation();
- E->PackLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
+ E->OperatorLoc = readSourceLocation();
+ E->PackLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
E->Pack = Record.readDeclAs<NamedDecl>();
if (E->isPartiallySubstituted()) {
assert(E->Length == NumPartialArgs);
void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
SubstNonTypeTemplateParmExpr *E) {
VisitExpr(E);
- E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
- E->SubstNonTypeTemplateParmExprBits.NameLoc = ReadSourceLocation();
+ E->Param = readDeclAs<NonTypeTemplateParmDecl>();
+ E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
E->Replacement = Record.readSubExpr();
}
void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
SubstNonTypeTemplateParmPackExpr *E) {
VisitExpr(E);
- E->Param = ReadDeclAs<NonTypeTemplateParmDecl>();
+ E->Param = readDeclAs<NonTypeTemplateParmDecl>();
TemplateArgument ArgPack = Record.readTemplateArgument();
if (ArgPack.getKind() != TemplateArgument::Pack)
return;
E->Arguments = ArgPack.pack_begin();
E->NumArguments = ArgPack.pack_size();
- E->NameLoc = ReadSourceLocation();
+ E->NameLoc = readSourceLocation();
}
void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
VisitExpr(E);
E->NumParameters = Record.readInt();
- E->ParamPack = ReadDeclAs<ParmVarDecl>();
- E->NameLoc = ReadSourceLocation();
+ E->ParamPack = readDeclAs<ParmVarDecl>();
+ E->NameLoc = readSourceLocation();
auto **Parms = E->getTrailingObjects<VarDecl *>();
for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
- Parms[i] = ReadDeclAs<VarDecl>();
+ Parms[i] = readDeclAs<VarDecl>();
}
void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) {
VisitExpr(E);
- E->LParenLoc = ReadSourceLocation();
- E->EllipsisLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
+ E->LParenLoc = readSourceLocation();
+ E->EllipsisLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
E->NumExpansions = Record.readInt();
E->SubExprs[0] = Record.readSubExpr();
E->SubExprs[1] = Record.readSubExpr();
void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
VisitExpr(E);
E->SourceExpr = Record.readSubExpr();
- E->OpaqueValueExprBits.Loc = ReadSourceLocation();
+ E->OpaqueValueExprBits.Loc = readSourceLocation();
E->setIsUnique(Record.readInt());
}
E->IsArrow = (Record.readInt() != 0);
E->BaseExpr = Record.readSubExpr();
E->QualifierLoc = Record.readNestedNameSpecifierLoc();
- E->MemberLoc = ReadSourceLocation();
- E->TheDecl = ReadDeclAs<MSPropertyDecl>();
+ E->MemberLoc = readSourceLocation();
+ E->TheDecl = readDeclAs<MSPropertyDecl>();
}
void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
VisitExpr(E);
E->setBase(Record.readSubExpr());
E->setIdx(Record.readSubExpr());
- E->setRBracketLoc(ReadSourceLocation());
+ E->setRBracketLoc(readSourceLocation());
}
void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
VisitExpr(E);
- E->setSourceRange(ReadSourceRange());
- std::string UuidStr = ReadString();
+ E->setSourceRange(readSourceRange());
+ std::string UuidStr = readString();
E->setUuidStr(StringRef(UuidStr).copy(Record.getContext()));
if (E->isTypeOperand()) { // __uuidof(ComType)
E->setTypeOperandSourceInfo(
- GetTypeSourceInfo());
+ readTypeSourceInfo());
return;
}
void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
VisitStmt(S);
- S->setLeaveLoc(ReadSourceLocation());
+ S->setLeaveLoc(readSourceLocation());
}
void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {
VisitStmt(S);
- S->Loc = ReadSourceLocation();
+ S->Loc = readSourceLocation();
S->Children[SEHExceptStmt::FILTER_EXPR] = Record.readSubStmt();
S->Children[SEHExceptStmt::BLOCK] = Record.readSubStmt();
}
void ASTStmtReader::VisitSEHFinallyStmt(SEHFinallyStmt *S) {
VisitStmt(S);
- S->Loc = ReadSourceLocation();
+ S->Loc = readSourceLocation();
S->Block = Record.readSubStmt();
}
void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
VisitStmt(S);
S->IsCXXTry = Record.readInt();
- S->TryLoc = ReadSourceLocation();
+ S->TryLoc = readSourceLocation();
S->Children[SEHTryStmt::TRY] = Record.readSubStmt();
S->Children[SEHTryStmt::HANDLER] = Record.readSubStmt();
}
//===----------------------------------------------------------------------===//
void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
VisitExpr(E);
- E->BuiltinLoc = ReadSourceLocation();
- E->RParenLoc = ReadSourceLocation();
+ E->BuiltinLoc = readSourceLocation();
+ E->RParenLoc = readSourceLocation();
E->SrcExpr = Record.readSubExpr();
}
//===----------------------------------------------------------------------===//
void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
- E->setLocStart(ReadSourceLocation());
- E->setLocEnd(ReadSourceLocation());
+ E->setLocStart(readSourceLocation());
+ E->setLocEnd(readSourceLocation());
OMPClauseReader ClauseReader(Record);
SmallVector<OMPClause *, 5> Clauses;
for (unsigned i = 0; i < E->getNumClauses(); ++i)
// The NumClauses field was read in ReadStmtFromStream.
Record.skipInts(1);
VisitOMPExecutableDirective(D);
- ReadDeclarationNameInfo(D->DirName);
+ D->DirName = Record.readDeclarationNameInfo();
}
void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
return StringSwitch<std::string>(type)
.EndsWith("Decl *", "Record.GetLocalDeclAs<"
+ std::string(type, 0, type.size()-1) + ">(Record.readInt())")
- .Case("TypeSourceInfo *", "Record.getTypeSourceInfo()")
+ .Case("TypeSourceInfo *", "Record.readTypeSourceInfo()")
.Case("Expr *", "Record.readExpr()")
- .Case("IdentifierInfo *", "Record.getIdentifierInfo()")
+ .Case("IdentifierInfo *", "Record.readIdentifier()")
.Case("StringRef", "Record.readString()")
.Case("ParamIdx", "ParamIdx::deserialize(Record.readInt())")
.Default("Record.readInt()");
OS << " " << getLowerName() << "Ptr = Record.readExpr();\n";
OS << " else\n";
OS << " " << getLowerName()
- << "Ptr = Record.getTypeSourceInfo();\n";
+ << "Ptr = Record.readTypeSourceInfo();\n";
}
void writePCHWrite(raw_ostream &OS) const override {