Remove redundant variable
This commit is contained in:
parent
2133350bf0
commit
beba46987d
|
@ -1965,23 +1965,20 @@ static bool isStdMoveOrStdForwarded(Token * tok, ValueFlow::Value::MoveKind * mo
|
||||||
{
|
{
|
||||||
if (tok->str() != "std")
|
if (tok->str() != "std")
|
||||||
return false;
|
return false;
|
||||||
bool isMovedOrForwarded = false;
|
|
||||||
ValueFlow::Value::MoveKind kind = ValueFlow::Value::NonMovedVariable;
|
ValueFlow::Value::MoveKind kind = ValueFlow::Value::NonMovedVariable;
|
||||||
Token * variableToken = nullptr;
|
Token * variableToken = nullptr;
|
||||||
if (Token::Match(tok, "std :: move ( %var% )")) {
|
if (Token::Match(tok, "std :: move ( %var% )")) {
|
||||||
variableToken = tok->tokAt(4);
|
variableToken = tok->tokAt(4);
|
||||||
isMovedOrForwarded = true;
|
|
||||||
kind = ValueFlow::Value::MovedVariable;
|
kind = ValueFlow::Value::MovedVariable;
|
||||||
} else if (Token::simpleMatch(tok, "std :: forward <")) {
|
} else if (Token::simpleMatch(tok, "std :: forward <")) {
|
||||||
Token * leftAngle = tok->tokAt(3);
|
Token * leftAngle = tok->tokAt(3);
|
||||||
Token * rightAngle = leftAngle->link();
|
Token * rightAngle = leftAngle->link();
|
||||||
if (Token::Match(rightAngle, "> ( %var% )")) {
|
if (Token::Match(rightAngle, "> ( %var% )")) {
|
||||||
variableToken = rightAngle->tokAt(2);
|
variableToken = rightAngle->tokAt(2);
|
||||||
isMovedOrForwarded = true;
|
|
||||||
kind = ValueFlow::Value::ForwardedVariable;
|
kind = ValueFlow::Value::ForwardedVariable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isMovedOrForwarded)
|
if (!variableToken)
|
||||||
return false;
|
return false;
|
||||||
if (variableToken->strAt(2) == ".") // Only partially moved
|
if (variableToken->strAt(2) == ".") // Only partially moved
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue