llvm-project/clang-tools-extra/unittests/clang-tidy
Haojian Wu e010406e28 [clang-tidy ObjC] [3/3] New check objc-forbidden-subclassing
Summary:
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`

Patch by Ben Hamilton!

Reviewers: hokein, alexfh

Reviewed By: hokein

Subscribers: saidinwot, Wizard, srhines, mgorny, xazax.hun

Differential Revision: https://reviews.llvm.org/D39142

llvm-svn: 316744
2017-10-27 07:41:36 +00:00
..
CMakeLists.txt [clang-tidy ObjC] [1/3] New module `objc` for Objective-C checks 2017-10-26 08:23:20 +00:00
ClangTidyDiagnosticConsumerTest.cpp [clang-tidy] Ignore newlines in checks list 2017-08-09 16:00:31 +00:00
ClangTidyOptionsTest.cpp [clang-tidy] Merge ExtraArgs(Before) instead of overriding them. 2016-08-23 14:48:29 +00:00
ClangTidyTest.h [clang-tidy ObjC] [2/3] Support non-C++ files in ClangTidyTest 2017-10-26 08:37:25 +00:00
GoogleModuleTest.cpp Fix false positive on anonymous namespaces in headers. 2015-03-24 15:21:45 +00:00
IncludeInserterTest.cpp Correctly classify main file includes if there is a prefix added 2017-01-12 15:31:50 +00:00
LLVMModuleTest.cpp [clang-tidy] Reword the "code outside header guard" warning. 2017-02-21 11:25:45 +00:00
MiscModuleTest.cpp [clang-tidy] misc-argument-comment non-strict mode 2016-08-04 14:54:54 +00:00
NamespaceAliaserTest.cpp modernize-use-auto NFC fixes 2016-12-14 15:29:23 +00:00
ObjCModuleTest.cpp [clang-tidy ObjC] [3/3] New check objc-forbidden-subclassing 2017-10-27 07:41:36 +00:00
OverlappingReplacementsTest.cpp Fix overlapping replacements in clang-tidy. 2015-10-16 11:43:49 +00:00
ReadabilityModuleTest.cpp [clang-tidy] Add a test. 2017-08-10 12:38:46 +00:00
UsingInserterTest.cpp modernize-use-auto NFC fixes 2016-12-14 15:29:23 +00:00