Fixed #7349 (checker 'inefficient find()' unintentionally used for find_first_of())
This commit is contained in:
parent
8ef17e70ca
commit
fa31ebf88e
|
@ -700,7 +700,7 @@ void CheckStl::if_find()
|
|||
|
||||
if (printWarning && container->getYield(funcTok->str()) == Library::Container::ITERATOR)
|
||||
if_findError(tok, false);
|
||||
else if (printPerformance && container->stdStringLike)
|
||||
else if (printPerformance && container->stdStringLike && funcTok->str() == "find")
|
||||
if_findError(tok, true);
|
||||
} else if (printWarning && Token::Match(tok, "std :: find|find_if (")) {
|
||||
// check that result is checked properly
|
||||
|
|
|
@ -1726,6 +1726,12 @@ private:
|
|||
" if (foo(s.find(\"abc\"))) { }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #7349 - std::string::find_first_of
|
||||
check("void f(const std::string &s) {\n"
|
||||
" if (s.find_first_of(\"abc\")==0) { }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue