[cfe-commits] r43989 - in /cfe/trunk: AST/Decl.cpp Sema/Sema.h Sema/SemaDecl.cpp Sema/SemaExpr.cpp include/clang/AST/DeclObjC.h test/Sema/message.m

Steve Naroff snaroff at apple.com
Mon Dec 17 06:57:19 PST 2007


On Dec 12, 2007, at 5:13 PM, Chris Lattner wrote:

>
> On Dec 12, 2007, at 5:11 PM, Steve Naroff wrote:
>
>> Please split it into two functions, where one calls the other.   
>> instead of "lookupInstanceMethod" how about  
>> getinstanceMethodBySelector() or something?  Wow that name is  
>> long ;-)
>>
>>
>> I understand what you looking for...I'll consider this approach and  
>> make a proposal.
>>
>
> Ok, thanks!
>

Chris,

Here is what is currently in TOT...

The following 2 methods are implemented on ObjcInterfaceDecl,  
ObjcCategoryDecl, and ObjcProtocolDecl.

   // Get the local instance method declared in this interface.
   ObjcMethodDecl *getInstanceMethodForSelector(Selector &Sel);
   // Get the local class method declared in this interface.
   ObjcMethodDecl *getClassMethodForSelector(Selector &Sel);

Even though the names are "long", it is much shorter than the  
corresponding iterator (which the above replaces:-)

The more elaborate lookup methods still exist. I added the comment  
below (ignore the typo, which I will fix:-).

   // Lookup the instance method. First, we search locally. If a  
method isn't
   // found, we look through the reference protocols. Lastly, we look  
categories
   // defined for this class.
   ObjcMethodDecl *lookupInstanceMethod(Selector &Sel);
   ObjcMethodDecl *lookupClassMethod(Selector &Sel);

One question...

To make these API's a bit more uniform, do you prefer I drop the  
"ForSelector" from getInstanceMethodForSelector() or add a  
"ForSelector" to lookupInstanceMethod()?

Personally, I would vote for getInstanceMethod/lookupInstanceMethod.  
With C++ style naming, I don't see the benefit of naming the argument.  
If we were using ObjC, it would have more value (since all arguments  
are typically named).

Nevertheless, I don't feel strongly about this.

Please advise,

snaroff

> -Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20071217/bb4e049b/attachment.html>


More information about the cfe-commits mailing list