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

Function getInitTokImpl

lib/astutils.cpp:878–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876}
877
878template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )>
879static T* getInitTokImpl(T* tok)
880{
881 if (!tok)
882 return nullptr;
883 if (Token::Match(tok, "%name% ("))
884 return getInitTokImpl(tok->next());
885 if (tok->str() != "(")
886 return nullptr;
887 if (!Token::simpleMatch(tok->astOperand2(), ";"))
888 return nullptr;
889 if (Token::simpleMatch(tok->astOperand2()->astOperand1(), ";"))
890 return nullptr;
891 return tok->astOperand2()->astOperand1();
892}
893
894template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )>
895static T* getStepTokImpl(T* tok)

Callers 1

getInitTokFunction · 0.85

Calls 5

nextMethod · 0.80
astOperand2Method · 0.80
astOperand1Method · 0.80
simpleMatchFunction · 0.70
strMethod · 0.45

Tested by

no test coverage detected