Summary:
The Acronyms and IncludeDefaultAcronyms options were deprecated in
https://reviews.llvm.org/D51832. These options can be removed.
Tested by running the clang-tidy tests.
This is an amended resubmission of https://reviews.llvm.org/D56945.
Reviewers: Eugene.Zelenko, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57080
llvm-svn: 354195
Summary:
The `Acronyms` and `IncludeDefaultAcronyms` options were deprecated in
https://reviews.llvm.org/D51832. These options can be removed.
Tested by running the clang-tidy tests.
Reviewers: benhamilton, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: Eugene.Zelenko, xazax.hun, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D56945
llvm-svn: 351921
to reflect the new license.
We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.
Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.
llvm-svn: 351636
Summary:
§1 Description
This changes the objc-property-declaration check to allow arbitrary acronyms and initialisms instead of using whitelisted acronyms. In Objective-C it is relatively common to use project prefixes in property names for the purposes of disambiguation. For example, the CIColor¹ and CGColor² properties on UIColor both represent symbol prefixes being used in proeprty names outside of Apple's accepted acronyms³. The union of Apple's accepted acronyms and all symbol prefixes that might be used for disambiguation in property declarations effectively allows for any arbitrary sequence of capital alphanumeric characters to be acceptable in property declarations. This change updates the check accordingly.
The test variants with custom configurations are deleted as part of this change because their configurations no longer impact behavior. The acronym configurations are currently preserved for backwards compatibility of check configuration.
[1] https://developer.apple.com/documentation/uikit/uicolor/1621951-cicolor?language=objc
[2] https://developer.apple.com/documentation/uikit/uicolor/1621954-cgcolor?language=objc
[3] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE
§2 Test Notes
Changes verified by:
• Running clang-tidy unit tests.
• Used check_clang_tidy.py to verify expected output of processing objc-property-declaration.m
Reviewers: benhamilton, Wizard
Reviewed By: benhamilton
Subscribers: jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D51832
llvm-svn: 348331
Summary: This will make clang-tidy accept property names like xyz_URL (URL is a common acronym).
Reviewers: benhamilton, hokein
Reviewed By: benhamilton
Subscribers: jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D53955
llvm-svn: 345858
We haven't supported compiling ObjC1 for a long time (and never will again), so
there isn't any reason to keep these separate. This patch replaces
LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC.
Differential revision: https://reviews.llvm.org/D53547
llvm-svn: 345637
Summary: This adds a few common acronyms we found were missing from PropertyDeclarationCheck.
Reviewers: Wizard, hokein
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51819
llvm-svn: 341720
Summary:
This PR adds a few acronyms related to hashing algorithms to the standard
list in `objc-property-declaration`.
Reviewers: Wizard
Reviewed By: Wizard
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48652
llvm-svn: 335770
Summary: Now we can support property names like "hasADog" correctly.
Reviewers: benhamilton, hokein
Reviewed By: benhamilton
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48039
llvm-svn: 334448
Summary: The comment incorrectly claims that the listed acronyms are all extracted from the linked Apple documentation.
Reviewers: Wizard, benhamilton
Reviewed By: Wizard, benhamilton
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D46922
Contributed by @stephanemoore.
llvm-svn: 334238
Summary:
This adds a few common Apple first-party API prefixes as acronyms to
`objc-property-declaration`.
Here's a list showing where these come from:
http://nshipster.com/namespacing/
Test Plan: New tests added. Ran tests with:
% make -j16 check-clang-tools
Reviewers: Wizard, hokein
Subscribers: klimek, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D46206
llvm-svn: 331267
Summary: This is to support general acronyms in Objective-C like 2G/3G/4G/... and coordinates X, Y, Z and W.
Reviewers: benhamilton
Reviewed By: benhamilton
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D45750
llvm-svn: 330286
Summary: I did not put lang opt check in AvoidSpinlockCheck since OSSpinLock is not objc specific. We won't want to skip it when analyzing some C++ target used by other ObjC sources.
Reviewers: hokein, benhamilton
Reviewed By: benhamilton
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44174
llvm-svn: 326928
Summary:
The existing option objc-property-declaration.Acronyms
replaces the built-in set of acronyms.
While this behavior is OK for clients that don't want the default
behavior, many clients may just want to add their own custom acronyms
to the default list.
This revision introduces a new option,
objc-property-declaration.IncludeDefaultAcronyms, which controls
whether the acronyms in objc-property-declaration.Acronyms are
appended to the default list (the default behavior) or whether they
replace.
I also updated the documentation.
Test Plan: make -j12 check-clang-tools
Reviewers: Wizard, hokein, klimek
Reviewed By: hokein
Subscribers: Eugene.Zelenko, cfe-commits
Differential Revision: https://reviews.llvm.org/D42261
llvm-svn: 323130
Summary:
We were missing some pretty common acronyms in the camelCase
property name check objc-property-declaration.
This expands the list and sorts it lexicographically, so we can
avoid duplicates.
Test Plan: make -j12 check-clang-tools
Reviewers: Wizard, hokein, klimek
Reviewed By: Wizard
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42253
llvm-svn: 322886
Summary:
This check finds the use of methods related to OSSpinlock in Objective-C code, which should be deprecated due to livelock issues.
The following method call will be detected:
- OSSpinlockLock()
- OSSpinlockTry()
- OSSpinlockUnlcok()
Reviewers: hokein, benhamilton
Reviewed By: benhamilton
Subscribers: klimek, cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D40325
llvm-svn: 319098
Summary:
This check finds property declarations in Objective-C files that do not follow the pattern of property names in Apple's programming guide. The property name should be in the format of Lower Camel Case or with some particular acronyms as prefix.
Example:
@property(nonatomic, assign) int lowerCamelCase;
@property(nonatomic, strong) NSString *URLString;
Test plan: ninja check-clang-tools
Reviewers: benhamilton, hokein
Reviewed By: hokein
Subscribers: cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D39829
llvm-svn: 318117
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
Summary:
This is part 1 of 3 of a series of changes to improve Objective-C
linting in clang-tidy.
This introduces a new clang-tidy module, `objc`, specifically for
Objective-C / Objective-C++ checks.
The module is currently empty; D39142 adds the first check.
Test Plan: `ninja check-clang-tools`
Patch by Ben Hamilton!
Reviewers: hokein, alexfh
Reviewed By: hokein
Subscribers: Wizard, mgorny
Differential Revision: https://reviews.llvm.org/D39188
llvm-svn: 316643