[clang-tools-extra] 65fa0a9 - [clang-tidy] Added MacroDefiniton docs for readability-identifier-naming

Nathan James via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 3 01:23:44 PDT 2020


Author: Nathan James
Date: 2020-06-03T09:23:32+01:00
New Revision: 65fa0a9f7f3e6090e335c14f9edea19358d87613

URL: https://github.com/llvm/llvm-project/commit/65fa0a9f7f3e6090e335c14f9edea19358d87613
DIFF: https://github.com/llvm/llvm-project/commit/65fa0a9f7f3e6090e335c14f9edea19358d87613.diff

LOG: [clang-tidy] Added MacroDefiniton docs for readability-identifier-naming

Updates the docs to include `MacroDefinition` documentation. The docs are still missing `ObjCIVar` however I don't have a clue about how that looks in code. If someone wants to show the code block needed for the example I'll add that in too.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D80877

Added: 
    

Modified: 
    clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst b/clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
index 3d0cbca69f6d..eefa5234fb21 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
@@ -62,6 +62,7 @@ The following options are describe below:
  - :option:`LocalConstantPointerCase`, :option:`LocalConstantPointerPrefix`, :option:`LocalConstantPointerSuffix`
  - :option:`LocalPointerCase`, :option:`LocalPointerPrefix`, :option:`LocalPointerSuffix`
  - :option:`LocalVariableCase`, :option:`LocalVariablePrefix`, :option:`LocalVariableSuffix`
+ - :option:`MacroDefinitionCase`, :option:`MacroDefinitionPrefix`, :option:`MacroDefinitionSuffix`
  - :option:`MemberCase`, :option:`MemberPrefix`, :option:`MemberSuffix`
  - :option:`MethodCase`, :option:`MethodPrefix`, :option:`MethodSuffix`
  - :option:`NamespaceCase`, :option:`NamespacePrefix`, :option:`NamespaceSuffix`
@@ -1076,6 +1077,44 @@ After:
 
     void foo() { int pre_local_constant_post; }
 
+.. option:: MacroDefinitionCase
+
+    When defined, the check will ensure macro definitions conform to the
+    selected casing.
+
+.. option:: MacroDefinitionPrefix
+
+    When defined, the check will ensure macro definitions will add the
+    prefixed with the given value (regardless of casing).
+
+.. option:: MacroDefinitionSuffix
+
+    When defined, the check will ensure macro definitions will add the
+    suffix with the given value (regardless of casing).
+
+For example using values of:
+
+   - MacroDefinitionCase of ``lower_case``
+   - MacroDefinitionPrefix of ``pre_``
+   - MacroDefinitionSuffix of ``_post``
+
+Identifies and/or transforms macro definitions as follows:
+
+Before:
+
+.. code-block:: c
+
+    #define MY_MacroDefinition
+
+After:
+
+.. code-block:: c
+
+    #define pre_my_macro_definition_post
+
+Note: This will not warn on builtin macros or macros defined on the command line
+using the ``-D`` flag.
+
 .. option:: MemberCase
 
     When defined, the check will ensure member names conform to the


        


More information about the cfe-commits mailing list