| 3566 | } |
| 3567 | |
| 3568 | static void getLHSVariablesRecursive(std::vector<const Variable*>& vars, const Token* tok) |
| 3569 | { |
| 3570 | if (!tok) |
| 3571 | return; |
| 3572 | if (vars.empty() && Token::Match(tok, "*|&|&&|[")) { |
| 3573 | getLHSVariablesRecursive(vars, tok->astOperand1()); |
| 3574 | if (!vars.empty() || Token::simpleMatch(tok, "[")) |
| 3575 | return; |
| 3576 | getLHSVariablesRecursive(vars, tok->astOperand2()); |
| 3577 | } else if (Token::Match(tok->previous(), "this . %var%")) { |
| 3578 | getLHSVariablesRecursive(vars, tok->next()); |
| 3579 | } else if (Token::simpleMatch(tok, ".")) { |
| 3580 | getLHSVariablesRecursive(vars, tok->astOperand1()); |
| 3581 | getLHSVariablesRecursive(vars, tok->astOperand2()); |
| 3582 | } else if (Token::simpleMatch(tok, "::")) { |
| 3583 | getLHSVariablesRecursive(vars, tok->astOperand2()); |
| 3584 | } else if (tok->variable()) { |
| 3585 | vars.push_back(tok->variable()); |
| 3586 | } |
| 3587 | } |
| 3588 | |
| 3589 | std::vector<const Variable*> getLHSVariables(const Token* tok) |
| 3590 | { |
no test coverage detected