[cfe-commits] [PATCH] ObjC: interface decls pointing to implementation decls

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon Jul 20 11:45:37 PDT 2009


On Jul 20, 2009, at 11:34 AM, steve naroff wrote:

>
> Looks great.

Ok, unless someone objects (soon), I'm going to commit the set of  
patches.

> I really like the following "convenience" functions:
>
> +ObjCImplementationDecl *ObjCInterfaceDecl::getImplementation()  
> const {
> +  return getASTContext().getObjCImplementation(
> +                                           
> const_cast<ObjCInterfaceDecl*>(this));
> +}
> +
> +void ObjCInterfaceDecl::setImplementation(ObjCImplementationDecl  
> *ImplD) {
> +  getASTContext().setObjCImplementation(this, ImplD);
> +}
> +
>
> Now that every Decl can get a pointer to it's ASTContext (something  
> Chris reminded me of earlier today), I bet there are other  
> interesting space optimizations that we can make to decls (*without*  
> complicating the API:-). For example, *every* ParmVarDecl currently  
> has a DefaultArg slot (that is only available for C++). Cocoa.h has  
> 30,000 ParmVarDecl's! Might be interesting to consider using an  
> ASTContext Map to store these as well.

On this particular case, is there a reason we don't reuse VarDecl's  
Init Stmt* field for C++ default arg ?

-Argiris



More information about the cfe-commits mailing list