[PATCH] D51575: [clang-tidy] Implement a clang-tidy check to verify Google Objective-C function naming conventions ๐Ÿ“œ

Stephane Moore via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 1 22:11:44 PDT 2018


stephanemoore created this revision.
Herald added subscribers: cfe-commits, xazax.hun, mgorny.

ยง1 Description

This check finds function names in function definitions in Objective-C files that do not follow the naming pattern described in the Google Objective-C Style Guide. Function names should be in UpperCamelCase and functions that are not of static storage class should have an appropriate prefix as described in the Google Objective-C Style Guide. The function `main` is a notable exception.

Example conforming function definitions:

  static bool IsPositive(int i) { return i > 0; }
  static bool ABIsPositive(int i) { return i > 0; }
  bool ABIsNegative(int i) { return i < 0; }

ยง2 Test Notes

- Verified clang-tidy tests pass successfully.
- Used check_clang_tidy.py to verify expected output of processing google-objc-function-naming.m


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51575

Files:
  clang-tidy/google/CMakeLists.txt
  clang-tidy/google/FunctionNamingCheck.cpp
  clang-tidy/google/FunctionNamingCheck.h
  clang-tidy/google/GoogleTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/google-objc-function-naming.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/google-objc-function-naming.m
  unittests/clang-tidy/GoogleModuleTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51575.163637.patch
Type: text/x-patch
Size: 12236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180902/5c50f9be/attachment-0001.bin>


More information about the cfe-commits mailing list