diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-15 00:25:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-15 00:25:59 +0000 |
commit | 67fdb085b974726d682ef58b1b61b724520b406d (patch) | |
tree | d64ed96426d17b6cfeafdad0581fa6e7576267a4 /clang/lib/Frontend/PCHReader.cpp | |
parent | 046bf624b9caea2ae508b73d226938c13a67da22 (diff) | |
download | bcm5719-llvm-67fdb085b974726d682ef58b1b61b724520b406d.tar.gz bcm5719-llvm-67fdb085b974726d682ef58b1b61b724520b406d.zip |
PCH support for CStyleCastExpr and BinaryOperator expression kinds.
llvm-svn: 69119
Diffstat (limited to 'clang/lib/Frontend/PCHReader.cpp')
-rw-r--r-- | clang/lib/Frontend/PCHReader.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index 056c5d50d9b..69745ce7a31 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -239,7 +239,10 @@ namespace { unsigned VisitCharacterLiteral(CharacterLiteral *E); unsigned VisitParenExpr(ParenExpr *E); unsigned VisitCastExpr(CastExpr *E); + unsigned VisitBinaryOperator(BinaryOperator *E); unsigned VisitImplicitCastExpr(ImplicitCastExpr *E); + unsigned VisitExplicitCastExpr(ExplicitCastExpr *E); + unsigned VisitCStyleCastExpr(CStyleCastExpr *E); }; } @@ -301,12 +304,34 @@ unsigned PCHStmtReader::VisitCastExpr(CastExpr *E) { return 1; } +unsigned PCHStmtReader::VisitBinaryOperator(BinaryOperator *E) { + VisitExpr(E); + E->setLHS(ExprStack.end()[-2]); + E->setRHS(ExprStack.end()[-1]); + E->setOpcode((BinaryOperator::Opcode)Record[Idx++]); + E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); + return 2; +} + unsigned PCHStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) { VisitCastExpr(E); E->setLvalueCast(Record[Idx++]); return 1; } +unsigned PCHStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) { + VisitCastExpr(E); + E->setTypeAsWritten(Reader.GetType(Record[Idx++])); + return 1; +} + +unsigned PCHStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) { + VisitExplicitCastExpr(E); + E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); + E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); + return 1; +} + // FIXME: use the diagnostics machinery static bool Error(const char *Str) { std::fprintf(stderr, "%s\n", Str); @@ -1618,9 +1643,17 @@ Expr *PCHReader::ReadExpr() { E = new (Context) ParenExpr(Empty); break; + case pch::EXPR_BINARY_OPERATOR: + E = new (Context) BinaryOperator(Empty); + break; + case pch::EXPR_IMPLICIT_CAST: E = new (Context) ImplicitCastExpr(Empty); break; + + case pch::EXPR_CSTYLE_CAST: + E = new (Context) CStyleCastExpr(Empty); + break; } // We hit an EXPR_STOP, so we're done with this expression. |