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

Eli Friedman eli.friedman at gmail.com
Tue May 19 16:36:18 PDT 2009


On Tue, May 19, 2009 at 3:42 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>
> On May 19, 2009, at 1:30 PM, Eli Friedman wrote:
>
>> On Tue, May 19, 2009 at 1:18 PM, Fariborz Jahanian <fjahanian at apple.com>
>> wrote:
>>>
>>> Yes. There is still a question of what to do when 'id'/'Class' 's
>>> declaration seen in objc.h. Since you going to
>>> treat them as first-class types. Then one possible solution is to #ifdef
>>> them out for clang as its has outlived its
>>> usefulness.
>>
>> We can just continue to treat them magically; we already have code for
>> doing that (see Sema::MergeTypeDefDecl).
>
> In the current scheme of things, both old and new 'id' s are typedefs.

As far as I can tell, that doesn't change in this scheme: typedefs are
our standard way of introducing names of builtin types into the
translation unit.  We'd just be typedef'ing "id" to an ObjCIdType
rather than a pointer to a struct objc_object.

The only tricky thing to get right is if we allow code to reference
"struct objc_object" directly; I think we can take care of that with a
check in ASTContext::getPointerType, though (essentially, the idea is
to make it impossible to construct a "struct objc_object*").

-Eli



More information about the cfe-dev mailing list