Skip to content

Commit

Permalink
Check namToken()
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Aug 11, 2023
1 parent 399a216 commit f99a682
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3148,7 +3148,8 @@ ExprUsage getExprUsage(const Token* tok, int indirect, const Settings* settings,
!(astIsRHS(tok) && isLikelyStreamRead(cpp, parent)))
return ExprUsage::Used;
if (Token::simpleMatch(parent, "=") && astIsRHS(tok)) {
if (parent->astOperand1() && parent->astOperand1()->variable() && parent->astOperand1()->variable()->isReference())
const Token* const lhs = parent->astOperand1();
if (lhs && lhs->variable() && lhs->variable()->isReference() && lhs->variable()->nameToken())
return ExprUsage::NotUsed;
return ExprUsage::Used;
}
Expand Down

0 comments on commit f99a682

Please sign in to comment.