aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
diff options
context:
space:
mode:
authorWhisperity <whisperity@gmail.com>2017-09-05 12:58:20 +0200
committerWhisperity <whisperity@gmail.com>2021-07-19 10:18:09 +0200
commit73e4b5cfa8ea6dda3624e03beb60827db12bb3a3 (patch)
tree9c8ef6650f3d45fcbeb672935b0411dd3f2d601b /clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
parent34d6820551c6ee7e76199407b3c1ba6fecf4398f (diff)
downloadllvm-73e4b5cfa8ea6dda3624e03beb60827db12bb3a3.zip
llvm-73e4b5cfa8ea6dda3624e03beb60827db12bb3a3.tar.gz
llvm-73e4b5cfa8ea6dda3624e03beb60827db12bb3a3.tar.bz2
[clang-tidy] Add 'readability-suspicious-call-argument' check
Finds function calls where the call arguments might be provided in an incorrect order, based on the comparison (via string metrics) of the parameter names and the argument names against each other. A diagnostic is emitted if an argument name is similar to a *different* parameter than the one currently passed to, and it is sufficiently dissimilar to the one it **is** passed to currently. False-positive warnings from this check are useful to indicate bad naming convention issues, even if a swap isn't necessary. This check does not generate FixIts. Originally implemented by @varjujan as his Master's Thesis work. The check was subsequently taken over by @barancsuk who added type conformity checks to silence false positive matches. The work by @whisperity involved driving the check's review and fixing some more bugs in the process. Reviewed By: aaron.ballman, alexfh Differential Revision: http://reviews.llvm.org/D20689 Co-authored-by: János Varjú <varjujanos2@gmail.com> Co-authored-by: Lilla Barancsuk <barancsuklilla@gmail.com>
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index 088b9f0..a05b708 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -43,6 +43,7 @@
#include "StaticAccessedThroughInstanceCheck.h"
#include "StaticDefinitionInAnonymousNamespaceCheck.h"
#include "StringCompareCheck.h"
+#include "SuspiciousCallArgumentCheck.h"
#include "UniqueptrDeleteReleaseCheck.h"
#include "UppercaseLiteralSuffixCheck.h"
#include "UseAnyOfAllOfCheck.h"
@@ -122,6 +123,8 @@ public:
"readability-redundant-string-init");
CheckFactories.registerCheck<SimplifyBooleanExprCheck>(
"readability-simplify-boolean-expr");
+ CheckFactories.registerCheck<SuspiciousCallArgumentCheck>(
+ "readability-suspicious-call-argument");
CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>(
"readability-uniqueptr-delete-release");
CheckFactories.registerCheck<UppercaseLiteralSuffixCheck>(