| 8512 | } |
| 8513 | |
| 8514 | static const Token *findUnmatchedTernaryOp(const Token * const begin, const Token * const end, int depth = 0) |
| 8515 | { |
| 8516 | std::stack<const Token *> ternaryOp; |
| 8517 | for (const Token *tok = begin; tok != end && tok->str() != ";"; tok = tok->next()) { |
| 8518 | if (tok->str() == "?") |
| 8519 | ternaryOp.push(tok); |
| 8520 | else if (!ternaryOp.empty() && tok->str() == ":") |
| 8521 | ternaryOp.pop(); |
| 8522 | else if (depth < 100 && Token::Match(tok,"(|[")) { |
| 8523 | const Token *inner = findUnmatchedTernaryOp(tok->next(), tok->link(), depth+1); |
| 8524 | if (inner) |
| 8525 | return inner; |
| 8526 | tok = tok->link(); |
| 8527 | } |
| 8528 | } |
| 8529 | return ternaryOp.empty() ? nullptr : ternaryOp.top(); |
| 8530 | } |
| 8531 | |
| 8532 | static bool isCPPAttribute(const Token * tok) |
| 8533 | { |
no test coverage detected