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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 3 01:36:27 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG65fa0a9f7f3e: [clang-tidy] Added MacroDefiniton docs for readability-identifier-naming (authored by njames93).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80877/new/

https://reviews.llvm.org/D80877

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


Index: clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
+++ clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
@@ -62,6 +62,7 @@
  - :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 @@
 
     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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80877.268087.patch
Type: text/x-patch
Size: 2066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200603/14d5342e/attachment.bin>


More information about the cfe-commits mailing list