[cfe-commits] r90795 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaObjC/id-isa-ref.m

Fariborz Jahanian fjahanian at apple.com
Mon Dec 7 12:09:26 PST 2009


Author: fjahanian
Date: Mon Dec  7 14:09:25 2009
New Revision: 90795

URL: http://llvm.org/viewvc/llvm-project?rev=90795&view=rev
Log:
Allow accessing 'isa' via '->' operator. 
(fixes radar 7447251).

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/SemaObjC/id-isa-ref.m

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=90795&r1=90794&r2=90795&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Dec  7 14:09:25 2009
@@ -2522,6 +2522,16 @@
   // 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) {

Modified: cfe/trunk/test/SemaObjC/id-isa-ref.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/id-isa-ref.m?rev=90795&r1=90794&r2=90795&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/id-isa-ref.m (original)
+++ cfe/trunk/test/SemaObjC/id-isa-ref.m Mon Dec  7 14:09:25 2009
@@ -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;





More information about the cfe-commits mailing list