Implicitly assume that a ObjC category to an unavailable interface is also unavailable;
only give an 'unavailable' error on the @implementation of the category. rdar://10234078
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141335 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m
index be6c51f..ca26759 100644
--- a/test/SemaObjC/attr-deprecated.m
+++ b/test/SemaObjC/attr-deprecated.m
@@ -92,7 +92,14 @@
@property int prop;
@end
-@interface DEPRECATED (Category) // expected-warning {{warning: 'DEPRECATED' is deprecated}}
+@interface DEPRECATED (Category) // no warning.
+- (DEPRECATED *) meth2; // no warning.
+@end
+
+@interface DEPRECATED (Category2) // no warning.
+@end
+
+@implementation DEPRECATED (Category2) // expected-warning {{warning: 'DEPRECATED' is deprecated}}
@end
@interface NS : DEPRECATED // expected-warning {{warning: 'DEPRECATED' is deprecated}}
diff --git a/test/SemaObjC/class-unavail-warning.m b/test/SemaObjC/class-unavail-warning.m
index a0c2d55..b2bd388 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 7 {{declaration has been explicitly marked unavailable here}}
+@interface MyClass { // expected-note 8 {{declaration has been explicitly marked unavailable here}}
@public
void *_test;
MyClass *ivar; // no error.
@@ -21,6 +21,16 @@
- (MyClass *)meth; // expected-error {{unavailable}}
@end
+@interface MyClass (Cat1)
+- (MyClass *)meth; // no error.
+@end
+
+@interface MyClass (Cat2) // no error.
+@end
+
+@implementation MyClass (Cat2) // expected-error {{unavailable}}
+@end
+
int main() {
[MyClass new]; // expected-error {{'MyClass' is unavailable: not available}}
[MyClass self]; // expected-error {{'MyClass' is unavailable: not available}}
diff --git a/test/SemaObjC/warn-deprecated-implementations.m b/test/SemaObjC/warn-deprecated-implementations.m
index 7bcd10c..60da7b0 100644
--- a/test/SemaObjC/warn-deprecated-implementations.m
+++ b/test/SemaObjC/warn-deprecated-implementations.m
@@ -26,7 +26,8 @@
@implementation CL // expected-warning {{Implementing deprecated class}}
@end
-@implementation CL ( SomeCategory ) // expected-warning {{Implementing deprecated category}}
+@implementation CL ( SomeCategory ) // expected-warning {{'CL' is deprecated}} \
+ // expected-warning {{Implementing deprecated category}}
@end
@interface CL_SUB : CL // expected-warning {{'CL' is deprecated}}