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/test.cxx
|
||||||
*:test/cfg*
|
*:test/cfg*
|
||||||
|
|
||||||
*:democlient*
|
|
||||||
*:externals*
|
*:externals*
|
||||||
*:htdocs*
|
|
||||||
*:htmlreport*
|
*:htmlreport*
|
||||||
*:samples*
|
*:samples*
|
||||||
*:win_installer*
|
|
||||||
|
|
|
@ -655,11 +655,14 @@ void CheckStl::if_find()
|
||||||
if ((i->type != Scope::eIf && i->type != Scope::eWhile) || !i->classDef)
|
if ((i->type != Scope::eIf && i->type != Scope::eWhile) || !i->classDef)
|
||||||
continue;
|
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 Token* funcTok = nullptr;
|
||||||
const Library::Container* container = 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());
|
container = _settings->library.detectContainer(tok->variable()->typeStartToken());
|
||||||
funcTok = tok->tokAt(2);
|
funcTok = tok->tokAt(2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1721,6 +1721,11 @@ private:
|
||||||
" if (a.find(\"<\") < b.find(\">\")) {}\n"
|
" if (a.find(\"<\") < b.find(\">\")) {}\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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