[cfe-commits] r75314 - in /cfe/trunk: include/clang/AST/ include/clang/Analysis/PathSensitive/ lib/AST/ lib/Analysis/ lib/CodeGen/ lib/Frontend/ lib/Sema/ test/CodeGenObjC/ test/PCH/ test/SemaObjC/ test/SemaObjCXX/
steve naroff
snaroff at apple.com
Mon Jul 13 10:35:26 PDT 2009
On Jul 13, 2009, at 1:19 PM, Fariborz Jahanian wrote:
> Hi Steve,
>
> I don't have much to add to Chris's detailed comments. Here are a few.
>
> On Jul 10, 2009, at 4:35 PM, Steve Naroff wrote:
>
>> urn a ObjCObjectPointerType type for the
>> /// given interface decl and the conforming protocol list.
>> - QualType getObjCObjectPointerType(ObjCInterfaceDecl *Decl,
>> + QualType getObjCObjectPointerType(QualType OIT = QualType(),
>> ObjCProtocolDecl **ProtocolList
>> = 0,
>> unsigned NumProtocols = 0);
>
> No need to have default for OIT.
>
Good point. As I was playing with the API, I thought it would be
useful for getObjCObjectPointerType() to imply "id" (though I don't
appear to be using it...).
>>
>> +QualType Type::getPointeeType() const {
>> + if (const PointerType *PT = getAsPointerType())
>> + return PT->getPointeeType();
>> + if (const ObjCObjectPointerType *OPT =
>> getAsObjCObjectPointerType())
>> + return OPT->getPointeeType();
>> + if (const BlockPointerType *BPT = getAsBlockPointerType())
>> + return BPT->getPointeeType();
>> + return QualType();
>> +}
>
> If ObjCObjectPointerType is for an 'id' or 'Class' what will the
> PointeeType be for these two?
The pointeeType for an ObjCObjectPointer is always an ObjCInterfaceType.
For 'id', the pointee is an ObjCInterfaceType named "id".
For 'Class', the pointee is an ObjCInterfaceType named "Class".
Both of these built-in interfaces are created by
Sema::ActOnTranslationUnitScope().
These built-in "root" interfaces don't currently have any ivars/
methods. One day, we can consider building these out (if necessary).
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/test/SemaObjC/conditional-expr-3.m (original)
>> +++ cfe/trunk/test/SemaObjC/conditional-expr-3.m Fri Jul 10
>> 18:34:53 2009
>> @@ -59,7 +59,7 @@
>> }
>>
>> void f10(int cond, id<P0,P1> x0, id<P0,P2> x1) {
>> - barP2(cond ? x0 : x1);
>> + barP2(cond ? x0 : x1); // expected-warning {{incompatible type
>> passing 'id<P0,P1>', expected 'id<P2>'}}
>
> Why does the warning does not say 'expected 'id<P0, P2>' ?
>
Don't know...will investigate.
> Also, as chris pointed out, we can't break abi compatibility with
> gcc for encoding 'id' and 'Class'. We need to hack our way into
> compatibility at any cost.
>
> Great work.
>
Thanks for reviewing!
snaroff
> - Fariborz
>
>
More information about the cfe-commits
mailing list