1 .. title:: clang-tidy - readability-inconsistent-declaration-parameter-name
3 readability-inconsistent-declaration-parameter-name
4 ===================================================
6 Find function declarations which differ in parameter names.
13 void foo(int a, int b, int c);
16 void foo(int d, int e, int f); // warning
18 This check should help to enforce consistency in large projects, where it often
19 happens that a definition of function is refactored, changing the parameter
20 names, but its declaration in header file is not updated. With this check, we
21 can easily find and correct such inconsistencies, keeping declaration and
22 definition always in sync.
24 Unnamed parameters are allowed and are not taken into account when comparing
25 function declarations, for example:
30 void foo(int); // no warning
32 One name is also allowed to be a case-insensitive prefix/suffix of the other:
37 void foo(int count_input) { // no warning
38 int count = adjustCount(count_input);
41 To help with refactoring, in some cases fix-it hints are generated to align
42 parameter names to a single naming convention. This works with the assumption
43 that the function definition is the most up-to-date version, as it directly
44 references parameter names in its body. Example:
48 void foo(int a); // warning and fix-it hint (replace "a" to "b")
49 int foo(int b) { return b + 2; } // definition with use of "b"
51 In the case of multiple redeclarations or function template specializations,
52 a warning is issued for every redeclaration or specialization inconsistent with
53 the definition or the first declaration seen in a translation unit.
55 .. option:: IgnoreMacros
57 If this option is set to `true` (default is `true`), the check will not warn
58 about names declared inside macros.
62 If this option is set to `true` (default is `false`), then names must match
63 exactly (or be absent).