Skip to content

Commit 36de9b4

Browse files
Update valueflow.cpp
1 parent 81dc8d5 commit 36de9b4

1 file changed

Lines changed: 0 additions & 38 deletions

File tree

‎lib/valueflow.cpp‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -691,44 +691,6 @@ static void valueFlowArray(TokenList& tokenlist, const Settings& settings)
691691
}
692692
}
693693

694-
static bool isNonZero(const Token* tok)
695-
{
696-
return tok && (!tok->hasKnownIntValue() || tok->getKnownIntValue() != 0);
697-
}
698-
699-
static void valueFlowArrayBool(TokenList& tokenlist, const Settings& settings)
700-
{
701-
for (Token* tok = tokenlist.front(); tok; tok = tok->next()) {
702-
if (tok->hasKnownIntValue())
703-
continue;
704-
const Variable* var = nullptr;
705-
bool known = false;
706-
const auto val =
707-
std::find_if(tok->values().cbegin(), tok->values().cend(), std::mem_fn(&ValueFlow::Value::isTokValue));
708-
if (val == tok->values().end()) {
709-
var = tok->variable();
710-
known = true;
711-
} else {
712-
var = val->tokvalue->variable();
713-
known = val->isKnown();
714-
}
715-
if (!var)
716-
continue;
717-
if (!var->isArray() || var->isArgument() || var->isStlType())
718-
continue;
719-
if (isNonZero(tok->astSibling()) && Token::Match(tok->astParent(), "%comp%"))
720-
continue;
721-
// TODO: Check for function argument
722-
if ((astIsBool(tok->astParent()) && !Token::Match(tok->astParent(), "(|%name%")) ||
723-
(tok->astParent() && Token::Match(tok->astParent()->previous(), "if|while|for ("))) {
724-
ValueFlow::Value value{1};
725-
if (known)
726-
value.setKnown();
727-
setTokenValue(tok, std::move(value), settings);
728-
}
729-
}
730-
}
731-
732694
static void valueFlowArrayElement(TokenList& tokenlist, const Settings& settings)
733695
{
734696
for (Token* tok = tokenlist.front(); tok; tok = tok->next()) {

0 commit comments

Comments
 (0)