[clang-tools-extra] r334448 - - Add "AV" as new default acronym. - Add support for "I" and "A" in lowerCamelCase pattern

Yan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 11 15:44:07 PDT 2018


Author: wizard
Date: Mon Jun 11 15:44:06 2018
New Revision: 334448

URL: http://llvm.org/viewvc/llvm-project?rev=334448&view=rev
Log:
- Add "AV" as new default acronym. - Add support for "I" and "A" in lowerCamelCase pattern

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

Modified:
    clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
    clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=334448&r1=334447&r2=334448&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Mon Jun 11 15:44:06 2018
@@ -45,6 +45,7 @@ constexpr llvm::StringLiteral DefaultSpe
     "AR",
     "ARGB",
     "ASCII",
+    "AV",
     "BGRA",
     "CA",
     "CF",
@@ -153,7 +154,7 @@ std::string validPropertyNameRegex(llvm:
   std::string StartMatcher = UsedInMatcher ? "::" : "^";
   std::string AcronymsMatcher = AcronymsGroupRegex(EscapedAcronyms);
   return StartMatcher + "(" + AcronymsMatcher + "[A-Z]?)?[a-z]+[a-z0-9]*(" +
-         AcronymsMatcher + "|([A-Z][a-z0-9]+))*$";
+         AcronymsMatcher + "|([A-Z][a-z0-9]+)|A|I)*$";
 }
 
 bool hasCategoryPropertyPrefix(llvm::StringRef PropertyName) {

Modified: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m?rev=334448&r1=334447&r2=334448&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m (original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m Mon Jun 11 15:44:06 2018
@@ -22,6 +22,7 @@
 @property(assign, nonatomic) int shouldUseCFPreferences;
 @property(assign, nonatomic) int enableGLAcceleration;
 @property(assign, nonatomic) int ID;
+ at property(assign, nonatomic) int hasADog;
 @end
 
 @interface Foo (Bar)




More information about the cfe-commits mailing list