| 1826 | } |
| 1827 | |
| 1828 | static bool isDifferentType(const Token* src, const Token* dst, const Settings& settings) |
| 1829 | { |
| 1830 | const Type* t = Token::typeOf(src); |
| 1831 | const Type* parentT = Token::typeOf(dst); |
| 1832 | if (t && parentT) { |
| 1833 | if (t->classDef && parentT->classDef && t->classDef != parentT->classDef) |
| 1834 | return true; |
| 1835 | } else { |
| 1836 | std::pair<const Token*, const Token*> decl = Token::typeDecl(src); |
| 1837 | std::pair<const Token*, const Token*> parentdecl = Token::typeDecl(dst); |
| 1838 | const bool isCpp = (src && src->isCpp()) || (dst && dst->isCpp()); |
| 1839 | if (isNotEqual(decl, parentdecl) && !(isCpp && (Token::simpleMatch(decl.first, "auto") || Token::simpleMatch(parentdecl.first, "auto")))) |
| 1840 | return true; |
| 1841 | if (isNotEqual(decl, dst->valueType(), isCpp, settings)) |
| 1842 | return true; |
| 1843 | if (isNotEqual(parentdecl, src->valueType(), isCpp, settings)) |
| 1844 | return true; |
| 1845 | } |
| 1846 | return false; |
| 1847 | } |
| 1848 | |
| 1849 | bool ValueFlow::isLifetimeBorrowed(const Token *tok, const Settings &settings) |
| 1850 | { |
no test coverage detected