Fixed false positive stlIfStrFind for function call inside condition.
Removed unnecessary suppressions in .travis_suppressions
This commit is contained in:
parent
8fd62e0cf9
commit
12af125fd3
|
@ -7,9 +7,6 @@ uselessAssignmentPtrArg:build/tokenize.cpp
|
|||
*:test/test.cxx
|
||||
*:test/cfg*
|
||||
|
||||
*:democlient*
|
||||
*:externals*
|
||||
*:htdocs*
|
||||
*:htmlreport*
|
||||
*:samples*
|
||||
*:win_installer*
|
||||
|
|
|
@ -655,11 +655,14 @@ void CheckStl::if_find()
|
|||
if ((i->type != Scope::eIf && i->type != Scope::eWhile) || !i->classDef)
|
||||
continue;
|
||||
|
||||
for (const Token *tok = i->classDef; tok->str() != "{"; tok = tok->next()) {
|
||||
for (const Token *tok = i->classDef->next(); tok->str() != "{"; tok = tok->next()) {
|
||||
const Token* funcTok = nullptr;
|
||||
const Library::Container* container = nullptr;
|
||||
|
||||
if (tok->variable() && Token::Match(tok, "%var% . %name% (")) {
|
||||
if (Token::Match(tok, "%name% ("))
|
||||
tok = tok->linkAt(1);
|
||||
|
||||
else if (tok->variable() && Token::Match(tok, "%var% . %name% (")) {
|
||||
container = _settings->library.detectContainer(tok->variable()->typeStartToken());
|
||||
funcTok = tok->tokAt(2);
|
||||
}
|
||||
|
|
|
@ -1721,6 +1721,11 @@ private:
|
|||
" if (a.find(\"<\") < b.find(\">\")) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(const std::string &s) {\n"
|
||||
" if (foo(s.find(\"abc\"))) { }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue