This is part 3 of 3 of a series of changes to improve Objective-C
linting in clang-tidy.
This adds a new clang-tidy check objc-forbidden-subclassing which
ensures clients do not create subclasses of Objective-C classes which
are not designed to be subclassed.
(Note that for code under your control, you should use
attribute((objc_subclassing_restricted)) instead -- this
is intended for third-party APIs which cannot be modified.)
By default, the following classes (which are publicly documented
as not supporting subclassing) are forbidden from subclassing:
ABNewPersonViewController
ABPeoplePickerNavigationController
ABPersonViewController
ABUnknownPersonViewController
NSHashTable
NSMapTable
NSPointerArray
NSPointerFunctions
NSTimer
UIActionSheet
UIAlertView
UIImagePickerController
UITextInputMode
UIWebView
Clients can set a CheckOption
objc-forbidden-subclassing.ClassNames to a semicolon-separated
list of class names, which overrides this list.
Test Plan: ninja check-clang-tools
Sorry for missing this in the previous review.
Using a std::vector for the forbidden classes is sufficient -- most of clang-tidy checks are using std::vector for options, and with that, you can get rid of RawStringForbiddenSuperclassNames (just use utils::options::serializeStringList to store the option).