From 6c9ee7b0c8560250fcc0c023529ec9753851729a Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 26 Jul 2014 20:52:26 +0000 Subject: Objective-C. Issue more warning diagnostic when certain properties are not synthesized in property auto-synthesis, as it can potentiall lead to runtime errors. rdar://17774815 llvm-svn: 214032 --- clang/lib/Sema/SemaObjCProperty.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'clang/lib/Sema/SemaObjCProperty.cpp') diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 8eb806ba301..00322949261 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -1555,20 +1555,23 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl, 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); + 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())) { - if (PID->getPropertyDecl() != Prop) { - Diag(Prop->getLocation(), diag::warn_no_autosynthesis_shared_ivar_property) - << Prop->getIdentifier(); - if (!PID->getLocation().isInvalid()) - Diag(PID->getLocation(), diag::note_property_synthesize); - } + Diag(Prop->getLocation(), diag::warn_no_autosynthesis_shared_ivar_property) + << Prop->getIdentifier(); + if (!PID->getLocation().isInvalid()) + Diag(PID->getLocation(), diag::note_property_synthesize); continue; } if (ObjCProtocolDecl *Proto = -- cgit v1.2.3