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

@ -167,10 +167,16 @@ Stmt* Stmt::Create(Deserializer& D) {
case ObjcAtTryStmtClass: case ObjcAtTryStmtClass:
return ObjcAtTryStmt::CreateImpl(D); return ObjcAtTryStmt::CreateImpl(D);
case ObjCEncodeExprClass:
return ObjCEncodeExpr::CreateImpl(D);
case ObjCIvarRefExprClass: case ObjCIvarRefExprClass:
return ObjCIvarRefExpr::CreateImpl(D); return ObjCIvarRefExpr::CreateImpl(D);
case ObjCSelectorExprClass:
return ObjCSelectorExpr::CreateImpl(D);
case ObjCStringLiteralClass: case ObjCStringLiteralClass:
return ObjCStringLiteral::CreateImpl(D); return ObjCStringLiteral::CreateImpl(D);
} }
@ -893,6 +899,21 @@ ObjcAtTryStmt* ObjcAtTryStmt::CreateImpl(Deserializer& D) {
return stmt; 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 { void ObjCIvarRefExpr::EmitImpl(Serializer& S) const {
S.Emit(Loc); S.Emit(Loc);
S.Emit(getType()); S.Emit(getType());
@ -907,6 +928,22 @@ ObjCIvarRefExpr* ObjCIvarRefExpr::CreateImpl(Deserializer& D) {
return dr; 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 { void ObjCStringLiteral::EmitImpl(Serializer& S) const {
S.Emit(AtLoc); S.Emit(AtLoc);
S.Emit(getType()); S.Emit(getType());

View File

@ -1213,13 +1213,14 @@ public:
// Iterators // Iterators
virtual child_iterator child_begin(); virtual child_iterator child_begin();
virtual child_iterator child_end(); 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. /// ObjCSelectorExpr used for @selector in Objective-C.
class ObjCSelectorExpr : public Expr { class ObjCSelectorExpr : public Expr {
Selector SelName; Selector SelName;
SourceLocation AtLoc, RParenLoc; SourceLocation AtLoc, RParenLoc;
public: public:
ObjCSelectorExpr(QualType T, Selector selInfo, ObjCSelectorExpr(QualType T, Selector selInfo,
@ -1245,16 +1246,16 @@ public:
// Iterators // Iterators
virtual child_iterator child_begin(); virtual child_iterator child_begin();
virtual child_iterator child_end(); 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. /// ObjCProtocolExpr used for protocol in Objective-C.
class ObjCProtocolExpr : public Expr { class ObjCProtocolExpr : public Expr {
ObjcProtocolDecl *Protocol;
ObjcProtocolDecl *Protocol;
SourceLocation AtLoc, RParenLoc; SourceLocation AtLoc, RParenLoc;
public: public:
ObjCProtocolExpr(QualType T, ObjcProtocolDecl *protocol, ObjCProtocolExpr(QualType T, ObjcProtocolDecl *protocol,
SourceLocation at, SourceLocation rp) SourceLocation at, SourceLocation rp)
: Expr(ObjCProtocolExprClass, T), Protocol(protocol), : Expr(ObjCProtocolExprClass, T), Protocol(protocol),
@ -1274,7 +1275,6 @@ class ObjCProtocolExpr : public Expr {
// Iterators // Iterators
virtual child_iterator child_begin(); virtual child_iterator child_begin();
virtual child_iterator child_end(); virtual child_iterator child_end();
}; };
/// ObjCIvarRefExpr - A reference to an ObjC instance variable. /// ObjCIvarRefExpr - A reference to an ObjC instance variable.