diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-14 21:55:33 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-14 21:55:33 +0000 |
commit | 17fc223395d51be582fc666bb6ea21bd1dff26dc (patch) | |
tree | d60009defec4b31deb1dbff99b49f1695a7cef72 /lib/Frontend/PCHWriter.cpp | |
parent | e40c295d017a8f75a945fe9ed2aa9d8bb7a7341a (diff) |
Add PCH support for PredefinedExpr and FloatingLiteral expressions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriter.cpp')
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index 1cf98cea9c..20aee9c441 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -25,6 +25,8 @@ #include "clang/Basic/SourceManager.h" #include "clang/Basic/SourceManagerInternals.h" #include "clang/Basic/TargetInfo.h" +#include "llvm/ADT/APFloat.h" +#include "llvm/ADT/APInt.h" #include "llvm/Bitcode/BitstreamWriter.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" @@ -442,8 +444,10 @@ namespace { : Writer(Writer), Record(Record) { } void VisitExpr(Expr *E); + void VisitPredefinedExpr(PredefinedExpr *E); void VisitDeclRefExpr(DeclRefExpr *E); void VisitIntegerLiteral(IntegerLiteral *E); + void VisitFloatingLiteral(FloatingLiteral *E); void VisitCharacterLiteral(CharacterLiteral *E); }; } @@ -454,6 +458,13 @@ void PCHStmtWriter::VisitExpr(Expr *E) { Record.push_back(E->isValueDependent()); } +void PCHStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) { + VisitExpr(E); + Writer.AddSourceLocation(E->getLocation(), Record); + Record.push_back(E->getIdentType()); // FIXME: stable encoding + Code = pch::EXPR_PREDEFINED; +} + void PCHStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) { VisitExpr(E); Writer.AddDeclRef(E->getDecl(), Record); @@ -468,6 +479,14 @@ void PCHStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) { Code = pch::EXPR_INTEGER_LITERAL; } +void PCHStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) { + VisitExpr(E); + Writer.AddAPFloat(E->getValue(), Record); + Record.push_back(E->isExact()); + Writer.AddSourceLocation(E->getLocation(), Record); + Code = pch::EXPR_FLOATING_LITERAL; +} + void PCHStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) { VisitExpr(E); Record.push_back(E->getValue()); @@ -1120,6 +1139,10 @@ void PCHWriter::AddAPSInt(const llvm::APSInt &Value, RecordData &Record) { AddAPInt(Value, Record); } +void PCHWriter::AddAPFloat(const llvm::APFloat &Value, RecordData &Record) { + AddAPInt(Value.bitcastToAPInt(), Record); +} + void PCHWriter::AddIdentifierRef(const IdentifierInfo *II, RecordData &Record) { if (II == 0) { Record.push_back(0); |