diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-12-07 20:09:25 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-12-07 20:09:25 +0000 |
commit | c2949f9f26f968c5e6e123f2b9587f77b89d5e3b (patch) | |
tree | 7d95dae0814eea2f289d7179b877f75d5ffcdb53 /clang | |
parent | 1aaecfa02d8cee94d82d93356ca5500623c4c403 (diff) | |
download | bcm5719-llvm-c2949f9f26f968c5e6e123f2b9587f77b89d5e3b.tar.gz bcm5719-llvm-c2949f9f26f968c5e6e123f2b9587f77b89d5e3b.zip |
Allow accessing 'isa' via '->' operator.
(fixes radar 7447251).
llvm-svn: 90795
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 10 | ||||
-rw-r--r-- | clang/test/SemaObjC/id-isa-ref.m | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 6c5a1ec05c5..b3c5c9fc20b 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -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) { diff --git a/clang/test/SemaObjC/id-isa-ref.m b/clang/test/SemaObjC/id-isa-ref.m index fa3293ce79b..dbb6b2f53d8 100644 --- a/clang/test/SemaObjC/id-isa-ref.m +++ b/clang/test/SemaObjC/id-isa-ref.m @@ -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; |