File tree Expand file tree Collapse file tree 3 files changed +4
-3
lines changed
Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ void MisleadingSetterOfReferenceCheck::registerMatchers(MatchFinder *Finder) {
3535 anyOf (has (BinaryOpAssign), has (CXXOperatorCallAssign)));
3636 auto BadSetFunction =
3737 cxxMethodDecl (
38- parameterCountIs (1 ), isPublic (),
38+ parameterCountIs (1 ),
3939 hasParameter (
4040 0 ,
4141 parmVarDecl (hasType (hasCanonicalType (pointerType (pointee (qualType (
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ bugprone-misleading-setter-of-reference
66Finds setter-like member functions that take a pointer parameter and set a
77reference member of the same class with the pointed value.
88
9- The check detects public member functions that take a single pointer parameter,
9+ The check detects member functions that take a single pointer parameter,
1010and contain a single expression statement that dereferences the parameter and
1111assigns the result to a data member with a reference type.
1212
Original file line number Diff line number Diff line change @@ -46,8 +46,9 @@ class Test1 {
4646 MemLPub = *NewValue;
4747 }
4848
49- protected :
49+ private :
5050 void set5 (long *NewValue) {
51+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: function 'set5' can be mistakenly used in order to change the reference 'MemL' instead of the value of it
5152 MemL = *NewValue;
5253 }
5354};
You can’t perform that action at this time.
0 commit comments