[PATCH] D46374: Add support for ObjC property name to be a single acronym.

Yan Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 2 18:48:43 PDT 2018


Wizard updated this revision to Diff 144970.
Wizard edited the summary of this revision.
Wizard added a comment.

fix format


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D46374

Files:
  clang-tidy/objc/PropertyDeclarationCheck.cpp
  test/clang-tidy/objc-property-declaration.m


Index: test/clang-tidy/objc-property-declaration.m
===================================================================
--- test/clang-tidy/objc-property-declaration.m
+++ 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;
+ at property(assign, nonatomic) int ID;
 @end
 
 @interface Foo (Bar)
Index: clang-tidy/objc/PropertyDeclarationCheck.cpp
===================================================================
--- clang-tidy/objc/PropertyDeclarationCheck.cpp
+++ 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);
+  if (std::any_of(EscapedAcronyms.begin(), EscapedAcronyms.end(),
+                  [MatchedDecl](std::string const &s) {
+                    return s == MatchedDecl->getName();
+                  })) {
+    return;
+  }
   if (CategoryDecl != nullptr &&
       hasCategoryPropertyPrefix(MatchedDecl->getName())) {
     if (!prefixedPropertyNameValid(MatchedDecl->getName(), EscapedAcronyms) ||


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46374.144970.patch
Type: text/x-patch
Size: 1282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180503/c7e56be7/attachment.bin>


More information about the cfe-commits mailing list