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

Fariborz Jahanian fjahanian at apple.com
Mon Jul 20 08:28:26 PDT 2009


I believe we have considered such approaches in the past and when it  
came to choices between
a little bit more cpu cycle and adding a new field to an AST node, we  
opted for little bit more of cpu cycles.

- fariborz

On Jul 19, 2009, at 6:19 PM, Argyrios Kyrtzidis wrote:

> Hi all,
>
> Currently you can't find the implementation of an interface using only
> the ASTContext. This results in Sema doing name lookups when looking
> for methods or keeping data structures like ObjCCategoryImpls.
> IMO the ASTContext should provide the information that "this
> ObjCIntefaceDecl is implemented by this ObjCImplementationDecl". This
> way Sema gets simplified, it can get at the implementation without
> doing name lookups
> and a client can easily access such information without the need to
> build data structures like Sema's.
>
> I attached 3 patches for your reviewal pleasure:
>
> objc_impl1.patch:  Modifies ObjCContainerDecl so that it can point to
> its implementation. As a bonus, Sema is modified to emit an error when
> a category is reimplemented (previously it didn't emit any  
> diagnostic).
> objc_impl2.patch:  Sema::LookupObjCImplementation() is removed, and
> ObjCInterfaceDecl::getImplementation() is used in its place. No name
> lookups, w00t!
> objc_impl3.patch: The ObjCCategoryImpls vector is removed from Sema,
> and ObjCInterfaceDecl::getCategoryClassMethod() and
> ObjCInterfaceDecl::getCategoryInstanceMethod() are used for the same
> functionality.
>
> Let me know what you think.
>
> -Argiris
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list