Allow accessing 'isa' via '->' operator.

(fixes radar 7447251).

llvm-svn: 90795
This commit is contained in:
Fariborz Jahanian 2009-12-07 20:09:25 +00:00
parent 1aaecfa02d
commit c2949f9f26
2 changed files with 10 additions and 3 deletions

View File

@ -2522,6 +2522,16 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
// If this is an Objective-C pseudo-builtin and a definition is provided then
// use that.
if (BaseType->isObjCIdType()) {
if (IsArrow) {
// Handle the following exceptional case PObj->isa.
if (const ObjCObjectPointerType *OPT =
BaseType->getAs<ObjCObjectPointerType>()) {
if (OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCId) &&
MemberName.getAsIdentifierInfo()->isStr("isa"))
return Owned(new (Context) ObjCIsaExpr(BaseExpr, false, MemberLoc,
Context.getObjCIdType()));
}
}
// We have an 'id' type. Rather than fall through, we check if this
// is a reference to 'isa'.
if (BaseType != Context.ObjCIdRedefinitionType) {

View File

@ -1,8 +1,5 @@
// RUN: clang-cc -fsyntax-only -verify %s
// Failing currently due to Obj-C type representation changes. 2009-09-17
// XFAIL: *
typedef struct objc_object {
struct objc_class *isa;
} *id;