Skip to content

Commit dbd2e18

Browse files
Update checkstl.cpp
1 parent dfcec18 commit dbd2e18

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/checkstl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,7 @@ void CheckStlImpl::redundantCondition()
18571857
continue;
18581858

18591859
const Token* tok = scope.classDef->tokAt(2);
1860-
if (!Token::Match(tok, "%name% . find ( %any% ) != %name% . end|rend|cend|crend ( ) ) { %name% . remove|erase ( %any% ) ;"))
1860+
if (!Token::Match(tok, "%name% . find ( %any% ) != %name% . end|rend|cend|crend ( ) ) { %name% . erase ( %any% ) ;"))
18611861
continue;
18621862

18631863
// Get tokens for the fields %name% and %any%
@@ -1867,6 +1867,9 @@ void CheckStlImpl::redundantCondition()
18671867
const Token *var3 = var2->tokAt(7);
18681868
const Token *any2 = var3->tokAt(4);
18691869

1870+
if (any2->tokAt(3) != scope.bodyEnd)
1871+
continue;
1872+
18701873
// Check if all the "%name%" fields are the same and if all the "%any%" are the same..
18711874
if (var1->str() == var2->str() &&
18721875
var2->str() == var3->str() &&

0 commit comments

Comments
 (0)