]> granicus.if.org Git - clang/commitdiff
Improve on objective-c pointer recognition
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 12 Jan 2010 17:31:23 +0000 (17:31 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 12 Jan 2010 17:31:23 +0000 (17:31 +0000)
during rewrite. No functionality chang.

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

lib/Frontend/RewriteObjC.cpp

index 74b2a1eb85e9cce0b4e2863a3f0bcc20dc54ee06..e9072d62e76d135fad96b3e9b8a8055c05d73a3e 100644 (file)
@@ -1195,7 +1195,8 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
   ObjCIvarDecl *D = IV->getDecl();
   const Expr *BaseExpr = IV->getBase();
   if (CurMethodDef) {
-    if (IV->isArrow() && isa<DeclRefExpr>(BaseExpr)) {
+    if (BaseExpr->getType()->isObjCObjectPointerType() && 
+        isa<DeclRefExpr>(BaseExpr)) {
       ObjCInterfaceType *iFaceDecl =
         dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
       // lookup which class implements the instance variable.
@@ -1243,7 +1244,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
 
     // Explicit ivar refs need to have a cast inserted.
     // FIXME: consider sharing some of this code with the code above.
-    if (IV->isArrow()) {
+    if (BaseExpr->getType()->isObjCObjectPointerType()) {
       ObjCInterfaceType *iFaceDecl =
         dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
       // lookup which class implements the instance variable.