]> granicus.if.org Git - clang/commitdiff
Objective-C. Do not warn if user is using property-dox syntax to name a
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 15 Aug 2014 17:39:00 +0000 (17:39 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 15 Aug 2014 17:39:00 +0000 (17:39 +0000)
user provided setter name (as declared in @property attribute declaration).
rdar://18022762

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

lib/Sema/SemaExprObjC.cpp
test/SemaObjC/property-user-setter.m

index 0facca03915b7d05fe03607477fd114347a2c0ce..39598b5a19aab4f4c74b152cc9821f1c944668c7 100644 (file)
@@ -1708,11 +1708,15 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
   // name 'x'.
   if (Setter && Setter->isImplicit() && Setter->isPropertyAccessor()
       && !IFace->FindPropertyDeclaration(Member)) {
-      if (const ObjCPropertyDecl *PDecl = Setter->findPropertyDecl())
+      if (const ObjCPropertyDecl *PDecl = Setter->findPropertyDecl()) {
+        // Do not warn if user is using property-dot syntax to make call to
+        // user named setter.
+        if (!(PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_setter))
           Diag(MemberLoc,
                diag::warn_property_access_suggest)
           << MemberName << QualType(OPT, 0) << PDecl->getName()
           << FixItHint::CreateReplacement(MemberLoc, PDecl->getName());
+      }
   }
 
   if (Getter || Setter) {
index 5d2a3a21e1ac835dc03ed1096acb657f63978a15..7674c2b3a2cdfed007bdb80b5beb94e272b9cf9f 100644 (file)
@@ -151,7 +151,7 @@ int main (void) {
 
 - (void) dealloc
 {
- self.formatter = 0; // expected-warning {{property 'formatter' not found on object of type 'FMXBridgeFormatter *'; did you mean to access property cppFormatter?}}
+ self.formatter = 0;
 }
 @end