[cfe-dev] Proposal to simplify ObjC Type AST's
Chris Hanson
cmh at mac.com
Sat May 23 23:06:34 PDT 2009
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.
(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/20090523/c3744f85/attachment.html>
More information about the cfe-dev
mailing list