[cfe-commits] r84435 - /cfe/trunk/include/clang/AST/DeclObjC.h

Chris Lattner clattner at apple.com
Mon Oct 19 10:24:35 PDT 2009


On Oct 19, 2009, at 4:16 AM, steve naroff wrote:
>> The problem is that NamedDecl also has a getName() function, which
>> this is overriding, but the two mean something different.
>>
>> This one should probably be called getCategoryName, although
>> alternately it might make more sense for the categorie's name to be
>> the actual category name, and clients that want the interface name  
>> can
>> get it by getting the interface.
>>
>
> That would make more sense to me. I think the API is fine...the
> implementation might be incorrect.
>
> Let's take another example....you have the same FIXME: comment in
> ObjCImplementationDecl and I don't see the problem. Seems like a
> totally valid use of polymorphism (i.e. it give you the name of the
> implementation). The fact that it derives the name from the
> ObjCInterfaceDecl seems like an implementation detail...

hi Steve,

I think the point here is that getName() isn't and shouldn't be  
polymorphic.  This means that if you have:

ObjCCategoryImplDecl *X = ...

that:
   X->getName()
and
   NamedDecl *ND = X;
   ND->getName()

will return different things.

-Chris



More information about the cfe-commits mailing list