[cfe-commits] r49699 - in /cfe/trunk: Driver/ASTConsumers.cpp include/clang/AST/DeclObjC.h include/clang/Parse/Action.h include/clang/Parse/Parser.h lib/AST/DeclObjC.cpp lib/Parse/ParseObjc.cpp lib/Sema/Sema.h lib/Sema/SemaDeclObjC.cpp

Steve Naroff snaroff at apple.com
Tue Apr 15 17:17:00 PDT 2008


On Apr 15, 2008, at 4:47 PM, Chris Lattner wrote:

>
> On Apr 15, 2008, at 4:48 PM, Fariborz Jahanian wrote:
>
>>
>> On Apr 15, 2008, at 4:34 PM, Chris Lattner wrote:
>>> On Apr 14, 2008, at 4:36 PM, Fariborz Jahanian wrote:
>>>> Author: fjahanian
>>>> Date: Mon Apr 14 18:36:35 2008
>>>> New Revision: 49699
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=49699&view=rev
>>>> Log:
>>>> New AST representation for each objc2's property declaration.
>>>
>>> Nice, thanks Fariborz!
>>>
>>> I think that the propertydecl enum in DeclBase.h needs to be moved  
>>> to reflect its new place in the class hierarchy.
>>
>> I am not sure what you mean. ObjCPropertyDecl is derived from  
>> NamedDecl and it seems to be in the correct position.
>
> Oh, right!
>
>>> Also, given the new approach, should ObjCPropertyDecl inherit from  
>>> FieldDecl, what do you think?
>>
>> Think of a property declaration as macro for declaring setters and  
>> getters. It really has nothing to do with fields.
>
> Ok, I guess what I'm getting at is that it would be nice for  
> interfaces to have a single list of "stuff in them", which would  
> include ivars and properties.  Maybe there should be a class below  
> FieldDecl that PropertyDecl and FieldDecl both inherit from?
>
> I admit I'm out of my league here, Steve what do you think?
>

I don't think it makes sense for ObjCPropertyDecl to inherit from  
FieldDecl (BitWidth doesn't make sense).

To some degree, I think the AST's reflect ObjC's adhoc syntax.  
Instance variables are modeled directly after structure fields (which  
is reflected in the hierarchy). On the other hand, methods are modeled  
loosely after Smalltalk...no relation to C-style decls (so they  
inherit from Decl). Properties are somewhere in the middle...they use  
C-style naming to access setter/getter methods (largely syntactic  
sugar). The only common super type is Decl, which I don't see a  
problem with (for the moment, at least).

snaroff

> -Chris

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


More information about the cfe-commits mailing list