diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2014-08-29 18:31:16 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2014-08-29 18:31:16 +0000 |
commit | c9b771560ab39146d15d6da4ea151eeb3f1f5e87 (patch) | |
tree | f94ec90199349d5fe027bf57c7b9744ac6df68d6 /clang/lib/Sema/SemaObjCProperty.cpp | |
parent | 8d05190e1d2c858f29ed143346871e0217ddd950 (diff) | |
download | bcm5719-llvm-c9b771560ab39146d15d6da4ea151eeb3f1f5e87.tar.gz bcm5719-llvm-c9b771560ab39146d15d6da4ea151eeb3f1f5e87.zip |
Objective-C. Tweak diagnosing properties that are not auto-synthesized.
Do not warn when property declared in class's protocol will be auto-synthesized
by its uper class implementation because super class has also declared this
property while this class has not. Continue to warn if current class
has declared the property also (because this declaration will not result
in a 2nd synthesis).
rdar://18152478
llvm-svn: 216753
Diffstat (limited to 'clang/lib/Sema/SemaObjCProperty.cpp')
-rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 0963c1ee3da..ba698c1b3c3 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -1547,25 +1547,6 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl, if (IMPDecl->getInstanceMethod(Prop->getSetterName())) continue; } - // If property to be implemented in the super class, ignore. - if (SuperPropMap[Prop->getIdentifier()]) { - ObjCPropertyDecl *PropInSuperClass = SuperPropMap[Prop->getIdentifier()]; - if ((Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) && - (PropInSuperClass->getPropertyAttributes() & - ObjCPropertyDecl::OBJC_PR_readonly) && - !IMPDecl->getInstanceMethod(Prop->getSetterName()) && - !IDecl->HasUserDeclaredSetterMethod(Prop)) { - Diag(Prop->getLocation(), diag::warn_no_autosynthesis_property) - << Prop->getIdentifier(); - Diag(PropInSuperClass->getLocation(), diag::note_property_declare); - } - else { - Diag(Prop->getLocation(), diag::warn_autosynthesis_property_in_superclass) - << Prop->getIdentifier(); - Diag(IMPDecl->getLocation(), diag::note_while_in_implementation); - } - continue; - } if (ObjCPropertyImplDecl *PID = IMPDecl->FindPropertyImplIvarDecl(Prop->getIdentifier())) { Diag(Prop->getLocation(), diag::warn_no_autosynthesis_shared_ivar_property) @@ -1587,7 +1568,25 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl, } continue; } - + // If property to be implemented in the super class, ignore. + if (ObjCPropertyDecl *PropInSuperClass = + SuperPropMap[Prop->getIdentifier()]) { + if ((Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) && + (PropInSuperClass->getPropertyAttributes() & + ObjCPropertyDecl::OBJC_PR_readonly) && + !IMPDecl->getInstanceMethod(Prop->getSetterName()) && + !IDecl->HasUserDeclaredSetterMethod(Prop)) { + Diag(Prop->getLocation(), diag::warn_no_autosynthesis_property) + << Prop->getIdentifier(); + Diag(PropInSuperClass->getLocation(), diag::note_property_declare); + } + else { + Diag(Prop->getLocation(), diag::warn_autosynthesis_property_in_superclass) + << Prop->getIdentifier(); + Diag(IMPDecl->getLocation(), diag::note_while_in_implementation); + } + continue; + } // We use invalid SourceLocations for the synthesized ivars since they // aren't really synthesized at a particular location; they just exist. // Saying that they are located at the @implementation isn't really going |