]> granicus.if.org Git - clang/commitdiff
[Sema][ObjC] Don't emit availability diags for category @implementations
authorErik Pilkington <erik.pilkington@gmail.com>
Wed, 31 May 2017 15:45:57 +0000 (15:45 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Wed, 31 May 2017 15:45:57 +0000 (15:45 +0000)
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

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/attr-deprecated.m
test/SemaObjC/class-unavail-warning.m
test/SemaObjC/warn-deprecated-implementations.m

index 370461c4a24e4524be8ff9eba929cd8486404e6f..2c8080dbf02b9dd12d2edf507906cf898e06fed0 100644 (file)
@@ -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<ObjCRuntimeVisibleAttr>()) {
index b0613851ddaaf92bcadb4b4090179320fb0c21b3..28031997af7a9164f45ac66437f8199daa67a30b 100644 (file)
@@ -83,7 +83,7 @@ int t5() {
 }
 
 
-__attribute ((deprecated)) // expected-note {{'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}}
index 268d51910b0c3041c5d752fb8822b31b547739a6..f7d8f569ca67bbe749bad5db48089f64a8ec51eb 100644 (file)
@@ -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() {
index 0c341165b0f0c7d882952938f2e3fc2259c0956f..df2557b9cd520e9984d23069495e7eaffcc49cca 100644 (file)
 - (void) G {}  // No warning, implementing its own deprecated method
 @end
 
-__attribute__((deprecated)) // expected-note {{'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}}