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

Function getSingleFunctionCall

lib/checkclass.cpp:3381–3396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3379}
3380
3381static const Token* getSingleFunctionCall(const Scope* scope) {
3382 const Token* const start = scope->bodyStart->next();
3383 const Token* const end = Token::findsimplematch(start, ";", 1, scope->bodyEnd);
3384 if (!end || end->next() != scope->bodyEnd)
3385 return nullptr;
3386 const Token* ftok = start;
3387 if (ftok->str() == "return")
3388 ftok = ftok->astOperand1();
3389 else {
3390 while (Token::Match(ftok, "%name%|::"))
3391 ftok = ftok->next();
3392 }
3393 if (Token::simpleMatch(ftok, "(") && ftok->previous()->function())
3394 return ftok->previous();
3395 return nullptr;
3396}
3397
3398static bool compareTokenRanges(const Token* start1, const Token* end1, const Token* start2, const Token* end2) {
3399 const Token* tok1 = start1;

Callers 1

checkUselessOverrideMethod · 0.85

Calls 6

findsimplematchFunction · 0.85
nextMethod · 0.80
astOperand1Method · 0.80
simpleMatchFunction · 0.70
strMethod · 0.45
functionMethod · 0.45

Tested by

no test coverage detected