summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-16 02:33:48 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-16 02:33:48 +0000
commit4c5cd335278c4fca64c15cf7bb465bb048eb8b1c (patch)
treeb354878a3a22bc0ee0686d051154231bb9b22e99 /clang/lib/Frontend
parent653dee08849edc5f4b5575a670d3d0ed2e077f6f (diff)
downloadbcm5719-llvm-4c5cd335278c4fca64c15cf7bb465bb048eb8b1c.tar.gz
bcm5719-llvm-4c5cd335278c4fca64c15cf7bb465bb048eb8b1c.zip
PCH support for CompoundLiteralExpr. This is the last C expression
that does not require PCH support for statements. Only AddrLabelExpr, StmtExpr, and BlockExpr remain (for C). llvm-svn: 69255
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/PCHReader.cpp13
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp9
2 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index 2da35a09d64..e24a155146c 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/lib/Frontend/PCHReader.cpp
@@ -257,6 +257,7 @@ namespace {
unsigned VisitImplicitCastExpr(ImplicitCastExpr *E);
unsigned VisitExplicitCastExpr(ExplicitCastExpr *E);
unsigned VisitCStyleCastExpr(CStyleCastExpr *E);
+ unsigned VisitCompoundLiteralExpr(CompoundLiteralExpr *E);
unsigned VisitExtVectorElementExpr(ExtVectorElementExpr *E);
unsigned VisitInitListExpr(InitListExpr *E);
unsigned VisitDesignatedInitExpr(DesignatedInitExpr *E);
@@ -447,6 +448,14 @@ unsigned PCHStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
return 1;
}
+unsigned PCHStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
+ VisitExpr(E);
+ E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+ E->setInitializer(ExprStack.back());
+ E->setFileScope(Record[Idx++]);
+ return 1;
+}
+
unsigned PCHStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
VisitExpr(E);
E->setBase(ExprStack.back());
@@ -2103,6 +2112,10 @@ Expr *PCHReader::ReadExpr() {
E = new (Context) CStyleCastExpr(Empty);
break;
+ case pch::EXPR_COMPOUND_LITERAL:
+ E = new (Context) CompoundLiteralExpr(Empty);
+ break;
+
case pch::EXPR_EXT_VECTOR_ELEMENT:
E = new (Context) ExtVectorElementExpr(Empty);
break;
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index f96288864be..c89e3546bf6 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/lib/Frontend/PCHWriter.cpp
@@ -464,6 +464,7 @@ namespace {
void VisitImplicitCastExpr(ImplicitCastExpr *E);
void VisitExplicitCastExpr(ExplicitCastExpr *E);
void VisitCStyleCastExpr(CStyleCastExpr *E);
+ void VisitCompoundLiteralExpr(CompoundLiteralExpr *E);
void VisitExtVectorElementExpr(ExtVectorElementExpr *E);
void VisitInitListExpr(InitListExpr *E);
void VisitDesignatedInitExpr(DesignatedInitExpr *E);
@@ -647,6 +648,14 @@ void PCHStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
Code = pch::EXPR_CSTYLE_CAST;
}
+void PCHStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
+ VisitExpr(E);
+ Writer.AddSourceLocation(E->getLParenLoc(), Record);
+ Writer.WriteSubExpr(E->getInitializer());
+ Record.push_back(E->isFileScope());
+ Code = pch::EXPR_COMPOUND_LITERAL;
+}
+
void PCHStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
VisitExpr(E);
Writer.WriteSubExpr(E->getBase());
OpenPOWER on IntegriCloud