aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-17 16:34:57 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-17 16:34:57 +0000
commit0de9d8857b715c2f45c987651f4ce06d73330d93 (patch)
tree0a392290e4ca6fd486ff567d0813ec1bef93c82f /lib/Frontend/PCHWriter.cpp
parent76458501a8963fa11b91c9337a487de6871169b4 (diff)
PCH support for return statements.
Optimize PCH encoding for switch-case statements slightly, by making the switch-case numbering local to a particular statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69355 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriter.cpp')
-rw-r--r--lib/Frontend/PCHWriter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index 29c9eb81f4..91490549ea 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -458,6 +458,7 @@ namespace {
void VisitForStmt(ForStmt *S);
void VisitContinueStmt(ContinueStmt *S);
void VisitBreakStmt(BreakStmt *S);
+ void VisitReturnStmt(ReturnStmt *S);
void VisitExpr(Expr *E);
void VisitPredefinedExpr(PredefinedExpr *E);
void VisitDeclRefExpr(DeclRefExpr *E);
@@ -592,6 +593,13 @@ void PCHStmtWriter::VisitBreakStmt(BreakStmt *S) {
Code = pch::STMT_BREAK;
}
+void PCHStmtWriter::VisitReturnStmt(ReturnStmt *S) {
+ VisitStmt(S);
+ Writer.WriteSubStmt(S->getRetValue());
+ Writer.AddSourceLocation(S->getReturnLoc(), Record);
+ Code = pch::STMT_RETURN;
+}
+
void PCHStmtWriter::VisitExpr(Expr *E) {
VisitStmt(E);
Writer.AddTypeRef(E->getType(), Record);
@@ -1822,6 +1830,7 @@ void PCHWriter::FlushStmts() {
}
StmtsToEmit.clear();
+ SwitchCaseIDs.clear();
}
unsigned PCHWriter::RecordSwitchCaseID(SwitchCase *S) {