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

Function isInConstructorList

lib/astutils.cpp:718–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718static bool isInConstructorList(const Token* tok)
719{
720 if (!tok)
721 return false;
722 if (!astIsRHS(tok))
723 return false;
724 const Token* parent = tok->astParent();
725 if (!Token::Match(parent, "{|("))
726 return false;
727 if (!Token::Match(parent->previous(), "%var% {|("))
728 return false;
729 if (!parent->astOperand1() || !parent->astOperand2())
730 return false;
731 do {
732 parent = parent->astParent();
733 } while (Token::simpleMatch(parent, ","));
734 return Token::simpleMatch(parent, ":") && !Token::simpleMatch(parent->astParent(), "?");
735}
736
737std::vector<ValueType> getParentValueTypes(const Token* tok, const Settings& settings, const Token** parent)
738{

Callers 1

getParentValueTypesFunction · 0.85

Calls 5

astIsRHSFunction · 0.85
astParentMethod · 0.80
astOperand1Method · 0.80
astOperand2Method · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected