This revision was automatically updated to reflect the committed changes.
Wizard marked an inline comment as done.
Closed by commit rL331545: Add support for ObjC property name to be a single 
acronym. (authored by Wizard, committed by ).
Herald added a subscriber: llvm-commits.
Repository:
  rL LLVM

https://reviews.llvm.org/D46374

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


Index: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
@@ -21,6 +21,7 @@
 @property(assign, nonatomic) int enable2GBackgroundFetch;
 @property(assign, nonatomic) int shouldUseCFPreferences;
 @property(assign, nonatomic) int enableGLAcceleration;
+@property(assign, nonatomic) int ID;
 @end
 
 @interface Foo (Bar)
Index: 
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
@@ -14,4 +14,5 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'ABC_custom_prefix' 
not using lowerCamelCase style or not prefixed in a category, according to the 
Apple Coding Guidelines [objc-property-declaration]
 @property(assign, nonatomic) int GIFIgnoreStandardAcronym;
 // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 
'GIFIgnoreStandardAcronym' not using lowerCamelCase style or not prefixed in a 
category, according to the Apple Coding Guidelines [objc-property-declaration]
+@property(strong, nonatomic) NSString *TGIF;
 @end
Index: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
@@ -217,6 +217,12 @@
   assert(MatchedDecl->getName().size() > 0);
   auto *DeclContext = MatchedDecl->getDeclContext();
   auto *CategoryDecl = llvm::dyn_cast<ObjCCategoryDecl>(DeclContext);
+
+  auto AcronymsRegex =
+      llvm::Regex("^" + AcronymsGroupRegex(EscapedAcronyms) + "$");
+  if (AcronymsRegex.match(MatchedDecl->getName())) {
+    return;
+  }
   if (CategoryDecl != nullptr &&
       hasCategoryPropertyPrefix(MatchedDecl->getName())) {
     if (!prefixedPropertyNameValid(MatchedDecl->getName(), EscapedAcronyms) ||


Index: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
@@ -21,6 +21,7 @@
 @property(assign, nonatomic) int enable2GBackgroundFetch;
 @property(assign, nonatomic) int shouldUseCFPreferences;
 @property(assign, nonatomic) int enableGLAcceleration;
+@property(assign, nonatomic) int ID;
 @end
 
 @interface Foo (Bar)
Index: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
@@ -14,4 +14,5 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'ABC_custom_prefix' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
 @property(assign, nonatomic) int GIFIgnoreStandardAcronym;
 // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'GIFIgnoreStandardAcronym' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
+@property(strong, nonatomic) NSString *TGIF;
 @end
Index: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
@@ -217,6 +217,12 @@
   assert(MatchedDecl->getName().size() > 0);
   auto *DeclContext = MatchedDecl->getDeclContext();
   auto *CategoryDecl = llvm::dyn_cast<ObjCCategoryDecl>(DeclContext);
+
+  auto AcronymsRegex =
+      llvm::Regex("^" + AcronymsGroupRegex(EscapedAcronyms) + "$");
+  if (AcronymsRegex.match(MatchedDecl->getName())) {
+    return;
+  }
   if (CategoryDecl != nullptr &&
       hasCategoryPropertyPrefix(MatchedDecl->getName())) {
     if (!prefixedPropertyNameValid(MatchedDecl->getName(), EscapedAcronyms) ||
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to