From: Erik Pilkington Date: Wed, 31 May 2017 15:45:57 +0000 (+0000) Subject: [Sema][ObjC] Don't emit availability diags for category @implementations X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=134a0f2f03fc9db0ac04da18d0eb1612a8aa9bf6;p=clang [Sema][ObjC] Don't emit availability diags for category @implementations These diagnostics can't be disabled, and can't actually catch any bugs. rdar://32427296 Differential revision: https://reviews.llvm.org/D33661 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304306 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 370461c4a2..2c8080dbf0 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1851,10 +1851,6 @@ Decl *Sema::ActOnStartCategoryImplementation( // FIXME: PushOnScopeChains? CurContext->addDecl(CDecl); - // If the interface is deprecated/unavailable, warn/error about it. - if (IDecl) - DiagnoseUseOfDecl(IDecl, ClassLoc); - // If the interface has the objc_runtime_visible attribute, we // cannot implement a category for it. if (IDecl && IDecl->hasAttr()) { diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m index b0613851dd..28031997af 100644 --- a/test/SemaObjC/attr-deprecated.m +++ b/test/SemaObjC/attr-deprecated.m @@ -83,7 +83,7 @@ int t5() { } -__attribute ((deprecated)) // expected-note 2 {{'DEPRECATED' has been explicitly marked deprecated here}} +__attribute ((deprecated)) // expected-note {{'DEPRECATED' has been explicitly marked deprecated here}} @interface DEPRECATED { @public int ivar; DEPRECATED *ivar2; // no warning. @@ -98,9 +98,17 @@ __attribute ((deprecated)) // expected-note 2 {{'DEPRECATED' has been explicitly @end @interface DEPRECATED (Category2) // no warning. +- (id)meth; @end -@implementation DEPRECATED (Category2) // expected-warning {{'DEPRECATED' is deprecated}} +__attribute__((deprecated)) +void depr_function(); + +@implementation DEPRECATED (Category2) // no warning +- (id)meth { + depr_function(); // no warning. + return 0; +} @end @interface NS : DEPRECATED // expected-warning {{'DEPRECATED' is deprecated}} diff --git a/test/SemaObjC/class-unavail-warning.m b/test/SemaObjC/class-unavail-warning.m index 268d51910b..f7d8f569ca 100644 --- a/test/SemaObjC/class-unavail-warning.m +++ b/test/SemaObjC/class-unavail-warning.m @@ -2,7 +2,7 @@ // rdar://9092208 __attribute__((unavailable("not available"))) -@interface MyClass { // expected-note 8 {{'MyClass' has been explicitly marked unavailable here}} +@interface MyClass { // expected-note 7 {{'MyClass' has been explicitly marked unavailable here}} @public void *_test; MyClass *ivar; // no error. @@ -28,7 +28,7 @@ __attribute__((unavailable("not available"))) @interface MyClass (Cat2) // no error. @end -@implementation MyClass (Cat2) // expected-error {{unavailable}} +@implementation MyClass (Cat2) // no error. @end int main() { diff --git a/test/SemaObjC/warn-deprecated-implementations.m b/test/SemaObjC/warn-deprecated-implementations.m index 0c341165b0..df2557b9cd 100644 --- a/test/SemaObjC/warn-deprecated-implementations.m +++ b/test/SemaObjC/warn-deprecated-implementations.m @@ -28,15 +28,14 @@ - (void) G {} // No warning, implementing its own deprecated method @end -__attribute__((deprecated)) // expected-note 2 {{'CL' has been explicitly marked deprecated here}} +__attribute__((deprecated)) // expected-note {{'CL' has been explicitly marked deprecated here}} @interface CL // expected-note 2 {{class declared here}} @end @implementation CL // expected-warning {{Implementing deprecated class}} @end -@implementation CL ( SomeCategory ) // expected-warning {{'CL' is deprecated}} \ - // expected-warning {{Implementing deprecated category}} +@implementation CL (SomeCategory) // expected-warning {{Implementing deprecated category}} @end @interface CL_SUB : CL // expected-warning {{'CL' is deprecated}}