checkautovariables: Simplify some conditions
This commit is contained in:
parent
f3b4c1d0db
commit
f7c6140e1a
|
@ -159,8 +159,7 @@ void CheckAutoVariables::autoVariables()
|
||||||
} else if (Token::Match(tok, "[;{}] %var% . %var% = & %var%")) {
|
} else if (Token::Match(tok, "[;{}] %var% . %var% = & %var%")) {
|
||||||
// TODO: check if the parameter is only changed temporarily (#2969)
|
// TODO: check if the parameter is only changed temporarily (#2969)
|
||||||
if (printInconclusive) {
|
if (printInconclusive) {
|
||||||
const Variable * var1 = tok->next()->variable();
|
if (isPtrArg(tok->next())) {
|
||||||
if (var1 && var1->isArgument() && var1->isPointer()) {
|
|
||||||
const Token * const var2tok = tok->tokAt(6);
|
const Token * const var2tok = tok->tokAt(6);
|
||||||
if (isAutoVar(var2tok) && checkRvalueExpression(var2tok))
|
if (isAutoVar(var2tok) && checkRvalueExpression(var2tok))
|
||||||
errorAutoVariableAssignment(tok->next(), true);
|
errorAutoVariableAssignment(tok->next(), true);
|
||||||
|
@ -170,8 +169,7 @@ void CheckAutoVariables::autoVariables()
|
||||||
} else if (Token::Match(tok, "[;{}] %var% . %var% = %var% ;")) {
|
} else if (Token::Match(tok, "[;{}] %var% . %var% = %var% ;")) {
|
||||||
// TODO: check if the parameter is only changed temporarily (#2969)
|
// TODO: check if the parameter is only changed temporarily (#2969)
|
||||||
if (printInconclusive) {
|
if (printInconclusive) {
|
||||||
const Variable * var1 = tok->next()->variable();
|
if (isPtrArg(tok->next())) {
|
||||||
if (var1 && var1->isArgument() && var1->isPointer()) {
|
|
||||||
if (isAutoVarArray(tok->tokAt(5)))
|
if (isAutoVarArray(tok->tokAt(5)))
|
||||||
errorAutoVariableAssignment(tok->next(), true);
|
errorAutoVariableAssignment(tok->next(), true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue