parent
cb03b9883f
commit
df9df70ba7
|
@ -150,9 +150,9 @@ static bool isInLoopCondition(const Token * tok)
|
||||||
/// If tok2 comes after tok1
|
/// If tok2 comes after tok1
|
||||||
static bool precedes(const Token * tok1, const Token * tok2)
|
static bool precedes(const Token * tok1, const Token * tok2)
|
||||||
{
|
{
|
||||||
if(!tok1)
|
if (!tok1)
|
||||||
return false;
|
return false;
|
||||||
if(!tok2)
|
if (!tok2)
|
||||||
return false;
|
return false;
|
||||||
return tok1->progressValue() < tok2->progressValue();
|
return tok1->progressValue() < tok2->progressValue();
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ static const Token * followVariableExpression(const Token * tok, bool cpp, const
|
||||||
if (!tok)
|
if (!tok)
|
||||||
return tok;
|
return tok;
|
||||||
// Skip following variables that is across multiple files
|
// Skip following variables that is across multiple files
|
||||||
if(end && end->fileIndex() != tok->fileIndex())
|
if (end && end->fileIndex() != tok->fileIndex())
|
||||||
return tok;
|
return tok;
|
||||||
// Skip array access
|
// Skip array access
|
||||||
if (Token::Match(tok, "%var% ["))
|
if (Token::Match(tok, "%var% ["))
|
||||||
|
@ -216,7 +216,7 @@ static const Token * followVariableExpression(const Token * tok, bool cpp, const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const Variable * var2 = tok2->variable()) {
|
if (const Variable * var2 = tok2->variable()) {
|
||||||
if(!var2->scope())
|
if (!var2->scope())
|
||||||
return tok;
|
return tok;
|
||||||
const Token * endToken2 = var2->scope() != tok->scope() ? var2->scope()->bodyEnd : endToken;
|
const Token * endToken2 = var2->scope() != tok->scope() ? var2->scope()->bodyEnd : endToken;
|
||||||
if (!var2->isLocal() && !var2->isConst() && !var2->isArgument())
|
if (!var2->isLocal() && !var2->isConst() && !var2->isArgument())
|
||||||
|
@ -226,7 +226,7 @@ static const Token * followVariableExpression(const Token * tok, bool cpp, const
|
||||||
if (!var2->isConst() && isVariableChanged(tok2, endToken2, tok2->varId(), false, nullptr, cpp))
|
if (!var2->isConst() && isVariableChanged(tok2, endToken2, tok2->varId(), false, nullptr, cpp))
|
||||||
return tok;
|
return tok;
|
||||||
// Recognized as a variable but the declaration is unknown
|
// Recognized as a variable but the declaration is unknown
|
||||||
} else if(tok2->varId() > 0) {
|
} else if (tok2->varId() > 0) {
|
||||||
return tok;
|
return tok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -583,7 +583,7 @@ void CheckCondition::multiCondition2()
|
||||||
tokens1.push(firstCondition->astOperand1());
|
tokens1.push(firstCondition->astOperand1());
|
||||||
tokens1.push(firstCondition->astOperand2());
|
tokens1.push(firstCondition->astOperand2());
|
||||||
} else if (!firstCondition->hasKnownValue()) {
|
} else if (!firstCondition->hasKnownValue()) {
|
||||||
if(isOppositeCond(false, mTokenizer->isCPP(), firstCondition, cond2, mSettings->library, true, &errorPath)) {
|
if (isOppositeCond(false, mTokenizer->isCPP(), firstCondition, cond2, mSettings->library, true, &errorPath)) {
|
||||||
if (!isAliased(vars))
|
if (!isAliased(vars))
|
||||||
oppositeInnerConditionError(firstCondition, cond2, errorPath);
|
oppositeInnerConditionError(firstCondition, cond2, errorPath);
|
||||||
} else if (isSameExpression(mTokenizer->isCPP(), true, firstCondition, cond2, mSettings->library, true, &errorPath)) {
|
} else if (isSameExpression(mTokenizer->isCPP(), true, firstCondition, cond2, mSettings->library, true, &errorPath)) {
|
||||||
|
|
Loading…
Reference in New Issue