aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-06-20 17:18:31 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-06-20 17:18:31 +0000
commite95f8ef6563bdf26de5294873733a3425c09db42 (patch)
tree87dc5b5064723fed5e863699802b91dc7754fd40 /lib/Sema/SemaObjCProperty.cpp
parent8571897a792fcbc26d86c70d6c3ef835e75af984 (diff)
objc: improved diagnostic when property autosynthesis may cause
change in behavior. // rdar://11671080 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 71112f7701..95fbde39af 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -753,24 +753,26 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
Context.getObjCGCQualType(PropertyIvarType, Qualifiers::Weak);
}
}
-
- if (!Ivar) {
- if (AtLoc.isInvalid()) {
- // Check when default synthesizing a property that there is
- // an ivar matching property name and issue warning; since this
- // is the most common case of not using an ivar used for backing
- // property in non-default synthesis case.
- ObjCInterfaceDecl *ClassDeclared=0;
- ObjCIvarDecl *originalIvar =
- IDecl->lookupInstanceVariable(property->getIdentifier(),
- ClassDeclared);
- if (originalIvar) {
- Diag(PropertyDiagLoc,
- diag::warn_autosynthesis_property_ivar_match);
- Diag(property->getLocation(), diag::note_property_declare);
- Diag(originalIvar->getLocation(), diag::note_ivar_decl);
- }
+ if (AtLoc.isInvalid()) {
+ // Check when default synthesizing a property that there is
+ // an ivar matching property name and issue warning; since this
+ // is the most common case of not using an ivar used for backing
+ // property in non-default synthesis case.
+ ObjCInterfaceDecl *ClassDeclared=0;
+ ObjCIvarDecl *originalIvar =
+ IDecl->lookupInstanceVariable(property->getIdentifier(),
+ ClassDeclared);
+ if (originalIvar) {
+ Diag(PropertyDiagLoc,
+ diag::warn_autosynthesis_property_ivar_match)
+ << property->getName() << (Ivar == 0) << PropertyIvar->getName()
+ << originalIvar->getName();
+ Diag(property->getLocation(), diag::note_property_declare);
+ Diag(originalIvar->getLocation(), diag::note_ivar_decl);
}
+ }
+
+ if (!Ivar) {
// In ARC, give the ivar a lifetime qualifier based on the
// property attributes.
if (getLangOpts().ObjCAutoRefCount &&