| 3624 | } |
| 3625 | |
| 3626 | static const Token* isStrlenOf(const Token* tok, const Token* expr, int depth = 10) |
| 3627 | { |
| 3628 | if (depth < 0) |
| 3629 | return nullptr; |
| 3630 | if (!tok) |
| 3631 | return nullptr; |
| 3632 | if (!expr) |
| 3633 | return nullptr; |
| 3634 | if (expr->exprId() == 0) |
| 3635 | return nullptr; |
| 3636 | if (Token::simpleMatch(tok->previous(), "strlen (")) { |
| 3637 | if (tok->astOperand2()->exprId() == expr->exprId()) |
| 3638 | return tok; |
| 3639 | } else { |
| 3640 | for (const ValueFlow::Value& v : tok->values()) { |
| 3641 | if (!v.isSymbolicValue()) |
| 3642 | continue; |
| 3643 | if (!v.isKnown()) |
| 3644 | continue; |
| 3645 | if (v.intvalue != 0) |
| 3646 | continue; |
| 3647 | if (const Token* next = isStrlenOf(v.tokvalue, expr, depth - 1)) |
| 3648 | return next; |
| 3649 | } |
| 3650 | } |
| 3651 | return nullptr; |
| 3652 | } |
| 3653 | |
| 3654 | static void valueFlowSymbolicOperators(const SymbolDatabase& symboldatabase, const Settings& settings) |
| 3655 | { |
no test coverage detected