| 4962 | } |
| 4963 | |
| 4964 | static const Token* getConditionVariable(const Token* tok) |
| 4965 | { |
| 4966 | if (tok->str() == "!") |
| 4967 | return tok->astOperand1(); |
| 4968 | |
| 4969 | if (const Token* parent = tok->astParent()) { |
| 4970 | if (Token::Match(parent, "%oror%|&&|?") || |
| 4971 | Token::Match(parent->previous(), "if|while (") || |
| 4972 | (parent->str() == ";" && astIsLHS(tok) && Token::simpleMatch(parent->astParent(), ";"))) { // for loop condition |
| 4973 | if (Token::simpleMatch(tok, "=")) |
| 4974 | return tok->astOperand1(); |
| 4975 | if (!Token::Match(tok, "%comp%|%assign%")) |
| 4976 | return tok; |
| 4977 | } |
| 4978 | } |
| 4979 | return nullptr; |
| 4980 | } |
| 4981 | |
| 4982 | struct SimpleConditionHandler : ConditionHandler { |
| 4983 | std::vector<Condition> parse(const Token* tok, const Settings& /*settings*/) const override { |
no test coverage detected