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

Function findLambdaEndScope

lib/token.cpp:2695–2722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2693}
2694
2695Token* findLambdaEndScope(Token* tok)
2696{
2697 if (!Token::simpleMatch(tok, "["))
2698 return nullptr;
2699 tok = tok->link();
2700 if (!Token::Match(tok, "] (|{"))
2701 return nullptr;
2702 tok = tok->linkAt(1);
2703 if (Token::simpleMatch(tok, "}"))
2704 return tok;
2705 if (Token::simpleMatch(tok, ") {"))
2706 return tok->linkAt(1);
2707 if (!Token::simpleMatch(tok, ")"))
2708 return nullptr;
2709 tok = tok->next();
2710 while (Token::Match(tok, "mutable|constexpr|consteval|noexcept|.")) {
2711 if (Token::simpleMatch(tok, "noexcept ("))
2712 tok = tok->linkAt(1);
2713 if (Token::simpleMatch(tok, ".")) {
2714 tok = findTypeEnd(tok);
2715 break;
2716 }
2717 tok = tok->next();
2718 }
2719 if (Token::simpleMatch(tok, "{"))
2720 return tok->link();
2721 return nullptr;
2722}
2723const Token* findLambdaEndScope(const Token* tok) {
2724 return findLambdaEndScope(const_cast<Token*>(tok));
2725}

Callers 2

iscpp11init_implFunction · 0.85
simplifyVarDeclMethod · 0.85

Calls 4

linkAtMethod · 0.80
nextMethod · 0.80
simpleMatchFunction · 0.70
findTypeEndFunction · 0.70

Tested by

no test coverage detected