@@ -90,11 +90,8 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
90
90
const auto IntegerCallExpr = ignoringParenImpCasts (
91
91
callExpr (anyOf (hasType (isInteger ()), hasType (enumType ())),
92
92
unless (isInTemplateInstantiation ())));
93
- const auto SizeOfExpr = expr (anyOf (
94
- sizeOfExpr (
95
- has (hasUnqualifiedDesugaredType (type ().bind (" sizeof-arg-type" )))),
96
- sizeOfExpr (has (expr (hasType (
97
- hasUnqualifiedDesugaredType (type ().bind (" sizeof-arg-type" ))))))));
93
+ const auto SizeOfExpr = sizeOfExpr (hasArgumentOfType (
94
+ hasUnqualifiedDesugaredType (type ().bind (" sizeof-arg-type" ))));
98
95
const auto SizeOfZero =
99
96
sizeOfExpr (has (ignoringParenImpCasts (integerLiteral (equals (0 )))));
100
97
@@ -184,9 +181,8 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
184
181
Finder->addMatcher (
185
182
binaryOperator (matchers::isRelationalOperator (),
186
183
hasOperands (ignoringParenImpCasts (SizeOfExpr),
187
- ignoringParenImpCasts (anyOf (
188
- integerLiteral (equals (0 )),
189
- integerLiteral (isBiggerThan (0x80000 ))))))
184
+ ignoringParenImpCasts (integerLiteral (anyOf (
185
+ equals (0 ), isBiggerThan (0x80000 ))))))
190
186
.bind (" sizeof-compare-constant" ),
191
187
this );
192
188
}
@@ -207,18 +203,15 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
207
203
const auto ElemType =
208
204
arrayType (hasElementType (recordType ().bind (" elem-type" )));
209
205
const auto ElemPtrType = pointerType (pointee (type ().bind (" elem-ptr-type" )));
210
- const auto NumType = hasCanonicalType (
211
- type (anyOf (ElemType, ElemPtrType, type ())).bind (" num-type" ));
212
- const auto DenomType = hasCanonicalType (type ().bind (" denom-type" ));
213
206
214
207
Finder->addMatcher (
215
- binaryOperator (hasOperatorName ( " / " ),
216
- hasLHS ( expr ( ignoringParenImpCasts (
217
- anyOf ( sizeOfExpr (has (NumType)),
218
- sizeOfExpr ( has ( expr ( hasType (NumType )))))))),
219
- hasRHS ( expr ( ignoringParenImpCasts (
220
- anyOf ( sizeOfExpr (has (DenomType)),
221
- sizeOfExpr ( has ( expr ( hasType (DenomType)) )))))))
208
+ binaryOperator (
209
+ hasOperatorName ( " / " ),
210
+ hasLHS ( ignoringParenImpCasts ( sizeOfExpr (hasArgumentOfType (
211
+ hasCanonicalType ( type ( anyOf (ElemType, ElemPtrType, type ( )))
212
+ . bind ( " num-type " )))))),
213
+ hasRHS ( ignoringParenImpCasts ( sizeOfExpr (
214
+ hasArgumentOfType ( hasCanonicalType ( type (). bind ( " denom-type " )))))))
222
215
.bind (" sizeof-divide-expr" ),
223
216
this );
224
217
0 commit comments