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

Method hasInlineOrLambdaFunction

lib/symboldatabase.cpp:5820–5839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5818}
5819
5820bool Scope::hasInlineOrLambdaFunction(const Token** tokStart, bool onlyInline) const
5821{
5822 return std::any_of(nestedList.begin(), nestedList.end(), [&](const Scope* s) {
5823 // Inline function
5824 if (s->type == ScopeType::eUnconditional && Token::simpleMatch(s->bodyStart->previous(), ") {")) {
5825 if (tokStart)
5826 *tokStart = nullptr; // bailout for e.g. loop-like macros
5827 return true;
5828 }
5829 // Lambda function
5830 if (!onlyInline && s->type == ScopeType::eLambda && !hasEmptyCaptureList(s->bodyStart)) {
5831 if (tokStart)
5832 *tokStart = s->bodyStart;
5833 return true;
5834 }
5835 if (s->hasInlineOrLambdaFunction(tokStart, onlyInline))
5836 return true;
5837 return false;
5838 });
5839}
5840
5841void Scope::findFunctionInBase(const Token* tok, nonneg int args, std::vector<const Function *> & matches) const
5842{

Callers 3

checkUnreachableCodeMethod · 0.80
checkMethod · 0.80

Calls 4

hasEmptyCaptureListFunction · 0.85
simpleMatchFunction · 0.70
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected