Remove redundant variable

This commit is contained in:
Dmitry-Me 2017-09-01 18:19:25 +03:00
parent 2133350bf0
commit beba46987d
1 changed files with 1 additions and 4 deletions

View File

@ -1965,23 +1965,20 @@ static bool isStdMoveOrStdForwarded(Token * tok, ValueFlow::Value::MoveKind * mo
{
if (tok->str() != "std")
return false;
bool isMovedOrForwarded = false;
ValueFlow::Value::MoveKind kind = ValueFlow::Value::NonMovedVariable;
Token * variableToken = nullptr;
if (Token::Match(tok, "std :: move ( %var% )")) {
variableToken = tok->tokAt(4);
isMovedOrForwarded = true;
kind = ValueFlow::Value::MovedVariable;
} else if (Token::simpleMatch(tok, "std :: forward <")) {
Token * leftAngle = tok->tokAt(3);
Token * rightAngle = leftAngle->link();
if (Token::Match(rightAngle, "> ( %var% )")) {
variableToken = rightAngle->tokAt(2);
isMovedOrForwarded = true;
kind = ValueFlow::Value::ForwardedVariable;
}
}
if (!isMovedOrForwarded)
if (!variableToken)
return false;
if (variableToken->strAt(2) == ".") // Only partially moved
return false;