| 3479 | } |
| 3480 | |
| 3481 | static const Variable* getSingleReturnVar(const Scope* scope) { |
| 3482 | if (!scope || !scope->bodyStart) |
| 3483 | return nullptr; |
| 3484 | const Token* const start = scope->bodyStart->next(); |
| 3485 | const Token* const end = Token::findsimplematch(start, ";", 1, scope->bodyEnd); |
| 3486 | if (!end || end->next() != scope->bodyEnd) |
| 3487 | return nullptr; |
| 3488 | if (!start->astOperand1() || start->str() != "return") |
| 3489 | return nullptr; |
| 3490 | const Token* tok = start->astOperand1(); |
| 3491 | if (tok->str() == ".") { |
| 3492 | const Token* top = tok->astOperand1(); |
| 3493 | while (Token::Match(top, "[[.]")) |
| 3494 | top = top->astOperand1(); |
| 3495 | if (!Token::Match(top, "%var%")) |
| 3496 | return nullptr; |
| 3497 | tok = tok->astOperand2(); |
| 3498 | } |
| 3499 | return tok->variable(); |
| 3500 | } |
| 3501 | |
| 3502 | void CheckClassImpl::checkReturnByReference() |
| 3503 | { |
no test coverage detected