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

Function isDecayedPointer

lib/valueflow.cpp:2842–2857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2840};
2841
2842static bool isDecayedPointer(const Token *tok)
2843{
2844 if (!tok)
2845 return false;
2846 if (!tok->astParent())
2847 return false;
2848 if (Token::simpleMatch(tok->astParent(), "=") && astIsRHS(tok))
2849 return true;
2850 if (astIsPointer(tok->astParent()) && !Token::simpleMatch(tok->astParent(), "return"))
2851 return true;
2852 if (tok->astParent()->isConstOp())
2853 return true;
2854 if (!Token::simpleMatch(tok->astParent(), "return"))
2855 return false;
2856 return astIsPointer(tok->astParent()) || astIsContainerView(tok->astParent());
2857}
2858
2859static bool isConvertedToView(const Token* tok, const Settings& settings)
2860{

Callers 1

valueFlowLifetimeFunction · 0.85

Calls 6

astIsRHSFunction · 0.85
astIsPointerFunction · 0.85
astIsContainerViewFunction · 0.85
astParentMethod · 0.80
isConstOpMethod · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected