summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-17 00:29:51 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-17 00:29:51 +0000
commit71517c47e6dacc8944e93665d750c60f148e7580 (patch)
tree8e158688acc4342629ad733eaa30c2dfe5d1d9ba /clang/lib/Frontend/PCHReader.cpp
parenta8919d0a355aeac0d23cb6c45b5f74d92d8e4d69 (diff)
downloadbcm5719-llvm-71517c47e6dacc8944e93665d750c60f148e7580.tar.gz
bcm5719-llvm-71517c47e6dacc8944e93665d750c60f148e7580.zip
PCH support for do-while and for loops
llvm-svn: 69334
Diffstat (limited to 'clang/lib/Frontend/PCHReader.cpp')
-rw-r--r--clang/lib/Frontend/PCHReader.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index bdadd35e3f2..d2fb8ab3cbd 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/lib/Frontend/PCHReader.cpp
@@ -252,6 +252,8 @@ namespace {
unsigned VisitIfStmt(IfStmt *S);
unsigned VisitSwitchStmt(SwitchStmt *S);
unsigned VisitWhileStmt(WhileStmt *S);
+ unsigned VisitDoStmt(DoStmt *S);
+ unsigned VisitForStmt(ForStmt *S);
unsigned VisitContinueStmt(ContinueStmt *S);
unsigned VisitBreakStmt(BreakStmt *S);
unsigned VisitExpr(Expr *E);
@@ -366,6 +368,24 @@ unsigned PCHStmtReader::VisitWhileStmt(WhileStmt *S) {
return 2;
}
+unsigned PCHStmtReader::VisitDoStmt(DoStmt *S) {
+ VisitStmt(S);
+ S->setCond(cast_or_null<Expr>(StmtStack[StmtStack.size() - 2]));
+ S->setBody(StmtStack.back());
+ S->setDoLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+ return 2;
+}
+
+unsigned PCHStmtReader::VisitForStmt(ForStmt *S) {
+ VisitStmt(S);
+ S->setInit(StmtStack[StmtStack.size() - 4]);
+ S->setCond(cast_or_null<Expr>(StmtStack[StmtStack.size() - 3]));
+ S->setInc(cast_or_null<Expr>(StmtStack[StmtStack.size() - 2]));
+ S->setBody(StmtStack.back());
+ S->setForLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+ return 4;
+}
+
unsigned PCHStmtReader::VisitContinueStmt(ContinueStmt *S) {
VisitStmt(S);
S->setContinueLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
@@ -2136,6 +2156,14 @@ Stmt *PCHReader::ReadStmt() {
S = new (Context) WhileStmt(Empty);
break;
+ case pch::STMT_DO:
+ S = new (Context) DoStmt(Empty);
+ break;
+
+ case pch::STMT_FOR:
+ S = new (Context) ForStmt(Empty);
+ break;
+
case pch::STMT_CONTINUE:
S = new (Context) ContinueStmt(Empty);
break;
OpenPOWER on IntegriCloud