diff options
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 7 | ||||
-rw-r--r-- | test/SemaObjC/attr-deprecated.m | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index c3789508e1..b82c50a4b5 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -108,6 +108,11 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *SuperClassDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl); + + // Diagnose classes that inherit from deprecated classes. + if (SuperClassDecl) + DiagnoseUseOfDeprecatedDeclImpl(SuperClassDecl, SuperLoc); + if (PrevDecl && SuperClassDecl == 0) { // The previous declaration was not a class decl. Check if we have a // typedef. If we do, get the underlying class type. @@ -118,6 +123,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, SuperClassDecl = dyn_cast<ObjCInterfaceDecl>(IDecl); } } + // This handles the following case: // // typedef int SuperClass; @@ -128,6 +134,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, Diag(PrevDecl->getLocation(), diag::note_previous_definition); } } + if (!dyn_cast_or_null<TypedefDecl>(PrevDecl)) { if (!SuperClassDecl) Diag(SuperLoc, diag::err_undef_superclass) diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m index 29789ac265..87d6f2140a 100644 --- a/test/SemaObjC/attr-deprecated.m +++ b/test/SemaObjC/attr-deprecated.m @@ -92,3 +92,8 @@ __attribute ((deprecated)) @interface DEPRECATED (Category) // expected-warning {{warning: 'DEPRECATED' is deprecated}} @end + +@interface NS : DEPRECATED // expected-warning {{warning: 'DEPRECATED' is deprecated}} +@end + + |