r215736 - Objective-C. Do not warn if user is using property-dox syntax to name a
Fariborz Jahanian
fjahanian at apple.com
Fri Aug 15 10:39:01 PDT 2014
Author: fjahanian
Date: Fri Aug 15 12:39:00 2014
New Revision: 215736
URL: http://llvm.org/viewvc/llvm-project?rev=215736&view=rev
Log:
Objective-C. Do not warn if user is using property-dox syntax to name a
user provided setter name (as declared in @property attribute declaration).
rdar://18022762
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/property-user-setter.m
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=215736&r1=215735&r2=215736&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Aug 15 12:39:00 2014
@@ -1708,11 +1708,15 @@ HandleExprPropertyRefExpr(const ObjCObje
// 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) {
Modified: cfe/trunk/test/SemaObjC/property-user-setter.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-user-setter.m?rev=215736&r1=215735&r2=215736&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-user-setter.m (original)
+++ cfe/trunk/test/SemaObjC/property-user-setter.m Fri Aug 15 12:39:00 2014
@@ -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
More information about the cfe-commits
mailing list