checkautovariables: Simplify some conditions

This commit is contained in:
Boris Egorov 2015-07-05 17:15:13 +02:00 committed by Daniel Marjamäki
parent f3b4c1d0db
commit f7c6140e1a
1 changed files with 2 additions and 4 deletions

View File

@ -159,8 +159,7 @@ void CheckAutoVariables::autoVariables()
} else if (Token::Match(tok, "[;{}] %var% . %var% = & %var%")) {
// TODO: check if the parameter is only changed temporarily (#2969)
if (printInconclusive) {
const Variable * var1 = tok->next()->variable();
if (var1 && var1->isArgument() && var1->isPointer()) {
if (isPtrArg(tok->next())) {
const Token * const var2tok = tok->tokAt(6);
if (isAutoVar(var2tok) && checkRvalueExpression(var2tok))
errorAutoVariableAssignment(tok->next(), true);
@ -170,8 +169,7 @@ void CheckAutoVariables::autoVariables()
} else if (Token::Match(tok, "[;{}] %var% . %var% = %var% ;")) {
// TODO: check if the parameter is only changed temporarily (#2969)
if (printInconclusive) {
const Variable * var1 = tok->next()->variable();
if (var1 && var1->isArgument() && var1->isPointer()) {
if (isPtrArg(tok->next())) {
if (isAutoVarArray(tok->tokAt(5)))
errorAutoVariableAssignment(tok->next(), true);
}