diff options
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 48 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReaderStmt.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 13 |
4 files changed, 16 insertions, 68 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 4f12f862578..f4b7392df26 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -8167,49 +8167,29 @@ ASTReader::ReadCXXCtorInitializers(ModuleFile &F, const RecordData &Record, Expr *Init = ReadExpr(F); SourceLocation LParenLoc = ReadSourceLocation(F, Record, Idx); SourceLocation RParenLoc = ReadSourceLocation(F, Record, Idx); - bool IsWritten = Record[Idx++]; - unsigned SourceOrderOrNumArrayIndices; - SmallVector<VarDecl *, 8> Indices; - if (IsWritten) { - SourceOrderOrNumArrayIndices = Record[Idx++]; - } else { - SourceOrderOrNumArrayIndices = Record[Idx++]; - Indices.reserve(SourceOrderOrNumArrayIndices); - for (unsigned i = 0; i != SourceOrderOrNumArrayIndices; ++i) - Indices.push_back(ReadDeclAs<VarDecl>(F, Record, Idx)); - } CXXCtorInitializer *BOMInit; - if (Type == CTOR_INITIALIZER_BASE) { + if (Type == CTOR_INITIALIZER_BASE) BOMInit = new (Context) CXXCtorInitializer(Context, TInfo, IsBaseVirtual, LParenLoc, Init, RParenLoc, MemberOrEllipsisLoc); - } else if (Type == CTOR_INITIALIZER_DELEGATING) { + else if (Type == CTOR_INITIALIZER_DELEGATING) BOMInit = new (Context) CXXCtorInitializer(Context, TInfo, LParenLoc, Init, RParenLoc); - } else if (IsWritten) { - if (Member) - BOMInit = new (Context) CXXCtorInitializer( - Context, Member, MemberOrEllipsisLoc, LParenLoc, Init, RParenLoc); - else - BOMInit = new (Context) - CXXCtorInitializer(Context, IndirectMember, MemberOrEllipsisLoc, - LParenLoc, Init, RParenLoc); - } else { - if (IndirectMember) { - assert(Indices.empty() && "Indirect field improperly initialized"); - BOMInit = new (Context) - CXXCtorInitializer(Context, IndirectMember, MemberOrEllipsisLoc, - LParenLoc, Init, RParenLoc); - } else { - BOMInit = CXXCtorInitializer::Create( - Context, Member, MemberOrEllipsisLoc, LParenLoc, Init, RParenLoc, - Indices.data(), Indices.size()); - } + else if (Member) + BOMInit = new (Context) + CXXCtorInitializer(Context, Member, MemberOrEllipsisLoc, LParenLoc, + Init, RParenLoc); + else + BOMInit = new (Context) + CXXCtorInitializer(Context, IndirectMember, MemberOrEllipsisLoc, + LParenLoc, Init, RParenLoc); + + if (bool IsWritten = Record[Idx++]) { + unsigned SourceOrder = Record[Idx++]; + BOMInit->setSourceOrder(SourceOrder); } - if (IsWritten) - BOMInit->setSourceOrder(SourceOrderOrNumArrayIndices); CtorInitializers[i] = BOMInit; } diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index 461bb9f8d46..dcadfdcc503 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -1287,7 +1287,6 @@ void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) { VisitExpr(E); unsigned NumCaptures = Record[Idx++]; assert(NumCaptures == E->NumCaptures);(void)NumCaptures; - unsigned NumArrayIndexVars = Record[Idx++]; E->IntroducerRange = ReadSourceRange(Record, Idx); E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record[Idx++]); E->CaptureDefaultLoc = ReadSourceLocation(Record, Idx); @@ -1300,17 +1299,6 @@ void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) { CEnd = E->capture_init_end(); C != CEnd; ++C) *C = Reader.ReadSubExpr(); - - // Read array capture index variables. - if (NumArrayIndexVars > 0) { - unsigned *ArrayIndexStarts = E->getArrayIndexStarts(); - for (unsigned I = 0; I != NumCaptures + 1; ++I) - ArrayIndexStarts[I] = Record[Idx++]; - - VarDecl **ArrayIndexVars = E->getArrayIndexVars(); - for (unsigned I = 0; I != NumArrayIndexVars; ++I) - ArrayIndexVars[I] = ReadDeclAs<VarDecl>(Record, Idx); - } } void @@ -3875,9 +3863,7 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { case EXPR_LAMBDA: { unsigned NumCaptures = Record[ASTStmtReader::NumExprFields]; - unsigned NumArrayIndexVars = Record[ASTStmtReader::NumExprFields + 1]; - S = LambdaExpr::CreateDeserialized(Context, NumCaptures, - NumArrayIndexVars); + S = LambdaExpr::CreateDeserialized(Context, NumCaptures); break; } } diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 9c906e46b58..8b863bcecde 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -5588,13 +5588,8 @@ EmitCXXCtorInitializers(ASTWriter &W, Writer.AddSourceLocation(Init->getLParenLoc()); Writer.AddSourceLocation(Init->getRParenLoc()); Writer.push_back(Init->isWritten()); - if (Init->isWritten()) { + if (Init->isWritten()) Writer.push_back(Init->getSourceOrder()); - } else { - Writer.push_back(Init->getNumArrayIndices()); - for (auto *VD : Init->getArrayIndices()) - Writer.AddDeclRef(VD); - } } return Writer.Emit(serialization::DECL_CXX_CTOR_INITIALIZERS); diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index fbe1d843cd6..f66cc029f52 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -1257,10 +1257,6 @@ void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) { VisitExpr(E); Record.push_back(E->NumCaptures); - unsigned NumArrayIndexVars = 0; - if (E->HasArrayIndexVars) - NumArrayIndexVars = E->getArrayIndexStarts()[E->NumCaptures]; - Record.push_back(NumArrayIndexVars); Record.AddSourceRange(E->IntroducerRange); Record.push_back(E->CaptureDefault); // FIXME: stable encoding Record.AddSourceLocation(E->CaptureDefaultLoc); @@ -1275,15 +1271,6 @@ void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) { Record.AddStmt(*C); } - // Add array index variables, if any. - if (NumArrayIndexVars) { - Record.append(E->getArrayIndexStarts(), - E->getArrayIndexStarts() + E->NumCaptures + 1); - VarDecl **ArrayIndexVars = E->getArrayIndexVars(); - for (unsigned I = 0; I != NumArrayIndexVars; ++I) - Record.AddDeclRef(ArrayIndexVars[I]); - } - Code = serialization::EXPR_LAMBDA; } |