[clang-tools-extra] [clang-tidy] Fix false positive in readability-convert-member-functions-to-static for const overloads (PR #191712)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 21 09:50:41 PDT 2026
================
@@ -135,6 +159,9 @@ void ConvertMemberFunctionsToStaticCheck::check(
const MatchFinder::MatchResult &Result) {
const auto *Definition = Result.Nodes.getNodeAs<CXXMethodDecl>("x");
+ if (Definition->isConst() && hasNonConstOverload(*Definition))
+ return;
----------------
vbvictor wrote:
As of
```
clang-tools-extra/clang-tidy/readability/ConvertMemberFunctionsToStaticCheck.cpp:79:13: warning: place static function 'hasSameParameterTypes' outside of an anonymous namespace [llvm-prefer-static-over-anonymous-namespace]
79 | static bool hasSameParameterTypes(const CXXMethodDecl &MD1,
| ^
```
You should have placed the function in the beginning of the file, above matchers (and made it static)
https://github.com/llvm/llvm-project/pull/191712
More information about the cfe-commits
mailing list