[cfe-dev] Proposal to simplify ObjC Type AST's

steve naroff snaroff at apple.com
Sun May 24 13:48:42 PDT 2009


On May 24, 2009, at 2:06 AM, Chris Hanson wrote:

> On May 19, 2009, at 11:22 AM, steve naroff wrote:
>
>> // Seven classes. In this case, ObjCObjectPointerType is abstract.
>>
>> class ObjCObjectPointerType : public Type { ... };
>>
>> class ObjCIdType : public ObjCObjectPointerType { ... };
>> class ObjCInterfacePointerType : public ObjCObjectPointerType  
>> { ... };
>> class ObjCClassType : public ObjCObjectPointerType { ... };
>>
>> class ObjCQualifiedIdType : public ObjCIdType, public  
>> llvm::FoldingSetNode { ... };
>> class ObjCQualifiedInterfacePointerType : public  
>> ObjCInterfacePointerType, public llvm::FoldingSetNode { ... };
>> class ObjCQualifiedClassType : public ObjCClassType, public  
>> llvm::FoldingSetNode { ... };
>>
>> I think having a common base class (abstract or not) makes either  
>> of these more appealing than what we have now.
>
> How about eight classes?
>
> // Eight classes. In this case, both ObJCObjectPointerType and  
> ObjCProtocolQualifierNode are abstract.
>
> class ObjCObjectPointerType : public Type { ... };
>
> class ObjCIdType : public ObjCObjectPointerType { ... };
> class ObjCInterfacePointerType : public ObjCObjectPointerType { ... };
> class ObjCClassType : public ObjCObjectPointerType { ... };
>
> class ObjCProtocolQualifierNode : public llvm::FoldingSetNode { ... };
>
> class ObjCQualifiedIdtype : public ObjCIdType, public  
> ObjCProtocolQualifierNode { ... };
> class ObjCQualifiedInterfacePointerType : public  
> ObjCInterfacePointerType, public ObjCProtocolQualifierNode { ... };
> class ObjCQualifiedClassType : public ObjCClassType, public  
> ObjCProtocolQualifierNode { ... };
>
> This composition enables the "protocol-qualified" concept to be  
> abstract too.
>

Hey Chris,

Sounds good to me. I'd simply call it ObjCQualifiedType (or  
ObjCProtocolQualifiedType).

Thanks,

snaroff

> (I don't know the clang codebase enough to give  
> ObJCProtocolQualifierNode a good name.)
>
>   -- Chris
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090524/583b631a/attachment.html>


More information about the cfe-dev mailing list