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

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon Jul 20 11:18:49 PDT 2009


On Jul 20, 2009, at 5:50 AM, steve naroff wrote:

> Hey Argyrios,
>
> I really like the idea of moving this association from Sema- 
> >ASTContext.
>
> From my perspective, adding getImplementation to the  
> ObjCContainerDecl AST has the following drawbacks:
>
> - The ObjCImplDecl is rarely used. For example Cocoa.h contains ~700  
> "containers" that don't have implementations (which include classes,  
> categories, and protocols). Even for non-system classes/categories/ 
> protocols, the slot would be rarely used as well (since most ObjC  
> files/modules contain a very small number of implementations...1 is  
> very common).
> - The ObjCImplDecl doesn't make sense for protocols (since they  
> don't have an implementation).
>
> Did you consider adding the following API to ASTContext?
>
> For example...
>
> ObjCImplementationDecl *ASTContext::getImplementation 
> (ObjCInterfaceDecl *);
> ObjCCategoryImplDecl *ASTContext::getImplementation(ObjCCategoryDecl  
> *);
>
> ASTContext would use a "Map" to associate the ObjCContainerDecl with  
> it's ObjCImplDecl.

Hey great idea!

Please see attached patch.

-Argiris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: objc_impl.patch
Type: application/octet-stream
Size: 10349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090720/a7769ff7/attachment.obj>
-------------- next part --------------





More information about the cfe-commits mailing list