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

Function findLambdaEndTokenWithoutAST

lib/tokenlist.cpp:1500–1520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1498}
1499
1500const Token* findLambdaEndTokenWithoutAST(const Token* tok) {
1501 if (!(Token::simpleMatch(tok, "[") && tok->link()))
1502 return nullptr;
1503 tok = tok->link()->next();
1504 if (Token::simpleMatch(tok, "(") && tok->link())
1505 tok = tok->link()->next();
1506 if (Token::simpleMatch(tok, "mutable"))
1507 tok = tok->next();
1508 if (Token::Match(tok, ".|->")) { // trailing return type
1509 tok = tok->next();
1510 while (Token::Match(tok, "%type%|%name%|::|&|&&|*|<|(")) {
1511 if (tok->link())
1512 tok = tok->link()->next();
1513 else
1514 tok = tok->next();
1515 }
1516 }
1517 if (!(Token::simpleMatch(tok, "{") && tok->link()))
1518 return nullptr;
1519 return tok->link()->next();
1520}
1521
1522static Token * createAstAtToken(Token *tok);
1523

Callers 3

compilePrecedence2Function · 0.85
addArgumentsMethod · 0.85
findGarbageCodeMethod · 0.85

Calls 2

nextMethod · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected