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

Function getArgumentStart

lib/astutils.cpp:3179–3192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3177}
3178
3179const Token* getArgumentStart(const Token* ftok)
3180{
3181 const Token* tok = ftok;
3182 if (Token::Match(tok, "%name% (|{|)"))
3183 tok = ftok->next();
3184 while (Token::simpleMatch(tok, ")"))
3185 tok = tok->next();
3186 if (!Token::Match(tok, "(|{|["))
3187 return nullptr;
3188 const Token* startTok = tok->astOperand2();
3189 if (!startTok && tok->next() != tok->link())
3190 startTok = tok->astOperand1();
3191 return startTok;
3192}
3193
3194int numberOfArguments(const Token* ftok) {
3195 return astCount(getArgumentStart(ftok), ",");

Callers 3

getLifetimeTokensFunction · 0.85
numberOfArgumentsFunction · 0.85
getArgumentsFunction · 0.85

Calls 4

nextMethod · 0.80
astOperand2Method · 0.80
astOperand1Method · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected