| 1 |
// RUN: %check_clang_tidy %s objc-forbidden-subclassing %t \ |
| 2 |
// RUN: -config='{CheckOptions: \ |
| 3 |
// RUN: {objc-forbidden-subclassing.ClassNames: "Foo;Quux"}}' \ |
| 4 |
// RUN: -- |
| 5 |
|
| 6 |
@interface UIImagePickerController |
| 7 |
@end |
| 8 |
|
| 9 |
// Make sure custom config options replace (not add to) the default list. |
| 10 |
@interface Waldo : UIImagePickerController |
| 11 |
// CHECK-MESSAGES-NOT: :[[@LINE-1]]:12: warning: Objective-C interface 'Waldo' subclasses 'UIImagePickerController', which is not intended to be subclassed [objc-forbidden-subclassing] |
| 12 |
@end |
| 13 |
|
| 14 |
@interface Foo |
| 15 |
@end |
| 16 |
|
| 17 |
@interface Bar : Foo |
| 18 |
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: Objective-C interface 'Bar' subclasses 'Foo', which is not intended to be subclassed [objc-forbidden-subclassing] |
| 19 |
@end |
| 20 |
|
| 21 |
// Check subclasses of subclasses. |
| 22 |
@interface Baz : Bar |
| 23 |
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: Objective-C interface 'Baz' subclasses 'Foo', which is not intended to be subclassed [objc-forbidden-subclassing] |
| 24 |
@end |
| 25 |
|
| 26 |
@interface Quux |
| 27 |
@end |
| 28 |
|
| 29 |
// Check that more than one forbidden superclass can be specified. |
| 30 |
@interface Xyzzy : Quux |
| 31 |
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: Objective-C interface 'Xyzzy' subclasses 'Quux', which is not intended to be subclassed [objc-forbidden-subclassing] |
| 32 |
@end |
| 33 |
|
| 34 |
@interface Plugh |
| 35 |
@end |
| 36 |
|
| 37 |
@interface Corge : Plugh |
| 38 |
// CHECK-MESSAGES-NOT: :[[@LINE-1]]:12: warning: Objective-C interface 'Corge' subclasses 'Plugh', which is not intended to be subclassed [objc-forbidden-subclassing] |
| 39 |
@end |