diff options
Diffstat (limited to 'lib/Serialization/ASTReaderStmt.cpp')
-rw-r--r-- | lib/Serialization/ASTReaderStmt.cpp | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp index 367f75f..078ecb7 100644 --- a/lib/Serialization/ASTReaderStmt.cpp +++ b/lib/Serialization/ASTReaderStmt.cpp @@ -132,6 +132,8 @@ void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) { void ASTStmtReader::VisitSwitchCase(SwitchCase *S) { VisitStmt(S); Reader.RecordSwitchCaseID(S, Record[Idx++]); + S->setKeywordLoc(ReadSourceLocation(Record, Idx)); + S->setColonLoc(ReadSourceLocation(Record, Idx)); } void ASTStmtReader::VisitCaseStmt(CaseStmt *S) { @@ -139,16 +141,12 @@ void ASTStmtReader::VisitCaseStmt(CaseStmt *S) { S->setLHS(Reader.ReadSubExpr()); S->setRHS(Reader.ReadSubExpr()); S->setSubStmt(Reader.ReadSubStmt()); - S->setCaseLoc(ReadSourceLocation(Record, Idx)); S->setEllipsisLoc(ReadSourceLocation(Record, Idx)); - S->setColonLoc(ReadSourceLocation(Record, Idx)); } void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) { VisitSwitchCase(S); S->setSubStmt(Reader.ReadSubStmt()); - S->setDefaultLoc(ReadSourceLocation(Record, Idx)); - S->setColonLoc(ReadSourceLocation(Record, Idx)); } void ASTStmtReader::VisitLabelStmt(LabelStmt *S) { @@ -380,8 +378,10 @@ void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) { void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) { VisitExpr(E); - E->setValue(Reader.getContext(), Reader.ReadAPFloat(Record, Idx)); + E->setRawSemantics(static_cast<Stmt::APFloatSemantics>(Record[Idx++])); E->setExact(Record[Idx++]); + E->setValue(Reader.getContext(), + Reader.ReadAPFloat(Record, E->getSemantics(), Idx)); E->setLocation(ReadSourceLocation(Record, Idx)); } @@ -528,6 +528,7 @@ void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) { VisitExpr(E); E->setBase(Reader.ReadSubExpr()); E->setIsaMemberLoc(ReadSourceLocation(Record, Idx)); + E->setOpLoc(ReadSourceLocation(Record, Idx)); E->setArrow(Record[Idx++]); } @@ -892,6 +893,7 @@ void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { VisitExpr(E); E->setDecl(ReadDeclAs<ObjCIvarDecl>(Record, Idx)); E->setLocation(ReadSourceLocation(Record, Idx)); + E->setOpLoc(ReadSourceLocation(Record, Idx)); E->setBase(Reader.ReadSubExpr()); E->setIsArrow(Record[Idx++]); E->setIsFreeIvar(Record[Idx++]); @@ -1102,6 +1104,7 @@ void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { E->setLocation(ReadSourceLocation(Record, Idx)); E->setElidable(Record[Idx++]); E->setHadMultipleCandidates(Record[Idx++]); + E->setListInitialization(Record[Idx++]); E->setRequiresZeroInitialization(Record[Idx++]); E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record[Idx++]); E->ParenRange = ReadSourceRange(Record, Idx); @@ -1146,6 +1149,8 @@ void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { SourceRange R = ReadSourceRange(Record, Idx); E->Loc = R.getBegin(); E->RParenLoc = R.getEnd(); + R = ReadSourceRange(Record, Idx); + E->AngleBrackets = R; } void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) { @@ -1596,36 +1601,27 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { Stmt::EmptyShell Empty; while (true) { - unsigned Code = Cursor.ReadCode(); - if (Code == llvm::bitc::END_BLOCK) { - if (Cursor.ReadBlockEnd()) { - Error("error at end of block in AST file"); - return 0; - } + llvm::BitstreamEntry Entry = Cursor.advanceSkippingSubblocks(); + + switch (Entry.Kind) { + case llvm::BitstreamEntry::SubBlock: // Handled for us already. + case llvm::BitstreamEntry::Error: + Error("malformed block record in AST file"); + return 0; + case llvm::BitstreamEntry::EndBlock: + goto Done; + case llvm::BitstreamEntry::Record: + // The interesting case. break; } - if (Code == llvm::bitc::ENTER_SUBBLOCK) { - // No known subblocks, always skip them. - Cursor.ReadSubBlockID(); - if (Cursor.SkipBlock()) { - Error("malformed block record in AST file"); - return 0; - } - continue; - } - - if (Code == llvm::bitc::DEFINE_ABBREV) { - Cursor.ReadAbbrevRecord(); - continue; - } Stmt *S = 0; Idx = 0; Record.clear(); bool Finished = false; bool IsStmtReference = false; - switch ((StmtCode)Cursor.ReadRecord(Code, Record)) { + switch ((StmtCode)Cursor.readRecord(Entry.ID, Record)) { case STMT_STOP: Finished = true; break; @@ -1868,7 +1864,7 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { break; case EXPR_INIT_LIST: - S = new (Context) InitListExpr(getContext(), Empty); + S = new (Context) InitListExpr(Empty); break; case EXPR_DESIGNATED_INIT: @@ -2250,11 +2246,8 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { assert(Idx == Record.size() && "Invalid deserialization of statement"); StmtStack.push_back(S); } - -#ifndef NDEBUG +Done: assert(StmtStack.size() > PrevNumStmts && "Read too many sub stmts!"); assert(StmtStack.size() == PrevNumStmts + 1 && "Extra expressions on stack!"); -#endif - return StmtStack.pop_back_val(); } |