objc: Include all types when issuing warning under
-Wdirect-ivar-access.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161500 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 5bc82c7..bfe7242 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1961,11 +1961,10 @@
         return ExprError();
 
       MarkAnyDeclReferenced(Loc, IV);
-      if (IV->getType()->isObjCObjectPointerType()) {
-        ObjCMethodFamily MF = CurMethod->getMethodFamily();
-        if (MF != OMF_init && MF != OMF_dealloc && MF != OMF_finalize)
-          Diag(Loc, diag::warn_direct_ivar_access) << IV->getDeclName();
-      }
+      
+      ObjCMethodFamily MF = CurMethod->getMethodFamily();
+      if (MF != OMF_init && MF != OMF_dealloc && MF != OMF_finalize)
+        Diag(Loc, diag::warn_direct_ivar_access) << IV->getDeclName();
       return Owned(new (Context)
                    ObjCIvarRefExpr(IV, IV->getType(), Loc,
                                    SelfExpr.take(), true, true));
diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp
index 0258b2a..53f22f6 100644
--- a/lib/Sema/SemaExprMember.cpp
+++ b/lib/Sema/SemaExprMember.cpp
@@ -1263,7 +1263,7 @@
           warn = false;
         }
     }
-    if (warn && IV->getType()->isObjCObjectPointerType()) {
+    if (warn) {
       if (ObjCMethodDecl *MD = getCurMethodDecl()) {
         ObjCMethodFamily MF = MD->getMethodFamily();
         warn = (MF != OMF_init && MF != OMF_dealloc && 
diff --git a/test/SemaObjC/warn-direct-ivar-access.m b/test/SemaObjC/warn-direct-ivar-access.m
index d380ebf..d2295f4 100644
--- a/test/SemaObjC/warn-direct-ivar-access.m
+++ b/test/SemaObjC/warn-direct-ivar-access.m
@@ -5,15 +5,18 @@
 @public
     id _myMaster;
     id _isTickledPink;
+    int _myIntProp;
 }
 @property(retain) id myMaster;
 @property(assign) id isTickledPink; // expected-note {{property declared here}}
+@property int myIntProp;
 @end
 
 @implementation MyObject
 
 @synthesize myMaster = _myMaster;
 @synthesize isTickledPink = _isTickledPink; // expected-error {{existing ivar '_isTickledPink' for property 'isTickledPink'}}
+@synthesize myIntProp = _myIntProp;
 
 - (void) doSomething {
     _myMaster = _isTickledPink; // expected-warning {{instance variable '_myMaster' is being directly accessed}} \
@@ -33,6 +36,8 @@
         p.isTickledPink = p.myMaster;	// ok
 	p->_isTickledPink = (*p)._myMaster; // expected-warning {{instance variable '_isTickledPink' is being directly accessed}} \
         // expected-warning {{instance variable '_myMaster' is being directly accessed}}
+        if (p->_myIntProp) // expected-warning {{instance variable '_myIntProp' is being directly accessed}}
+          p->_myIntProp = 0; // expected-warning {{instance variable '_myIntProp' is being directly accessed}}
 	return p->_isTickledPink; // expected-warning {{instance variable '_isTickledPink' is being directly accessed}}
 }