File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ void ConvertMemberFunctionsToStatic::registerMatchers(MatchFinder *Finder) {
81
81
unless (anyOf (
82
82
isExpansionInSystemHeader (), isVirtual (), isStatic (),
83
83
hasTrivialBody (), isOverloadedOperator (), cxxConstructorDecl (),
84
- cxxDestructorDecl (), cxxConversionDecl (), isTemplate (),
84
+ cxxDestructorDecl (), cxxConversionDecl (),
85
+ isExplicitObjectMemberFunction (), isTemplate (),
85
86
isDependentContext (),
86
87
ofClass (anyOf (
87
88
isLambda (),
Original file line number Diff line number Diff line change @@ -256,6 +256,10 @@ Changes in existing checks
256
256
tolerating fix-it breaking compilation when functions is used as pointers
257
257
to avoid matching usage of functions within the current compilation unit.
258
258
259
+ - Improved :doc: `readability-convert-member-functions-to-static
260
+ <clang-tidy/checks/readability/convert-member-functions-to-static>` check by
261
+ fixing false positives on member functions with an explicit object parameter.
262
+
259
263
- Improved :doc: `readability-math-missing-parentheses
260
264
<clang-tidy/checks/readability/math-missing-parentheses>` check by fixing
261
265
false negatives where math expressions are the operand of assignment operators
Original file line number Diff line number Diff line change
1
+ // RUN: %check_clang_tidy -std=c++23-or-later %s readability-convert-member-functions-to-static %t
2
+
3
+ namespace std {
4
+ class string {};
5
+ void println (const char *format, const std::string &str) {}
6
+ }
7
+
8
+ struct Hello {
9
+ std::string str_;
10
+
11
+ void ByValueSelf (this Hello self) { std::println (" Hello, {0}!" , self.str_ ); }
12
+
13
+ void ByLRefSelf (this Hello &self) { std::println (" Hello, {0}!" , self.str_ ); }
14
+
15
+ void ByRRefSelf (this Hello&& self) {}
16
+
17
+ template <typename Self> void ByForwardRefSelf (this Self&& self) {}
18
+
19
+ void MultiParam (this Hello &self, int a, double b) {}
20
+
21
+ void UnnamedExplicitObjectParam (this Hello &) {}
22
+ };
You can’t perform that action at this time.
0 commit comments