[clang-tools-extra] [clang-tidy] Fix default abbreviations in readability-suspicious-call-argument (PR #228876)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 4 05:40:15 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy
Author: Zeyi Xu (zeyi2)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/228876.diff
3 Files Affected:
- (modified) clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp (+1-1)
- (modified) clang-tools-extra/docs/ReleaseNotes.md (+4)
- (modified) clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp (+6)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
index 49c327ad77177..6816feb892704 100644
--- a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
@@ -100,7 +100,7 @@ static constexpr StringRef DefaultAbbreviations = "addr=address;"
"col=column;"
"cpy=copy;"
"dest=destination;"
- "dist=distance"
+ "dist=distance;"
"dst=distance;"
"elem=element;"
"hght=height;"
diff --git a/clang-tools-extra/docs/ReleaseNotes.md b/clang-tools-extra/docs/ReleaseNotes.md
index 41aa783cabd24..09d616231ac88 100644
--- a/clang-tools-extra/docs/ReleaseNotes.md
+++ b/clang-tools-extra/docs/ReleaseNotes.md
@@ -326,6 +326,10 @@ infrastructure are described first, followed by tool-specific sections.
<clang-tidy/checks/readability/simplify-boolean-expr>` producing invalid
fixes when applying De Morgan's theorem to overloaded comparison operators.
+- Improved {doc}`readability-suspicious-call-argument
+ <clang-tidy/checks/readability/suspicious-call-argument>` check by fixing the
+ default `dist` and `dst` abbreviations of `distance` not being recognized.
+
- Improved {doc}`readability-trailing-comma
<clang-tidy/checks/readability/trailing-comma>` check:
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp
index 27c007ea278b2..612c387687e24 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp
@@ -16,6 +16,8 @@ void foo_7(int aaaaaa, int bbbbbb, int cccccc, int ffffff = 7) {}
void foo_8(int frobble1, int frobble2) {}
+void foo_9(int distance, int bbbbbb) {}
+
// Test functions for convertible argument--parameter types.
void fun(const int &m);
void fun2() {
@@ -409,6 +411,10 @@ int main() {
foo_2(aaaaaa, src);
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 1st argument 'aaaaaa' (passed to 'source') looks like it might be swapped with the 2nd, 'src' (passed to 'aaaaaa')
+ int dst = 0;
+ foo_9(cccccc, dst);
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 1st argument 'cccccc' (passed to 'distance') looks like it might be swapped with the 2nd, 'dst' (passed to 'bbbbbb')
+
// Levenshtein test.
int aaaabb = 0;
foo_1(cccccc, aaaabb);
``````````
</details>
https://github.com/llvm/llvm-project/pull/228876
More information about the cfe-commits
mailing list