PCH support for GNU statement expressions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69370 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 8928b06..e474dc7 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -289,6 +289,7 @@
unsigned VisitImplicitValueInitExpr(ImplicitValueInitExpr *E);
unsigned VisitVAArgExpr(VAArgExpr *E);
unsigned VisitAddrLabelExpr(AddrLabelExpr *E);
+ unsigned VisitStmtExpr(StmtExpr *E);
unsigned VisitTypesCompatibleExpr(TypesCompatibleExpr *E);
unsigned VisitChooseExpr(ChooseExpr *E);
unsigned VisitGNUNullExpr(GNUNullExpr *E);
@@ -749,6 +750,14 @@
return 0;
}
+unsigned PCHStmtReader::VisitStmtExpr(StmtExpr *E) {
+ VisitExpr(E);
+ E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+ E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+ E->setSubStmt(cast_or_null<CompoundStmt>(StmtStack.back()));
+ return 1;
+}
+
unsigned PCHStmtReader::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
VisitExpr(E);
E->setArgType1(Reader.GetType(Record[Idx++]));
@@ -2359,6 +2368,10 @@
S = new (Context) AddrLabelExpr(Empty);
break;
+ case pch::EXPR_STMT:
+ S = new (Context) StmtExpr(Empty);
+ break;
+
case pch::EXPR_TYPES_COMPATIBLE:
S = new (Context) TypesCompatibleExpr(Empty);
break;
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index 4bbaaa0..14e979f 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -491,6 +491,7 @@
void VisitImplicitValueInitExpr(ImplicitValueInitExpr *E);
void VisitVAArgExpr(VAArgExpr *E);
void VisitAddrLabelExpr(AddrLabelExpr *E);
+ void VisitStmtExpr(StmtExpr *E);
void VisitTypesCompatibleExpr(TypesCompatibleExpr *E);
void VisitChooseExpr(ChooseExpr *E);
void VisitGNUNullExpr(GNUNullExpr *E);
@@ -896,6 +897,14 @@
Code = pch::EXPR_ADDR_LABEL;
}
+void PCHStmtWriter::VisitStmtExpr(StmtExpr *E) {
+ VisitExpr(E);
+ Writer.WriteSubStmt(E->getSubStmt());
+ Writer.AddSourceLocation(E->getLParenLoc(), Record);
+ Writer.AddSourceLocation(E->getRParenLoc(), Record);
+ Code = pch::EXPR_STMT;
+}
+
void PCHStmtWriter::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
VisitExpr(E);
Writer.AddTypeRef(E->getArgType1(), Record);