summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2015-09-10 10:07:11 +0000
committerAlexander Kornienko <alexfh@google.com>2015-09-10 10:07:11 +0000
commit11d4d6446e097ef12ee106446486276e8a8c79b0 (patch)
treefbc3710e85328ba618c458b545bccd74fd7a8049 /clang-tools-extra/docs/clang-tidy
parent1d7f0faf93eefa7624b611cd0636a2f62f44efe9 (diff)
downloadbcm5719-llvm-11d4d6446e097ef12ee106446486276e8a8c79b0.tar.gz
bcm5719-llvm-11d4d6446e097ef12ee106446486276e8a8c79b0.zip
[clang-tidy] Add inconsistent declaration parameter name check
This is first of series of patches, porting code from my project colobot-lint, as I mentioned recently in cfe-dev mailing list. This patch adds a new check in readability module: readability-inconsistent-declaration-parameter-name. I also added appropriate testcases and documentation. I chose readability module, as it seems it is the best place for it. I think I followed the rules of LLVM coding guideline, but I may have missed something, as I usually use other code formatting style. http://reviews.llvm.org/D12462 Patch by Piotr Dziwinski! llvm-svn: 247261
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy')
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/list.rst1
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.rst32
2 files changed, 33 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index abd5b8ef395..be7bf3b0f71 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -50,6 +50,7 @@ List of clang-tidy Checks
readability-else-after-return
readability-function-size
readability-identifier-naming
+ readability-inconsistent-declaration-parameter-name
readability-named-parameter
readability-redundant-smartptr-get
readability-redundant-string-cstr
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.rst b/clang-tools-extra/docs/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.rst
new file mode 100644
index 00000000000..872fee747da
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.rst
@@ -0,0 +1,32 @@
+readability-inconsistent-declaration-parameter-name
+===================================================
+
+
+Find function declarations which differ in parameter names.
+
+Example:
+
+.. code:: c++
+
+ // in foo.hpp:
+ void foo(int a, int b, int c);
+
+ // in foo.cpp:
+ void foo(int d, int e, int f); // warning
+
+This check should help to enforce consistency in large projects, where it often
+happens that a definition of function is refactored, changing the parameter
+names, but its declaration in header file is not updated. With this check, we
+can easily find and correct such inconsistencies, keeping declaration and
+definition always in sync.
+
+Unnamed parameters are allowed and are not taken into account when comparing
+function declarations, for example:
+
+.. code:: c++
+
+ void foo(int a);
+ void foo(int); // no warning
+
+If there are multiple declarations of same function, only one warning will be
+generated.
OpenPOWER on IntegriCloud