forked from OSchip/llvm-project
2d83647007
Summary: The current Objective-C global variable declaration check restricts naming that is permitted by the Google Objective-C style guide. The Objective-C style guide states the following: "Global and file scope constants should have an appropriate prefix. [...] Constants may use a lowercase k prefix when appropriate" http://google.github.io/styleguide/objcguide#constants This change fixes the check to allow two or more capital letters as an appropriate prefix. This change intentionally avoids making a decision regarding whether to flag constants that use a two letter prefix (two letter prefixes are reserved by Apple¹ but many projects seem to violate this guideline). This change eliminates an important category of false positives (constants prefixed with '[A-Z]{2,}') at the cost of introducing a less important category of false negatives (constants prefixed with only '[A-Z]'). The false positives are observed in standard recommended code while the false negatives occur in non-standard unrecommended code. The number of eliminated false positives is expected to be significantly larger than the number of exposed false negatives. ❧ (1) "Two-letter prefixes like these are reserved by Apple for use in framework classes." https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Conventions/Conventions.html Reviewers: aaron.ballman, Wizard, hokein, benhamilton Reviewed By: aaron.ballman, Wizard Subscribers: aaron.ballman, cfe-commits Differential Revision: https://reviews.llvm.org/D43581 llvm-svn: 326046 |
||
---|---|---|
.. | ||
AvoidCStyleCastsCheck.cpp | ||
AvoidCStyleCastsCheck.h | ||
AvoidThrowingObjCExceptionCheck.cpp | ||
AvoidThrowingObjCExceptionCheck.h | ||
CMakeLists.txt | ||
DefaultArgumentsCheck.cpp | ||
DefaultArgumentsCheck.h | ||
ExplicitConstructorCheck.cpp | ||
ExplicitConstructorCheck.h | ||
ExplicitMakePairCheck.cpp | ||
ExplicitMakePairCheck.h | ||
GlobalNamesInHeadersCheck.cpp | ||
GlobalNamesInHeadersCheck.h | ||
GlobalVariableDeclarationCheck.cpp | ||
GlobalVariableDeclarationCheck.h | ||
GoogleTidyModule.cpp | ||
IntegerTypesCheck.cpp | ||
IntegerTypesCheck.h | ||
NonConstReferences.cpp | ||
NonConstReferences.h | ||
OverloadedUnaryAndCheck.cpp | ||
OverloadedUnaryAndCheck.h | ||
StringReferenceMemberCheck.cpp | ||
StringReferenceMemberCheck.h | ||
TodoCommentCheck.cpp | ||
TodoCommentCheck.h | ||
UnnamedNamespaceInHeaderCheck.cpp | ||
UnnamedNamespaceInHeaderCheck.h | ||
UsingNamespaceDirectiveCheck.cpp | ||
UsingNamespaceDirectiveCheck.h |