xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/objc/forbidden-subclassing.m (revision 89a1d03e2b379e325daa5249411e414bbd995b5e)
1*89a1d03eSRichard// RUN: %check_clang_tidy %s objc-forbidden-subclassing %t
2*89a1d03eSRichard
3*89a1d03eSRichard@interface UIImagePickerController
4*89a1d03eSRichard@end
5*89a1d03eSRichard
6*89a1d03eSRichard@interface Foo : UIImagePickerController
7*89a1d03eSRichard// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: Objective-C interface 'Foo' subclasses 'UIImagePickerController', which is not intended to be subclassed [objc-forbidden-subclassing]
8*89a1d03eSRichard@end
9*89a1d03eSRichard
10*89a1d03eSRichard// Check subclasses of subclasses.
11*89a1d03eSRichard@interface Bar : Foo
12*89a1d03eSRichard// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: Objective-C interface 'Bar' subclasses 'UIImagePickerController', which is not intended to be subclassed [objc-forbidden-subclassing]
13*89a1d03eSRichard@end
14*89a1d03eSRichard
15*89a1d03eSRichard@interface Baz
16*89a1d03eSRichard@end
17*89a1d03eSRichard
18*89a1d03eSRichard// Make sure innocent subclasses aren't caught by the check.
19*89a1d03eSRichard@interface Blech : Baz
20*89a1d03eSRichard// CHECK-MESSAGES-NOT: :[[@LINE-1]]:12: warning: Objective-C interface 'Blech' subclasses 'Baz', which is not intended to be subclassed [objc-forbidden-subclassing]
21*89a1d03eSRichard@end
22