| 1612 | |
| 1613 | namespace { |
| 1614 | int getExprIdForOperand(const Token* tok) { |
| 1615 | if (!tok) |
| 1616 | return 0; |
| 1617 | |
| 1618 | int otherExprId = 0; |
| 1619 | |
| 1620 | // Look through all referenced tokens. |
| 1621 | // If two exprIds are found and one matches tok->exprId(), return the other. |
| 1622 | // Otherwise, default to returning tok->exprId(). |
| 1623 | for (const auto& ref: followAllReferences(tok)) { |
| 1624 | const int refExprId = ref.token->exprId(); |
| 1625 | if (refExprId != 0 && refExprId != tok->exprId()) { |
| 1626 | if (otherExprId != 0 && otherExprId != refExprId) |
| 1627 | return tok->exprId(); |
| 1628 | otherExprId = refExprId; |
| 1629 | } |
| 1630 | } |
| 1631 | return otherExprId != 0 ? otherExprId : tok->exprId(); |
| 1632 | } |
| 1633 | |
| 1634 | struct ExprIdKey { |
| 1635 | std::string parentOp; |
no test coverage detected