| 3403 | } |
| 3404 | |
| 3405 | std::vector<const Token*> Function::findReturns(const Function* f) |
| 3406 | { |
| 3407 | std::vector<const Token*> result; |
| 3408 | if (!f) |
| 3409 | return result; |
| 3410 | const Scope* scope = f->functionScope; |
| 3411 | if (!scope) |
| 3412 | return result; |
| 3413 | if (!scope->bodyStart) |
| 3414 | return result; |
| 3415 | for (const Token* tok = scope->bodyStart->next(); tok && tok != scope->bodyEnd; tok = tok->next()) { |
| 3416 | if (tok->str() == "{" && tok->scope() && |
| 3417 | (tok->scope()->type == ScopeType::eLambda || tok->scope()->type == ScopeType::eClass)) { |
| 3418 | tok = tok->link(); |
| 3419 | continue; |
| 3420 | } |
| 3421 | if (Token::simpleMatch(tok->astParent(), "return")) { |
| 3422 | result.push_back(tok); |
| 3423 | } |
| 3424 | // Skip lambda functions since the scope may not be set correctly |
| 3425 | const Token* lambdaEndToken = findLambdaEndToken(tok); |
| 3426 | if (lambdaEndToken) { |
| 3427 | tok = lambdaEndToken; |
| 3428 | } |
| 3429 | } |
| 3430 | return result; |
| 3431 | } |
| 3432 | |
| 3433 | const Token * Function::constructorMemberInitialization() const |
| 3434 | { |
nothing calls this directly
no test coverage detected