MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isDifferentType

Function isDifferentType

lib/valueflow.cpp:1828–1847  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1826}
1827
1828static 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
1849bool ValueFlow::isLifetimeBorrowed(const Token *tok, const Settings &settings)
1850{

Callers 2

isLifetimeBorrowedMethod · 0.85
valueFlowSymbolicFunction · 0.85

Calls 2

isNotEqualFunction · 0.85
simpleMatchFunction · 0.70

Tested by

no test coverage detected