]> granicus.if.org Git - clang/commitdiff
Allow accessing 'isa' via '->' operator.
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 7 Dec 2009 20:09:25 +0000 (20:09 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 7 Dec 2009 20:09:25 +0000 (20:09 +0000)
(fixes radar 7447251).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90795 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaObjC/id-isa-ref.m

index 6c5a1ec05c5778275534bbcd906ae0b29113ff5d..b3c5c9fc20bc925113cab5dab430c8315680f224 100644 (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) {
index fa3293ce79b57fdd3a0893abbf8bc9912220e242..dbb6b2f53d86e9ab34fd159f3a469dd3a1fff30a 100644 (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;