diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-16 21:30:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-16 21:30:01 +0000 |
commit | 16b34b416a68be507017051c211c90b246cd5066 (patch) | |
tree | 1007bf6c463a9fe6d25ecd6958caf4115a12d301 | |
parent | 70f1954659b1c0e3e7675f0f688ee0f384846148 (diff) |
warn about categories that implement deprecated interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64670 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 10 | ||||
-rw-r--r-- | test/SemaObjC/attr-deprecated.m | 11 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 76a5c2c42a..c3789508e1 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -263,12 +263,7 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations, continue; } - if (PDecl->getAttr<UnavailableAttr>()) - Diag(ProtocolId[i].second, diag::warn_unavailable) << - PDecl->getDeclName(); - if (PDecl->getAttr<DeprecatedAttr>()) - Diag(ProtocolId[i].second, diag::warn_deprecated) << - PDecl->getDeclName(); + DiagnoseUseOfDeprecatedDeclImpl(PDecl, ProtocolId[i].second); // If this is a forward declaration and we are supposed to warn in this // case, do it. @@ -489,6 +484,9 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, } CDecl->setClassInterface(IDecl); + + // If the interface is deprecated, warn about it. + DiagnoseUseOfDeprecatedDeclImpl(IDecl, ClassLoc); /// Check for duplicate interface declaration for this category ObjCCategoryDecl *CDeclChain; diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m index fa91334a0a..29789ac265 100644 --- a/test/SemaObjC/attr-deprecated.m +++ b/test/SemaObjC/attr-deprecated.m @@ -81,3 +81,14 @@ int t5() { return f.FooBar; // expected-warning {{warning: 'FooBar' is deprecated}} } + +__attribute ((deprecated)) +@interface DEPRECATED { + @public int ivar; +} +- (int) instancemethod; +@property int prop; +@end + +@interface DEPRECATED (Category) // expected-warning {{warning: 'DEPRECATED' is deprecated}} +@end |