diff options
Diffstat (limited to 'lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r-- | lib/Serialization/ASTWriterStmt.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp index 6f8b86edcd..2875f253d2 100644 --- a/lib/Serialization/ASTWriterStmt.cpp +++ b/lib/Serialization/ASTWriterStmt.cpp @@ -1,9 +1,8 @@ //===--- ASTWriterStmt.cpp - Statement and Expression Serialization -------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// @@ -68,6 +67,7 @@ void ASTStmtWriter::AddTemplateKWAndArgsInfo( } void ASTStmtWriter::VisitStmt(Stmt *S) { + Record.push_back(S->StmtBits.IsOMPStructuredBlock); } void ASTStmtWriter::VisitNullStmt(NullStmt *S) { @@ -969,18 +969,24 @@ void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) { void ASTStmtWriter::VisitGenericSelectionExpr(GenericSelectionExpr *E) { VisitExpr(E); - Record.push_back(E->getNumAssocs()); - - Record.AddStmt(E->getControllingExpr()); - for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) { - Record.AddTypeSourceInfo(E->getAssocTypeSourceInfo(I)); - Record.AddStmt(E->getAssocExpr(I)); - } - Record.push_back(E->isResultDependent() ? -1U : E->getResultIndex()); + Record.push_back(E->getNumAssocs()); + Record.push_back(E->ResultIndex); Record.AddSourceLocation(E->getGenericLoc()); Record.AddSourceLocation(E->getDefaultLoc()); Record.AddSourceLocation(E->getRParenLoc()); + + Stmt **Stmts = E->getTrailingObjects<Stmt *>(); + // Add 1 to account for the controlling expression which is the first + // expression in the trailing array of Stmt *. This is not needed for + // the trailing array of TypeSourceInfo *. + for (unsigned I = 0, N = E->getNumAssocs() + 1; I < N; ++I) + Record.AddStmt(Stmts[I]); + + TypeSourceInfo **TSIs = E->getTrailingObjects<TypeSourceInfo *>(); + for (unsigned I = 0, N = E->getNumAssocs(); I < N; ++I) + Record.AddTypeSourceInfo(TSIs[I]); + Code = serialization::EXPR_GENERIC_SELECTION; } @@ -1193,6 +1199,7 @@ void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) { } void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { + VisitStmt(S); Record.AddStmt(S->getCatchBody()); Record.AddDeclRef(S->getCatchParamDecl()); Record.AddSourceLocation(S->getAtCatchLoc()); @@ -1201,18 +1208,21 @@ void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { } void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { + VisitStmt(S); Record.AddStmt(S->getFinallyBody()); Record.AddSourceLocation(S->getAtFinallyLoc()); Code = serialization::STMT_OBJC_FINALLY; } void ASTStmtWriter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) { + VisitStmt(S); // FIXME: no test coverage. Record.AddStmt(S->getSubStmt()); Record.AddSourceLocation(S->getAtLoc()); Code = serialization::STMT_OBJC_AUTORELEASE_POOL; } void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { + VisitStmt(S); Record.push_back(S->getNumCatchStmts()); Record.push_back(S->getFinallyStmt() != nullptr); Record.AddStmt(S->getTryBody()); @@ -1225,6 +1235,7 @@ void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { } void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) { + VisitStmt(S); // FIXME: no test coverage. Record.AddStmt(S->getSynchExpr()); Record.AddStmt(S->getSynchBody()); Record.AddSourceLocation(S->getAtSynchronizedLoc()); @@ -1232,6 +1243,7 @@ void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) { } void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) { + VisitStmt(S); // FIXME: no test coverage. Record.AddStmt(S->getThrowExpr()); Record.AddSourceLocation(S->getThrowLoc()); Code = serialization::STMT_OBJC_AT_THROW; |