[cfe-commits] r107266 - in /cfe/trunk: include/clang/AST/Expr.h include/clang/Frontend/PCHBitCodes.h lib/Frontend/PCHReaderStmt.cpp lib/Frontend/PCHWriterStmt.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Jun 30 01:49:18 PDT 2010
Author: akirtzidis
Date: Wed Jun 30 03:49:18 2010
New Revision: 107266
URL: http://llvm.org/viewvc/llvm-project?rev=107266&view=rev
Log:
Support ParenListExpr for PCH.
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/Frontend/PCHBitCodes.h
cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
cfe/trunk/lib/Frontend/PCHWriterStmt.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=107266&r1=107265&r2=107266&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Jun 30 03:49:18 2010
@@ -3241,7 +3241,7 @@
~ParenListExpr() {}
/// \brief Build an empty paren list.
- //explicit ParenListExpr(EmptyShell Empty) : Expr(ParenListExprClass, Empty) { }
+ explicit ParenListExpr(EmptyShell Empty) : Expr(ParenListExprClass, Empty) { }
unsigned getNumExprs() const { return NumExprs; }
@@ -3271,6 +3271,9 @@
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ friend class PCHStmtReader;
+ friend class PCHStmtWriter;
};
Modified: cfe/trunk/include/clang/Frontend/PCHBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PCHBitCodes.h?rev=107266&r1=107265&r2=107266&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/PCHBitCodes.h (original)
+++ cfe/trunk/include/clang/Frontend/PCHBitCodes.h Wed Jun 30 03:49:18 2010
@@ -650,6 +650,8 @@
EXPR_CHARACTER_LITERAL,
/// \brief A ParenExpr record.
EXPR_PAREN,
+ /// \brief A ParenListExpr record.
+ EXPR_PAREN_LIST,
/// \brief A UnaryOperator record.
EXPR_UNARY_OPERATOR,
/// \brief An OffsetOfExpr record.
Modified: cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderStmt.cpp?rev=107266&r1=107265&r2=107266&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderStmt.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderStmt.cpp Wed Jun 30 03:49:18 2010
@@ -17,7 +17,7 @@
#include "clang/AST/StmtVisitor.h"
using namespace clang;
-namespace {
+namespace clang {
class PCHStmtReader : public StmtVisitor<PCHStmtReader> {
PCHReader &Reader;
@@ -69,6 +69,7 @@
void VisitStringLiteral(StringLiteral *E);
void VisitCharacterLiteral(CharacterLiteral *E);
void VisitParenExpr(ParenExpr *E);
+ void VisitParenListExpr(ParenListExpr *E);
void VisitUnaryOperator(UnaryOperator *E);
void VisitOffsetOfExpr(OffsetOfExpr *E);
void VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
@@ -429,6 +430,17 @@
E->setSubExpr(Reader.ReadSubExpr());
}
+void PCHStmtReader::VisitParenListExpr(ParenListExpr *E) {
+ VisitExpr(E);
+ unsigned NumExprs = Record[Idx++];
+ E->Exprs = new (*Reader.getContext()) Stmt*[NumExprs];
+ for (unsigned i = 0; i != NumExprs; ++i)
+ E->Exprs[i] = Reader.ReadSubStmt();
+ E->NumExprs = NumExprs;
+ E->LParenLoc = Reader.ReadSourceLocation(Record, Idx);
+ E->RParenLoc = Reader.ReadSourceLocation(Record, Idx);
+}
+
void PCHStmtReader::VisitUnaryOperator(UnaryOperator *E) {
VisitExpr(E);
E->setSubExpr(Reader.ReadSubExpr());
@@ -1328,6 +1340,10 @@
S = new (Context) ParenExpr(Empty);
break;
+ case pch::EXPR_PAREN_LIST:
+ S = new (Context) ParenListExpr(Empty);
+ break;
+
case pch::EXPR_UNARY_OPERATOR:
S = new (Context) UnaryOperator(Empty);
break;
Modified: cfe/trunk/lib/Frontend/PCHWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterStmt.cpp?rev=107266&r1=107265&r2=107266&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriterStmt.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriterStmt.cpp Wed Jun 30 03:49:18 2010
@@ -22,7 +22,7 @@
// Statement/expression serialization
//===----------------------------------------------------------------------===//
-namespace {
+namespace clang {
class PCHStmtWriter : public StmtVisitor<PCHStmtWriter, void> {
PCHWriter &Writer;
PCHWriter::RecordData &Record;
@@ -64,6 +64,7 @@
void VisitStringLiteral(StringLiteral *E);
void VisitCharacterLiteral(CharacterLiteral *E);
void VisitParenExpr(ParenExpr *E);
+ void VisitParenListExpr(ParenListExpr *E);
void VisitUnaryOperator(UnaryOperator *E);
void VisitOffsetOfExpr(OffsetOfExpr *E);
void VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
@@ -418,6 +419,16 @@
Code = pch::EXPR_PAREN;
}
+void PCHStmtWriter::VisitParenListExpr(ParenListExpr *E) {
+ VisitExpr(E);
+ Record.push_back(E->NumExprs);
+ for (unsigned i=0; i != E->NumExprs; ++i)
+ Writer.AddStmt(E->Exprs[i]);
+ Writer.AddSourceLocation(E->LParenLoc, Record);
+ Writer.AddSourceLocation(E->RParenLoc, Record);
+ Code = pch::EXPR_PAREN_LIST;
+}
+
void PCHStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
VisitExpr(E);
Writer.AddStmt(E->getSubExpr());
More information about the cfe-commits
mailing list