diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 39 | ||||
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 28 |
2 files changed, 67 insertions, 0 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index bd1ed1f3df..67c7dc7337 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -259,6 +259,9 @@ namespace { unsigned VisitCStyleCastExpr(CStyleCastExpr *E); unsigned VisitExtVectorElementExpr(ExtVectorElementExpr *E); unsigned VisitVAArgExpr(VAArgExpr *E); + unsigned VisitTypesCompatibleExpr(TypesCompatibleExpr *E); + unsigned VisitChooseExpr(ChooseExpr *E); + unsigned VisitGNUNullExpr(GNUNullExpr *E); }; } @@ -455,6 +458,30 @@ unsigned PCHStmtReader::VisitVAArgExpr(VAArgExpr *E) { return 1; } +unsigned PCHStmtReader::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) { + VisitExpr(E); + E->setArgType1(Reader.GetType(Record[Idx++])); + E->setArgType2(Reader.GetType(Record[Idx++])); + E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); + E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); + return 0; +} + +unsigned PCHStmtReader::VisitChooseExpr(ChooseExpr *E) { + VisitExpr(E); + E->setCond(ExprStack[ExprStack.size() - 3]); + E->setLHS(ExprStack[ExprStack.size() - 2]); + E->setRHS(ExprStack[ExprStack.size() - 1]); + E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); + E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); + return 3; +} + +unsigned PCHStmtReader::VisitGNUNullExpr(GNUNullExpr *E) { + VisitExpr(E); + E->setTokenLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); + return 0; +} // FIXME: use the diagnostics machinery static bool Error(const char *Str) { @@ -1977,6 +2004,18 @@ Expr *PCHReader::ReadExpr() { // FIXME: untested; we need function bodies first E = new (Context) VAArgExpr(Empty); break; + + case pch::EXPR_TYPES_COMPATIBLE: + E = new (Context) TypesCompatibleExpr(Empty); + break; + + case pch::EXPR_CHOOSE: + E = new (Context) ChooseExpr(Empty); + break; + + case pch::EXPR_GNU_NULL: + E = new (Context) GNUNullExpr(Empty); + break; } // We hit an EXPR_STOP, so we're done with this expression. diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index 612eb23b52..dc5aabdd5b 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -466,6 +466,9 @@ namespace { void VisitCStyleCastExpr(CStyleCastExpr *E); void VisitExtVectorElementExpr(ExtVectorElementExpr *E); void VisitVAArgExpr(VAArgExpr *E); + void VisitTypesCompatibleExpr(TypesCompatibleExpr *E); + void VisitChooseExpr(ChooseExpr *E); + void VisitGNUNullExpr(GNUNullExpr *E); }; } @@ -655,6 +658,31 @@ void PCHStmtWriter::VisitVAArgExpr(VAArgExpr *E) { Code = pch::EXPR_VA_ARG; } +void PCHStmtWriter::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) { + VisitExpr(E); + Writer.AddTypeRef(E->getArgType1(), Record); + Writer.AddTypeRef(E->getArgType2(), Record); + Writer.AddSourceLocation(E->getBuiltinLoc(), Record); + Writer.AddSourceLocation(E->getRParenLoc(), Record); + Code = pch::EXPR_TYPES_COMPATIBLE; +} + +void PCHStmtWriter::VisitChooseExpr(ChooseExpr *E) { + VisitExpr(E); + Writer.WriteSubExpr(E->getCond()); + Writer.WriteSubExpr(E->getLHS()); + Writer.WriteSubExpr(E->getRHS()); + Writer.AddSourceLocation(E->getBuiltinLoc(), Record); + Writer.AddSourceLocation(E->getRParenLoc(), Record); + Code = pch::EXPR_CHOOSE; +} + +void PCHStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) { + VisitExpr(E); + Writer.AddSourceLocation(E->getTokenLocation(), Record); + Code = pch::EXPR_GNU_NULL; +} + //===----------------------------------------------------------------------===// // PCHWriter Implementation //===----------------------------------------------------------------------===// |