Author: Zeyi Xu Date: 2026-10-05T04:14:56Z New Revision: 9dacdcba7468b9a0ebd000b2ce797c2a85bd9319
URL: https://github.com/llvm/llvm-project/commit/9dacdcba7468b9a0ebd000b2ce797c2a85bd9319 DIFF: https://github.com/llvm/llvm-project/commit/9dacdcba7468b9a0ebd000b2ce797c2a85bd9319.diff LOG: [clang-tidy] Fix default abbreviations in readability-suspicious-call-argument (#228876) The default `Abbreviations` list was missing a `;` after `dist=distance`. This PR fixes the problem. AI Usage: Assisted by Opus 5.5 Added: Modified: clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp clang-tools-extra/docs/ReleaseNotes.md clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp Removed: ################################################################################ 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); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
