diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-27 05:41:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-27 05:41:06 +0000 |
commit | 52e97d1afc98cf4cf0a6cb8f43769dfd8acbab20 (patch) | |
tree | 3fbd0981d8d3127358ad9fd726bba75e6849bb98 /lib | |
parent | 698f925dedd956cf7c2d7f77ba6192eb04b31e60 (diff) |
change the interface to ReadStmt to force clients to pass a cursor in to read from.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 4 | ||||
-rw-r--r-- | lib/Frontend/PCHReaderDecl.cpp | 4 | ||||
-rw-r--r-- | lib/Frontend/PCHReaderStmt.cpp | 28 |
3 files changed, 18 insertions, 18 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 0eb3128f5b..4ea1e05b88 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -67,7 +67,7 @@ PCHReader::PCHReader(Preprocessor &PP, ASTContext &Context) PCHReader::~PCHReader() {} Expr *PCHReader::ReadExpr() { - return dyn_cast_or_null<Expr>(ReadStmt()); + return dyn_cast_or_null<Expr>(ReadStmt(Stream)); } @@ -1337,7 +1337,7 @@ Stmt *PCHReader::GetStmt(uint64_t Offset) { SavedStreamPosition SavedPosition(Stream); Stream.JumpToBit(Offset); - return ReadStmt(); + return ReadStmt(Stream); } bool PCHReader::ReadDeclsLexicallyInContext(DeclContext *DC, diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index 36ec7b9dbf..74b489512d 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -186,7 +186,7 @@ void PCHDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { if (Record[Idx++]) { // In practice, this won't be executed (since method definitions // don't occur in header files). - MD->setBody(Reader.ReadStmt()); + MD->setBody(Reader.ReadStmt(Reader.Stream)); MD->setSelfDecl(cast<ImplicitParamDecl>(Reader.GetDecl(Record[Idx++]))); MD->setCmdDecl(cast<ImplicitParamDecl>(Reader.GetDecl(Record[Idx++]))); } @@ -384,7 +384,7 @@ void PCHDeclReader::VisitFileScopeAsmDecl(FileScopeAsmDecl *AD) { void PCHDeclReader::VisitBlockDecl(BlockDecl *BD) { VisitDecl(BD); - BD->setBody(cast_or_null<CompoundStmt>(Reader.ReadStmt())); + BD->setBody(cast_or_null<CompoundStmt>(Reader.ReadStmt(Reader.Stream))); unsigned NumParams = Record[Idx++]; llvm::SmallVector<ParmVarDecl *, 16> Params; Params.reserve(NumParams); diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp index 7767bb59a4..f38af9b3c8 100644 --- a/lib/Frontend/PCHReaderStmt.cpp +++ b/lib/Frontend/PCHReaderStmt.cpp @@ -812,14 +812,14 @@ unsigned PCHStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) { } -Stmt *PCHReader::ReadStmt() { - // Within the bitstream, expressions are stored in Reverse Polish - // Notation, with each of the subexpressions preceding the - // expression they are stored in. To evaluate expressions, we - // continue reading expressions and placing them on the stack, with - // expressions having operands removing those operands from the - // stack. Evaluation terminates when we see a STMT_STOP record, and - // the single remaining expression on the stack is our result. +// Within the bitstream, expressions are stored in Reverse Polish +// Notation, with each of the subexpressions preceding the +// expression they are stored in. To evaluate expressions, we +// continue reading expressions and placing them on the stack, with +// expressions having operands removing those operands from the +// stack. Evaluation terminates when we see a STMT_STOP record, and +// the single remaining expression on the stack is our result. +Stmt *PCHReader::ReadStmt(llvm::BitstreamCursor &Cursor) { RecordData Record; unsigned Idx; llvm::SmallVector<Stmt *, 16> StmtStack; @@ -827,9 +827,9 @@ Stmt *PCHReader::ReadStmt() { Stmt::EmptyShell Empty; while (true) { - unsigned Code = Stream.ReadCode(); + unsigned Code = Cursor.ReadCode(); if (Code == llvm::bitc::END_BLOCK) { - if (Stream.ReadBlockEnd()) { + if (Cursor.ReadBlockEnd()) { Error("Error at end of Source Manager block"); return 0; } @@ -838,8 +838,8 @@ Stmt *PCHReader::ReadStmt() { if (Code == llvm::bitc::ENTER_SUBBLOCK) { // No known subblocks, always skip them. - Stream.ReadSubBlockID(); - if (Stream.SkipBlock()) { + Cursor.ReadSubBlockID(); + if (Cursor.SkipBlock()) { Error("Malformed block record"); return 0; } @@ -847,7 +847,7 @@ Stmt *PCHReader::ReadStmt() { } if (Code == llvm::bitc::DEFINE_ABBREV) { - Stream.ReadAbbrevRecord(); + Cursor.ReadAbbrevRecord(); continue; } @@ -855,7 +855,7 @@ Stmt *PCHReader::ReadStmt() { Idx = 0; Record.clear(); bool Finished = false; - switch ((pch::StmtCode)Stream.ReadRecord(Code, Record)) { + switch ((pch::StmtCode)Cursor.ReadRecord(Code, Record)) { case pch::STMT_STOP: Finished = true; break; |