Change warning to error when property setter names conflict.

// rdar://11528439


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2012-05-26 16:10:06 +00:00
Родитель bdb97ff687
Коммит cba0ebce65
3 изменённых файлов: 7 добавлений и 8 удалений

Просмотреть файл

@ -626,10 +626,9 @@ def warn_missing_explicit_synthesis : Warning <
def warn_property_getter_owning_mismatch : Warning<
"property declared as returning non-retained objects"
"; getter returning retained objects">;
def warn_property_setter_ambiguous_use : Warning<
def error_property_setter_ambiguous_use : Error<
"synthesized properties '%0' and '%1' both claim setter %2 -"
" use of this setter may cause unexpected behavior">,
InGroup<DiagGroup<"objc-multiple-property-setter-use">>;
" use of this setter will cause unexpected behavior">;
def err_ownin_getter_rule : Error<
"property's synthesized getter follows Cocoa naming"
" convention for returning 'owned' objects">;

Просмотреть файл

@ -543,7 +543,7 @@ bool ObjCPropertyOpBuilder::findSetter(bool warn) {
IdentifierInfo *AltMember = &S.PP.getIdentifierTable().get(PropertyName);
if (ObjCPropertyDecl *prop1 = IFace->FindPropertyDeclaration(AltMember))
if (prop != prop1 && (prop1->getSetterMethodDecl() == setter)) {
S.Diag(RefExpr->getExprLoc(), diag::warn_property_setter_ambiguous_use)
S.Diag(RefExpr->getExprLoc(), diag::error_property_setter_ambiguous_use)
<< prop->getName() << prop1->getName() << setter->getSelector();
S.Diag(prop->getLocation(), diag::note_property_declare);
S.Diag(prop1->getLocation(), diag::note_property_declare);

Просмотреть файл

@ -127,10 +127,10 @@ int main (void) {
self.P = 0; // expected-error {{property 'P' not found on object of type 'rdar11363363 *'}}
self.q = 0; // expected-error {{property 'q' not found on object of type 'rdar11363363 *'}}
// rdar://11528439
self.t = 0; // expected-warning {{synthesized properties 't' and 'T' both claim setter 'setT:'}}
self.T = 0; // expected-warning {{synthesized properties 'T' and 't' both claim setter 'setT:'}}
self.Pxyz = 0; // expected-warning {{synthesized properties 'Pxyz' and 'pxyz' both claim setter 'setPxyz:'}}
self.pxyz = 0; // expected-warning {{synthesized properties 'pxyz' and 'Pxyz' both claim setter 'setPxyz:'}}
self.t = 0; // expected-error {{synthesized properties 't' and 'T' both claim setter 'setT:'}}
self.T = 0; // expected-error {{synthesized properties 'T' and 't' both claim setter 'setT:'}}
self.Pxyz = 0; // expected-error {{synthesized properties 'Pxyz' and 'pxyz' both claim setter 'setPxyz:'}}
self.pxyz = 0; // expected-error {{synthesized properties 'pxyz' and 'Pxyz' both claim setter 'setPxyz:'}}
self.R = 0; // expected-error {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access ivar 'R'?}}
return self.R; // expected-error {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access ivar 'R'?}}
}