@@ -62,10 +62,7 @@ void ContainerContainsCheck::registerMatchers(MatchFinder *Finder) {
62
62
.bind (" positiveComparison" ),
63
63
this );
64
64
AddSimpleMatcher (
65
- binaryOperator (hasLHS (CountCall), hasOperatorName (" !=" ), hasRHS (Literal0))
66
- .bind (" positiveComparison" ));
67
- AddSimpleMatcher (
68
- binaryOperator (hasLHS (Literal0), hasOperatorName (" !=" ), hasRHS (CountCall))
65
+ binaryOperator (hasOperatorName (" !=" ), hasOperands (CountCall, Literal0))
69
66
.bind (" positiveComparison" ));
70
67
AddSimpleMatcher (
71
68
binaryOperator (hasLHS (CountCall), hasOperatorName (" >" ), hasRHS (Literal0))
@@ -82,10 +79,7 @@ void ContainerContainsCheck::registerMatchers(MatchFinder *Finder) {
82
79
83
80
// Find inverted membership tests which use `count()`.
84
81
AddSimpleMatcher (
85
- binaryOperator (hasLHS (CountCall), hasOperatorName (" ==" ), hasRHS (Literal0))
86
- .bind (" negativeComparison" ));
87
- AddSimpleMatcher (
88
- binaryOperator (hasLHS (Literal0), hasOperatorName (" ==" ), hasRHS (CountCall))
82
+ binaryOperator (hasOperatorName (" ==" ), hasOperands (CountCall, Literal0))
89
83
.bind (" negativeComparison" ));
90
84
AddSimpleMatcher (
91
85
binaryOperator (hasLHS (CountCall), hasOperatorName (" <=" ), hasRHS (Literal0))
@@ -102,10 +96,10 @@ void ContainerContainsCheck::registerMatchers(MatchFinder *Finder) {
102
96
103
97
// Find membership tests based on `find() == end()`.
104
98
AddSimpleMatcher (
105
- binaryOperator (hasLHS (FindCall), hasOperatorName (" !=" ), hasRHS ( EndCall))
99
+ binaryOperator (hasOperatorName (" !=" ), hasOperands (FindCall, EndCall))
106
100
.bind (" positiveComparison" ));
107
101
AddSimpleMatcher (
108
- binaryOperator (hasLHS (FindCall), hasOperatorName (" ==" ), hasRHS ( EndCall))
102
+ binaryOperator (hasOperatorName (" ==" ), hasOperands (FindCall, EndCall))
109
103
.bind (" negativeComparison" ));
110
104
}
111
105
0 commit comments