@@ -35,27 +35,24 @@ void SuspiciousMemsetUsageCheck::registerMatchers(MatchFinder *Finder) {
35
35
callee (MemsetDecl),
36
36
hasArgument (1 , characterLiteral (equals (static_cast <unsigned >(' 0' )))
37
37
.bind (" char-zero-fill" )),
38
- unless (
39
- eachOf (hasArgument (0 , anyOf (hasType (pointsTo (isAnyCharacter ())),
40
- hasType (arrayType (hasElementType (
41
- isAnyCharacter ()))))),
42
- isInTemplateInstantiation ()))),
38
+ unless (hasArgument (
39
+ 0 , anyOf (hasType (pointsTo (isAnyCharacter ())),
40
+ hasType (arrayType (hasElementType (isAnyCharacter ()))))))),
43
41
this );
44
42
45
43
// Look for memset with an integer literal in its fill_char argument.
46
44
// Will check if it gets truncated.
47
- Finder->addMatcher (callExpr ( callee (MemsetDecl),
48
- hasArgument ( 1 , integerLiteral (). bind ( " num-fill " ) ),
49
- unless ( isInTemplateInstantiation ( ))),
50
- this );
45
+ Finder->addMatcher (
46
+ callExpr ( callee (MemsetDecl ),
47
+ hasArgument ( 1 , integerLiteral (). bind ( " num-fill " ))),
48
+ this );
51
49
52
50
// Look for memset(x, y, 0) as that is most likely an argument swap.
53
51
Finder->addMatcher (
54
52
callExpr (callee (MemsetDecl),
55
53
unless (hasArgument (1 , anyOf (characterLiteral (equals (
56
54
static_cast <unsigned >(' 0' ))),
57
- integerLiteral ()))),
58
- unless (isInTemplateInstantiation ()))
55
+ integerLiteral ()))))
59
56
.bind (" call" ),
60
57
this );
61
58
}
0 commit comments