diff options
-rw-r--r-- | include/clang/AST/DeclObjC.h | 9 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 9 |
3 files changed, 16 insertions, 4 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 491453ee19..1533718ed9 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -865,15 +865,16 @@ public: } /// isObjCSuppressAutosynthesis - Checks that a class or one of its super - /// classes must not be auto-synthesized. Returns true if it must not be. - bool isObjCSuppressAutosynthesis() const { + /// classes must not be auto-synthesized. Returns class decl. if it must not be; + /// 0, otherwise. + const ObjCInterfaceDecl *isObjCSuppressAutosynthesis() const { const ObjCInterfaceDecl *Class = this; while (Class) { if (Class->hasAttr<ObjCSuppressAutosynthesisAttr>()) - return true; + return Class; Class = Class->getSuperClass(); } - return false; + return 0; } ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName, diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index d5047506cc..d3a726ccc8 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -379,6 +379,8 @@ def note_implementation_declared : Note< "class implementation is declared here">; def note_class_declared : Note< "class is declared here">; +def note_suppressed_class_declare : Note< + "class with specified objc_suppress_autosynthesis attribute is declared here">; def warn_dup_category_def : Warning< "duplicate definition of category %1 on interface %0">; def err_conflicting_super_class : Error<"conflicting super class name %0">; diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index efef7caadc..45c4775634 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -1394,6 +1394,11 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl, << Prop->getDeclName() << Prop->getGetterName(); Diag(Prop->getLocation(), diag::note_property_declare); + if (LangOpts.ObjCDefaultSynthProperties && LangOpts.ObjCNonFragileABI2) + if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(CDecl)) + if (const ObjCInterfaceDecl *RID = ID->isObjCSuppressAutosynthesis()) + Diag(RID->getLocation(), diag::note_suppressed_class_declare); + } if (!Prop->isReadOnly() && !InsMap.count(Prop->getSetterName())) { @@ -1404,6 +1409,10 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl, << Prop->getDeclName() << Prop->getSetterName(); Diag(Prop->getLocation(), diag::note_property_declare); + if (LangOpts.ObjCDefaultSynthProperties && LangOpts.ObjCNonFragileABI2) + if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(CDecl)) + if (const ObjCInterfaceDecl *RID = ID->isObjCSuppressAutosynthesis()) + Diag(RID->getLocation(), diag::note_suppressed_class_declare); } } } |