[PATCH] D45392: [clang-tidy] add new check to find out objc ivars which do not have prefix '_'

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 6 17:23:02 PDT 2018


Eugene.Zelenko added a comment.

If this is Apple guideline, check name should reflect this. I think will be good idea to have general check for Apple naming conventions instead of separate checks for specific situations like //objc-ivar-declaration// and //objc-property-declaration//.



================
Comment at: clang-tidy/objc/IvarDeclarationCheck.cpp:23
+
+FixItHint generateFixItHint(const ObjCIvarDecl *Decl) {
+  auto IvarName = Decl->getName();
----------------
Please use static instead of anonymous namespace.


================
Comment at: clang-tidy/objc/IvarDeclarationCheck.cpp:24
+FixItHint generateFixItHint(const ObjCIvarDecl *Decl) {
+  auto IvarName = Decl->getName();
+  if (IvarName[0] != '_') {
----------------
Please don't use auto when type could not be deduced from statement. Same in other places.


================
Comment at: docs/ReleaseNotes.rst:60
 
+- New :doc:`objc-ivar-declaration
+  <clang-tidy/checks/objc-ivar-declaration>` check
----------------
Please place in new check list in alphabetical order.


================
Comment at: docs/ReleaseNotes.rst:63
+
+  New check that finds Objective-C ivars that do not have a '_' prefix.
+
----------------
Please remove //New check that//.


================
Comment at: docs/clang-tidy/checks/objc-ivar-declaration.rst:6
+
+Finds ivar declarations in Objective-C files that do not follow the pattern
+in Apple's programming guide. The ivar name should be fixed with '_'.
----------------
Please synchronize first statement with Release Notes.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45392





More information about the cfe-commits mailing list