| 523 | } |
| 524 | |
| 525 | static bool isDanglingSubFunction(const Token* tokvalue, const Token* tok) |
| 526 | { |
| 527 | if (!tokvalue) |
| 528 | return false; |
| 529 | const Variable* var = tokvalue->variable(); |
| 530 | if (!var->isLocal()) |
| 531 | return false; |
| 532 | const Function* f = Scope::nestedInFunction(tok->scope()); |
| 533 | if (!f) |
| 534 | return false; |
| 535 | const Token* parent = tokvalue->astParent(); |
| 536 | while (parent && !Token::Match(parent->previous(), "%name% (")) { |
| 537 | parent = parent->astParent(); |
| 538 | } |
| 539 | if (!Token::simpleMatch(parent, "(")) |
| 540 | return false; |
| 541 | return exprDependsOnThis(parent); |
| 542 | } |
| 543 | |
| 544 | static const Variable* getParentVar(const Token* tok) |
| 545 | { |
no test coverage detected