xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/objc/forbidden-subclassing-custom.m (revision e8a3ddafe063c970df9c23e803812369abde4c82)
189a1d03eSRichard// RUN: %check_clang_tidy %s objc-forbidden-subclassing %t \
289a1d03eSRichard// RUN: -config='{CheckOptions: \
3*e8a3ddafSNathan James// RUN:  {objc-forbidden-subclassing.ClassNames: "Foo;Quux"}}' \
489a1d03eSRichard// RUN: --
589a1d03eSRichard
689a1d03eSRichard@interface UIImagePickerController
789a1d03eSRichard@end
889a1d03eSRichard
989a1d03eSRichard// Make sure custom config options replace (not add to) the default list.
1089a1d03eSRichard@interface Waldo : UIImagePickerController
1189a1d03eSRichard// CHECK-MESSAGES-NOT: :[[@LINE-1]]:12: warning: Objective-C interface 'Waldo' subclasses 'UIImagePickerController', which is not intended to be subclassed [objc-forbidden-subclassing]
1289a1d03eSRichard@end
1389a1d03eSRichard
1489a1d03eSRichard@interface Foo
1589a1d03eSRichard@end
1689a1d03eSRichard
1789a1d03eSRichard@interface Bar : Foo
1889a1d03eSRichard// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: Objective-C interface 'Bar' subclasses 'Foo', which is not intended to be subclassed [objc-forbidden-subclassing]
1989a1d03eSRichard@end
2089a1d03eSRichard
2189a1d03eSRichard// Check subclasses of subclasses.
2289a1d03eSRichard@interface Baz : Bar
2389a1d03eSRichard// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: Objective-C interface 'Baz' subclasses 'Foo', which is not intended to be subclassed [objc-forbidden-subclassing]
2489a1d03eSRichard@end
2589a1d03eSRichard
2689a1d03eSRichard@interface Quux
2789a1d03eSRichard@end
2889a1d03eSRichard
2989a1d03eSRichard// Check that more than one forbidden superclass can be specified.
3089a1d03eSRichard@interface Xyzzy : Quux
3189a1d03eSRichard// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: Objective-C interface 'Xyzzy' subclasses 'Quux', which is not intended to be subclassed [objc-forbidden-subclassing]
3289a1d03eSRichard@end
3389a1d03eSRichard
3489a1d03eSRichard@interface Plugh
3589a1d03eSRichard@end
3689a1d03eSRichard
3789a1d03eSRichard@interface Corge : Plugh
3889a1d03eSRichard// CHECK-MESSAGES-NOT: :[[@LINE-1]]:12: warning: Objective-C interface 'Corge' subclasses 'Plugh', which is not intended to be subclassed [objc-forbidden-subclassing]
3989a1d03eSRichard@end
40