diff options
Diffstat (limited to 'clang/lib/Serialization/ASTReaderStmt.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderStmt.cpp | 675 |
1 files changed, 354 insertions, 321 deletions
diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index a275e0c305799..f558c26b5f1e8 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -11,7 +11,8 @@ // //===----------------------------------------------------------------------===// -#include "clang/Serialization/ASTReader.h" +#include "clang/Serialization/ASTRecordReader.h" +#include "clang/AST/ASTConcept.h" #include "clang/AST/ASTContext.h" #include "clang/AST/AttrIterator.h" #include "clang/AST/Decl.h" @@ -66,45 +67,34 @@ using namespace serialization; namespace clang { class ASTStmtReader : public StmtVisitor<ASTStmtReader> { - friend class OMPClauseReader; - 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) {} @@ -137,10 +127,10 @@ namespace clang { 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); @@ -153,7 +143,7 @@ void ASTStmtReader::VisitStmt(Stmt *S) { void ASTStmtReader::VisitNullStmt(NullStmt *S) { VisitStmt(S); - S->setSemiLoc(ReadSourceLocation()); + S->setSemiLoc(readSourceLocation()); S->NullStmtBits.HasLeadingEmptyMacro = Record.readInt(); } @@ -164,15 +154,15 @@ void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) { 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) { @@ -182,7 +172,7 @@ void ASTStmtReader::VisitCaseStmt(CaseStmt *S) { S->setSubStmt(Record.readSubStmt()); if (CaseStmtIsGNURange) { S->setRHS(Record.readSubExpr()); - S->setEllipsisLoc(ReadSourceLocation()); + S->setEllipsisLoc(readSourceLocation()); } } @@ -193,11 +183,11 @@ void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) { 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) { @@ -213,7 +203,7 @@ 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) { @@ -229,13 +219,13 @@ 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) { @@ -252,9 +242,9 @@ 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; ) { @@ -276,54 +266,54 @@ void ASTStmtReader::VisitWhileStmt(WhileStmt *S) { 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) { @@ -333,25 +323,25 @@ 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()))); @@ -363,7 +353,7 @@ void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { 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()); } @@ -371,7 +361,7 @@ void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { 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(); @@ -384,7 +374,7 @@ void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) { 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()); } @@ -407,10 +397,10 @@ void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) { 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; @@ -428,7 +418,7 @@ void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) { 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()); } @@ -442,7 +432,7 @@ void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) { 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()); } @@ -470,7 +460,7 @@ void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) { 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()); @@ -479,7 +469,7 @@ void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) { 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()); @@ -487,7 +477,7 @@ void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) { void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) { VisitExpr(E); - E->KeywordLoc = ReadSourceLocation(); + E->KeywordLoc = readSourceLocation(); for (auto &SubExpr: E->SubExprs) SubExpr = Record.readSubStmt(); } @@ -495,9 +485,9 @@ void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) { 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(), @@ -511,10 +501,10 @@ void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) { // 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(); } } @@ -553,7 +543,7 @@ void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) { 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())); } @@ -576,27 +566,27 @@ void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) { 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()); } @@ -606,7 +596,7 @@ void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) { 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) { @@ -639,7 +629,7 @@ void ASTStmtReader::VisitStringLiteral(StringLiteral *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(); @@ -650,14 +640,14 @@ void ASTStmtReader::VisitStringLiteral(StringLiteral *E) { 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()); } @@ -667,15 +657,15 @@ void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) { 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()); } @@ -685,13 +675,13 @@ void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) { 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)); @@ -699,13 +689,13 @@ void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) { 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: { @@ -728,10 +718,10 @@ void ASTStmtReader::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) { 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( @@ -740,23 +730,40 @@ void ASTStmtReader::VisitConceptSpecializationExpr( unsigned NumTemplateArgs = Record.readInt(); E->NestedNameSpec = Record.readNestedNameSpecifierLoc(); E->TemplateKWLoc = Record.readSourceLocation(); - E->ConceptNameLoc = Record.readSourceLocation(); - E->FoundDecl = ReadDeclAs<NamedDecl>(); - E->NamedConcept.setPointer(ReadDeclAs<ConceptDecl>()); - const ASTTemplateArgumentListInfo *ArgsAsWritten = - Record.readASTTemplateArgumentListInfo(); + E->ConceptName = Record.readDeclarationNameInfo(); + E->NamedConcept = readDeclAs<ConceptDecl>(); + E->ArgsAsWritten = Record.readASTTemplateArgumentListInfo(); llvm::SmallVector<TemplateArgument, 4> Args; for (unsigned I = 0; I < NumTemplateArgs; ++I) Args.push_back(Record.readTemplateArgument()); - E->setTemplateArguments(ArgsAsWritten, Args); - E->NamedConcept.setInt(Record.readInt() == 1); + E->setTemplateArguments(Args); + ConstraintSatisfaction Satisfaction; + Satisfaction.IsSatisfied = Record.readInt(); + if (!Satisfaction.IsSatisfied) { + unsigned NumDetailRecords = Record.readInt(); + for (unsigned i = 0; i != NumDetailRecords; ++i) { + Expr *ConstraintExpr = Record.readExpr(); + bool IsDiagnostic = Record.readInt(); + if (IsDiagnostic) { + SourceLocation DiagLocation = Record.readSourceLocation(); + std::string DiagMessage = Record.readString(); + Satisfaction.Details.emplace_back( + ConstraintExpr, new (Record.getContext()) + ConstraintSatisfaction::SubstitutionDiagnostic{ + DiagLocation, DiagMessage}); + } else + Satisfaction.Details.emplace_back(ConstraintExpr, Record.readExpr()); + } + } + E->Satisfaction = ASTConstraintSatisfaction::Create(Record.getContext(), + Satisfaction); } void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) { VisitExpr(E); E->setLHS(Record.readSubExpr()); E->setRHS(Record.readSubExpr()); - E->setRBracketLoc(ReadSourceLocation()); + E->setRBracketLoc(readSourceLocation()); } void ASTStmtReader::VisitOMPArraySectionExpr(OMPArraySectionExpr *E) { @@ -764,15 +771,15 @@ 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()); @@ -793,7 +800,7 @@ void ASTStmtReader::VisitMemberExpr(MemberExpr *E) { 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; @@ -830,8 +837,8 @@ void ASTStmtReader::VisitMemberExpr(MemberExpr *E) { 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()); } @@ -844,8 +851,8 @@ VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) { void ASTStmtReader::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) { VisitExplicitCastExpr(E); - E->LParenLoc = ReadSourceLocation(); - E->BridgeKeywordLoc = ReadSourceLocation(); + E->LParenLoc = readSourceLocation(); + E->BridgeKeywordLoc = readSourceLocation(); E->Kind = Record.readInt(); } @@ -868,7 +875,7 @@ void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) { 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())); } @@ -883,8 +890,8 @@ void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) { 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 @@ -895,8 +902,8 @@ ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) { 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) { @@ -906,19 +913,19 @@ 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()); } @@ -926,23 +933,23 @@ void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { 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); @@ -965,16 +972,16 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) { 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); @@ -982,26 +989,26 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) { } 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; @@ -1039,32 +1046,32 @@ void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) { 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())); } @@ -1073,14 +1080,14 @@ void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) { 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) { @@ -1090,21 +1097,21 @@ 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) { @@ -1113,9 +1120,9 @@ 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 @@ -1126,7 +1133,7 @@ void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) { 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) { @@ -1151,8 +1158,8 @@ void ASTStmtReader::VisitAtomicExpr(AtomicExpr *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(); } //===----------------------------------------------------------------------===// @@ -1161,15 +1168,15 @@ void ASTStmtReader::VisitAtomicExpr(AtomicExpr *E) { 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) { @@ -1179,8 +1186,8 @@ 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) { @@ -1197,41 +1204,41 @@ 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()); @@ -1242,14 +1249,14 @@ void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { 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()); @@ -1258,18 +1265,18 @@ void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { 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) { @@ -1287,13 +1294,13 @@ 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; } @@ -1302,19 +1309,19 @@ void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) { 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) { @@ -1322,28 +1329,28 @@ 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) { @@ -1357,26 +1364,26 @@ 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) { @@ -1393,8 +1400,8 @@ 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(); } @@ -1402,7 +1409,7 @@ void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) { 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(); @@ -1410,10 +1417,10 @@ void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) { 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()); @@ -1426,10 +1433,10 @@ void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) { 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(); } @@ -1459,9 +1466,9 @@ void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { 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()); @@ -1469,27 +1476,27 @@ void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { 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(), @@ -1506,10 +1513,10 @@ ASTStmtReader::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) { 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; } @@ -1531,38 +1538,38 @@ void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) { 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; } @@ -1572,29 +1579,29 @@ void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) { 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) { @@ -1605,8 +1612,8 @@ 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) { @@ -1631,13 +1638,13 @@ 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(), @@ -1652,9 +1659,9 @@ void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) { 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) { @@ -1662,17 +1669,17 @@ 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) { @@ -1682,7 +1689,7 @@ 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(); @@ -1711,15 +1718,15 @@ void ASTStmtReader::VisitCXXDependentScopeMemberExpr( "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 @@ -1733,7 +1740,7 @@ ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) { /*NumTemplateArgs=*/Record.readInt()); E->QualifierLoc = Record.readNestedNameSpecifierLoc(); - ReadDeclarationNameInfo(E->NameInfo); + E->NameInfo = Record.readDeclarationNameInfo(); } void @@ -1744,9 +1751,9 @@ ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) { 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) { @@ -1769,7 +1776,7 @@ 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); } @@ -1780,7 +1787,7 @@ void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) { Results[I] = (Iter + I).getPair(); } - ReadDeclarationNameInfo(E->NameInfo); + E->NameInfo = Record.readDeclarationNameInfo(); E->QualifierLoc = Record.readNestedNameSpecifierLoc(); } @@ -1790,14 +1797,14 @@ void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) { 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) { @@ -1805,23 +1812,23 @@ 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(); } @@ -1829,7 +1836,7 @@ void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) { 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(); @@ -1838,13 +1845,13 @@ void ASTStmtReader::VisitExpressionTraitExpr(ExpressionTraitExpr *E) { 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(); } @@ -1852,9 +1859,9 @@ void ASTStmtReader::VisitPackExpansionExpr(PackExpansionExpr *E) { 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); @@ -1870,47 +1877,48 @@ void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) { 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) { VisitExpr(E); - E->State = Record.readSubExpr(); - auto *VD = ReadDeclAs<ValueDecl>(); - unsigned ManglingNumber = Record.readInt(); - E->setExtendingDecl(VD, ManglingNumber); + bool HasMaterialzedDecl = Record.readInt(); + if (HasMaterialzedDecl) + E->State = cast<LifetimeExtendedTemporaryDecl>(Record.readDecl()); + else + E->State = Record.readSubExpr(); } 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(); @@ -1920,7 +1928,7 @@ void ASTStmtReader::VisitCXXFoldExpr(CXXFoldExpr *E) { void ASTStmtReader::VisitOpaqueValueExpr(OpaqueValueExpr *E) { VisitExpr(E); E->SourceExpr = Record.readSubExpr(); - E->OpaqueValueExprBits.Loc = ReadSourceLocation(); + E->OpaqueValueExprBits.Loc = readSourceLocation(); E->setIsUnique(Record.readInt()); } @@ -1936,25 +1944,25 @@ void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) { 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; } @@ -1964,26 +1972,26 @@ void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) { 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(); } @@ -2002,8 +2010,8 @@ void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) { //===----------------------------------------------------------------------===// void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) { VisitExpr(E); - E->BuiltinLoc = ReadSourceLocation(); - E->RParenLoc = ReadSourceLocation(); + E->BuiltinLoc = readSourceLocation(); + E->RParenLoc = readSourceLocation(); E->SrcExpr = Record.readSubExpr(); } @@ -2012,12 +2020,11 @@ void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) { //===----------------------------------------------------------------------===// void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) { - E->setLocStart(ReadSourceLocation()); - E->setLocEnd(ReadSourceLocation()); - OMPClauseReader ClauseReader(Record); + E->setLocStart(readSourceLocation()); + E->setLocEnd(readSourceLocation()); SmallVector<OMPClause *, 5> Clauses; for (unsigned i = 0; i < E->getNumClauses(); ++i) - Clauses.push_back(ClauseReader.readClause()); + Clauses.push_back(Record.readOMPClause()); E->setClauses(Clauses); if (E->hasAssociatedStmt()) E->setAssociatedStmt(Record.readSubStmt()); @@ -2151,7 +2158,7 @@ void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) { // The NumClauses field was read in ReadStmtFromStream. Record.skipInts(1); VisitOMPExecutableDirective(D); - ReadDeclarationNameInfo(D->DirName); + D->DirName = Record.readDeclarationNameInfo(); } void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) { @@ -2164,6 +2171,14 @@ void ASTStmtReader::VisitOMPParallelForSimdDirective( VisitOMPLoopDirective(D); } +void ASTStmtReader::VisitOMPParallelMasterDirective( + OMPParallelMasterDirective *D) { + VisitStmt(D); + // The NumClauses field was read in ReadStmtFromStream. + Record.skipInts(1); + VisitOMPExecutableDirective(D); +} + void ASTStmtReader::VisitOMPParallelSectionsDirective( OMPParallelSectionsDirective *D) { VisitStmt(D); @@ -2316,6 +2331,11 @@ void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective( VisitOMPLoopDirective(D); } +void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective( + OMPParallelMasterTaskLoopSimdDirective *D) { + VisitOMPLoopDirective(D); +} + void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) { VisitOMPLoopDirective(D); } @@ -2997,6 +3017,11 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { break; } + case STMT_OMP_PARALLEL_MASTER_DIRECTIVE: + S = OMPParallelMasterDirective::CreateEmpty( + Context, Record[ASTStmtReader::NumStmtFields], Empty); + break; + case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE: S = OMPParallelSectionsDirective::CreateEmpty( Context, Record[ASTStmtReader::NumStmtFields], Empty); @@ -3131,6 +3156,14 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { break; } + case STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE: { + unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; + unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; + S = OMPParallelMasterTaskLoopSimdDirective::CreateEmpty( + Context, NumClauses, CollapsedNum, Empty); + break; + } + case STMT_OMP_DISTRIBUTE_DIRECTIVE: { unsigned NumClauses = Record[ASTStmtReader::NumStmtFields]; unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; |