[cfe-commits] r46524 - in /cfe/trunk: AST/Stmt.cpp AST/StmtSerialization.cpp Parse/ParseObjc.cpp Sema/Sema.h Sema/SemaStmt.cpp include/clang/AST/Stmt.h include/clang/Parse/Action.h

Ted Kremenek kremenek at apple.com
Tue Jan 29 13:24:37 PST 2008


On Jan 29, 2008, at 11:14 AM, Fariborz Jahanian wrote:

> Modified: cfe/trunk/AST/StmtSerialization.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtSerialization.cpp?rev=46524&r1=46523&r2=46524&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/AST/StmtSerialization.cpp (original)
> +++ cfe/trunk/AST/StmtSerialization.cpp Tue Jan 29 13:14:59 2008
> @@ -893,6 +893,20 @@
>   Stmt* Throw = D.ReadOwnedPtr<Stmt>();
>   return new ObjCAtThrowStmt(L,Throw);
> }
> +
> +void ObjCAtSynchronizedStmt::EmitImpl(Serializer& S) const {
> +  S.Emit(AtSynchronizedLoc);
> +  S.EmitOwnedPtr(SynchExpr);
> +  S.EmitOwnedPtr(SynchBody);
> +}
> +
> +ObjCAtSynchronizedStmt*  
> ObjCAtSynchronizedStmt::CreateImpl(Deserializer& D) {
> +  SourceLocation L = SourceLocation::ReadVal(D);
> +  Expr *syncExpr = D.ReadOwnedPtr<Expr>();
> +  Stmt *synchBody = D.ReadOwnedPtr<Stmt>();
> +  ObjCAtSynchronizedStmt* stmt = new  
> ObjCAtSynchronizedStmt(L,syncExpr,synchBody);
> +  return stmt;
> +}
>
> void ObjCAtTryStmt::EmitImpl(Serializer& S) const {
>   S.Emit(AtTryLoc);

Hi Fariborz,

Thanks for putting in the serialization code as more Objective-C  
features are implemented in clang.  I have a few small comments:

1) Please keep the serialization methods ordered by class name  
(roughly alphabetically, with Objective-C specific classes at the  
end).  That way it is easy to tell what ASTs have serialization  
implemented.

2) Try and use BatchEmitOwnedPtrs/BatchReadOwnedPtrs instead of  
emitting multiple owned pointers separately.  It results in a more  
efficient encoding on disk.  There are examples of this throughout  
StmtSerialization.cpp.

3) Don't forget to update the switch statement (in Stmt::Create()) at  
the top of the file to do the dispatch during Stmt deserialization  
(something has to call the XXXCreateImpl() methods).

There is nothing for you to do now; I have already made these changes  
in r46529; it's just something I thought I would point out when/if you  
implement the serialization of other Objective C constructs.

Thanks!

Ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20080129/8b01d485/attachment.html>


More information about the cfe-commits mailing list