Move useStlAlgorithm to normal checking (#1741)
This commit is contained in:
parent
a1ade2dd7d
commit
3615eac347
|
@ -1877,7 +1877,7 @@ static const Token *singleAssignInScope(const Token *start, unsigned int varid,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (isVariableChanged(assignTok->next(), endStatement, varid, false, nullptr, true))
|
if (isVariableChanged(assignTok->next(), endStatement, varid, false, nullptr, true))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
input = Token::findmatch(assignTok->next(), "%varid%", endStatement, varid);
|
input = Token::findmatch(assignTok->next(), "%varid%", endStatement, varid) || !Token::Match(start->next(), "%var% =");
|
||||||
return assignTok;
|
return assignTok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1957,8 +1957,7 @@ static bool addByOne(const Token *tok, unsigned int varid)
|
||||||
|
|
||||||
static bool accumulateBoolLiteral(const Token *tok, unsigned int varid)
|
static bool accumulateBoolLiteral(const Token *tok, unsigned int varid)
|
||||||
{
|
{
|
||||||
// TODO: Missing %oreq%
|
if (Token::Match(tok, "%assign% %bool% ;") &&
|
||||||
if (Token::Match(tok, "=|&= %bool% ;") &&
|
|
||||||
tok->tokAt(1)->hasKnownIntValue()) {
|
tok->tokAt(1)->hasKnownIntValue()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1971,8 +1970,8 @@ static bool accumulateBoolLiteral(const Token *tok, unsigned int varid)
|
||||||
|
|
||||||
static bool accumulateBool(const Token *tok, unsigned int varid)
|
static bool accumulateBool(const Token *tok, unsigned int varid)
|
||||||
{
|
{
|
||||||
// TODO: Missing %oreq%
|
// Missing %oreq% so we have to check both manually
|
||||||
if (Token::simpleMatch(tok, "&=")) {
|
if (Token::simpleMatch(tok, "&=") || Token::simpleMatch(tok, "|=")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Token::Match(tok, "= %varid% %oror%|%or%|&&|&", varid)) {
|
if (Token::Match(tok, "= %varid% %oror%|%or%|&&|&", varid)) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
checkStl.redundantCondition();
|
checkStl.redundantCondition();
|
||||||
checkStl.string_c_str();
|
checkStl.string_c_str();
|
||||||
checkStl.uselessCalls();
|
checkStl.uselessCalls();
|
||||||
|
checkStl.useStlAlgorithm();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Simplified checks. The token list is simplified. */
|
/** Simplified checks. The token list is simplified. */
|
||||||
|
@ -88,7 +89,6 @@ public:
|
||||||
|
|
||||||
// Style check
|
// Style check
|
||||||
checkStl.size();
|
checkStl.size();
|
||||||
checkStl.useStlAlgorithm();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Accessing container out of bounds using ValueFlow */
|
/** Accessing container out of bounds using ValueFlow */
|
||||||
|
|
Loading…
Reference in New Issue