Implemented serialization of: ObjCEncodeExpr, ObjCSelectorExpr.

llvm-svn: 44593
This commit is contained in:
Ted Kremenek 2007-12-05 00:43:08 +00:00
parent 166e505d27
commit 90a7c12bb4
2 changed files with 46 additions and 9 deletions

View File

@ -168,9 +168,15 @@ Stmt* Stmt::Create(Deserializer& D) {
case ObjcAtTryStmtClass:
return ObjcAtTryStmt::CreateImpl(D);
case ObjCEncodeExprClass:
return ObjCEncodeExpr::CreateImpl(D);
case ObjCIvarRefExprClass:
return ObjCIvarRefExpr::CreateImpl(D);
case ObjCSelectorExprClass:
return ObjCSelectorExpr::CreateImpl(D);
case ObjCStringLiteralClass:
return ObjCStringLiteral::CreateImpl(D);
}
@ -893,6 +899,21 @@ ObjcAtTryStmt* ObjcAtTryStmt::CreateImpl(Deserializer& D) {
return stmt;
}
void ObjCEncodeExpr::EmitImpl(Serializer& S) const {
S.Emit(AtLoc);
S.Emit(RParenLoc);
S.Emit(getType());
S.Emit(EncType);
}
ObjCEncodeExpr* ObjCEncodeExpr::CreateImpl(Deserializer& D) {
SourceLocation AtLoc = SourceLocation::ReadVal(D);
SourceLocation RParenLoc = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
QualType ET = QualType::ReadVal(D);
return new ObjCEncodeExpr(T,ET,AtLoc,RParenLoc);
}
void ObjCIvarRefExpr::EmitImpl(Serializer& S) const {
S.Emit(Loc);
S.Emit(getType());
@ -907,6 +928,22 @@ ObjCIvarRefExpr* ObjCIvarRefExpr::CreateImpl(Deserializer& D) {
return dr;
}
void ObjCSelectorExpr::EmitImpl(Serializer& S) const {
S.Emit(AtLoc);
S.Emit(RParenLoc);
S.Emit(getType());
S.Emit(SelName);
}
ObjCSelectorExpr* ObjCSelectorExpr::CreateImpl(Deserializer& D) {
SourceLocation AtLoc = SourceLocation::ReadVal(D);
SourceLocation RParenLoc = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
Selector SelName = Selector::ReadVal(D);
return new ObjCSelectorExpr(T,SelName,AtLoc,RParenLoc);
}
void ObjCStringLiteral::EmitImpl(Serializer& S) const {
S.Emit(AtLoc);
S.Emit(getType());

View File

@ -1213,13 +1213,14 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
virtual void EmitImpl(llvm::Serializer& S) const;
static ObjCEncodeExpr* CreateImpl(llvm::Deserializer& D);
};
/// ObjCSelectorExpr used for @selector in Objective-C.
class ObjCSelectorExpr : public Expr {
Selector SelName;
SourceLocation AtLoc, RParenLoc;
public:
ObjCSelectorExpr(QualType T, Selector selInfo,
@ -1246,15 +1247,15 @@ public:
virtual child_iterator child_begin();
virtual child_iterator child_end();
virtual void EmitImpl(llvm::Serializer& S) const;
static ObjCSelectorExpr* CreateImpl(llvm::Deserializer& D);
};
/// ObjCProtocolExpr used for protocol in Objective-C.
class ObjCProtocolExpr : public Expr {
ObjcProtocolDecl *Protocol;
SourceLocation AtLoc, RParenLoc;
public:
public:
ObjCProtocolExpr(QualType T, ObjcProtocolDecl *protocol,
SourceLocation at, SourceLocation rp)
: Expr(ObjCProtocolExprClass, T), Protocol(protocol),
@ -1274,7 +1275,6 @@ class ObjCProtocolExpr : public Expr {
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
};
/// ObjCIvarRefExpr - A reference to an ObjC instance variable.