| 2667 | } |
| 2668 | |
| 2669 | const Type* Variable::smartPointerType() const |
| 2670 | { |
| 2671 | if (!isSmartPointer()) |
| 2672 | return nullptr; |
| 2673 | |
| 2674 | if (mValueType->smartPointerType) |
| 2675 | return mValueType->smartPointerType; |
| 2676 | |
| 2677 | // TODO: Cache result, handle more complex type expression |
| 2678 | const Token* typeTok = typeStartToken(); |
| 2679 | while (Token::Match(typeTok, "%name%|::")) |
| 2680 | typeTok = typeTok->next(); |
| 2681 | if (Token::Match(typeTok, "< %name% >")) { |
| 2682 | // cppcheck-suppress shadowFunction - TODO: fix this |
| 2683 | const Scope* scope = typeTok->scope(); |
| 2684 | const Type* ptrType{}; |
| 2685 | while (scope && !ptrType) { |
| 2686 | ptrType = scope->findType(typeTok->strAt(1)); |
| 2687 | scope = scope->nestedIn; |
| 2688 | } |
| 2689 | return ptrType; |
| 2690 | } |
| 2691 | return nullptr; |
| 2692 | } |
| 2693 | |
| 2694 | const Type* Variable::iteratorType() const |
| 2695 | { |
no test coverage detected