diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-16 21:33:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-16 21:33:09 +0000 |
commit | c7984ddeda4655e3e9e6acf2424acfc55173d5e2 (patch) | |
tree | 536c865eaa6a411503a86044cc4ea8d707a0a575 | |
parent | 16b34b416a68be507017051c211c90b246cd5066 (diff) |
warn about interfaces that inherit from deprecated classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64671 91177308-0d34-0410-b5e6-96231b3b80d8
-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 + + |