| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s |
| 2 |
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s |
| 3 |
|
| 4 |
__attribute__((objc_subclassing_restricted)) |
| 5 |
@interface Leaf // okay |
| 6 |
@end |
| 7 |
|
| 8 |
__attribute__((objc_subclassing_restricted)) |
| 9 |
@interface SubClassOfLeaf : Leaf // expected-note {{class is declared here}} |
| 10 |
@end |
| 11 |
|
| 12 |
|
| 13 |
@interface SubClass : SubClassOfLeaf // expected-error {{cannot subclass a class that was declared with the 'objc_subclassing_restricted' attribute}} |
| 14 |
@end |
| 15 |
|
| 16 |
__attribute__((objc_root_class)) |
| 17 |
@interface PlainRoot |
| 18 |
@end |
| 19 |
|
| 20 |
__attribute__((objc_subclassing_restricted)) |
| 21 |
@interface Sub2Class : PlainRoot // okay |
| 22 |
@end |
| 23 |
|
| 24 |
__attribute__((objc_subclassing_restricted)) |
| 25 |
@interface SuperImplClass // expected-note {{class is declared here}} |
| 26 |
@end |
| 27 |
@implementation SuperImplClass |
| 28 |
@end |
| 29 |
|
| 30 |
__attribute__((objc_subclassing_restricted)) |
| 31 |
@interface SubImplClass : SuperImplClass |
| 32 |
@end |
| 33 |
@implementation SubImplClass // expected-error {{cannot subclass a class that was declared with the 'objc_subclassing_restricted' attribute}} |
| 34 |
@end |