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

Function isClassStructUnionEnumStart

lib/tokenize.cpp:106–114  ·  view source on GitHub ↗

* is tok the start brace { of a class, struct, union, or enum */

Source from the content-addressed store, hash-verified

104 * is tok the start brace { of a class, struct, union, or enum
105 */
106static const Token* isClassStructUnionEnumStart(const Token* tok)
107{
108 if (!Token::Match(tok->previous(), "class|struct|union|enum|%name%|>|>> {"))
109 return nullptr;
110 const Token * tok2 = tok->previous();
111 while (tok2 && !Token::Match(tok2, "class|struct|union|enum|{|}|)|;"))
112 tok2 = tok2->previous();
113 return (Token::Match(tok2, "class|struct|union|enum") && !Token::simpleMatch(tok2->tokAt(-1), "->")) ? tok2 : nullptr;
114}
115
116//---------------------------------------------------------------------------
117

Callers 4

simplifyTypedefMethod · 0.85
setVarIdClassDeclarationFunction · 0.85
setVarIdPass1Method · 0.85
findGarbageCodeMethod · 0.85

Calls 2

simpleMatchFunction · 0.70
tokAtMethod · 0.45

Tested by

no test coverage detected