r304306 - [Sema][ObjC] Don't emit availability diags for category @implementations

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 08:45:58 PDT 2017


Author: epilk
Date: Wed May 31 10:45:57 2017
New Revision: 304306

URL: http://llvm.org/viewvc/llvm-project?rev=304306&view=rev
Log:
[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

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

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=304306&r1=304305&r2=304306&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed May 31 10:45:57 2017
@@ -1851,10 +1851,6 @@ Decl *Sema::ActOnStartCategoryImplementa
   // 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>()) {

Modified: cfe/trunk/test/SemaObjC/attr-deprecated.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-deprecated.m?rev=304306&r1=304305&r2=304306&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-deprecated.m (original)
+++ cfe/trunk/test/SemaObjC/attr-deprecated.m Wed May 31 10:45:57 2017
@@ -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-n
 @end
 
 @interface DEPRECATED (Category2) // no warning.
+- (id)meth;
 @end
 
- at implementation DEPRECATED (Category2) // expected-warning {{'DEPRECATED' is deprecated}}
+__attribute__((deprecated))
+void depr_function();
+
+ at implementation DEPRECATED (Category2) // no warning
+- (id)meth {
+  depr_function(); // no warning.
+  return 0;
+}
 @end
 
 @interface NS : DEPRECATED  // expected-warning {{'DEPRECATED' is deprecated}}

Modified: cfe/trunk/test/SemaObjC/class-unavail-warning.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/class-unavail-warning.m?rev=304306&r1=304305&r2=304306&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/class-unavail-warning.m (original)
+++ cfe/trunk/test/SemaObjC/class-unavail-warning.m Wed May 31 10:45:57 2017
@@ -2,7 +2,7 @@
 // rdar://9092208
 
 __attribute__((unavailable("not available")))
- at interface MyClass { // expected-note 8 {{'MyClass' has been explicitly marked unavailable here}}
+ at 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 availabl
 @interface MyClass (Cat2) // no error.
 @end
 
- at implementation MyClass (Cat2) // expected-error {{unavailable}}
+ at implementation MyClass (Cat2) // no error.
 @end
 
 int main() {

Modified: cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m?rev=304306&r1=304305&r2=304306&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m (original)
+++ cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m Wed May 31 10:45:57 2017
@@ -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
 
- at implementation CL ( SomeCategory ) // expected-warning {{'CL' is deprecated}} \
-                                    // expected-warning {{Implementing deprecated category}}
+ at implementation CL (SomeCategory) // expected-warning {{Implementing deprecated category}}
 @end
 
 @interface CL_SUB : CL // expected-warning {{'CL' is deprecated}}




More information about the cfe-commits mailing list