File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,9 +79,14 @@ namespace {
7979/* * Return whether tok is the "{" that starts an enumerator list */
8080static bool isEnumStart (const Token* tok)
8181{
82- if (!tok || tok-> str () != " {" )
82+ if (!Token::simpleMatch ( tok, " {" ) )
8383 return false ;
84- return (tok->strAt (-1 ) == " enum" ) || (tok->strAt (-2 ) == " enum" ) || Token::Match (tok->tokAt (-3 ), " enum class %name%" );
84+ tok = tok->previous ();
85+ while (tok && !tok->isKeyword () && Token::Match (tok, " %name%|::|:" ))
86+ tok = tok->previous ();
87+ if (Token::simpleMatch (tok, " class" ))
88+ tok = tok->previous ();
89+ return Token::simpleMatch (tok, " enum" );
8590}
8691
8792template <typename T>
@@ -1132,18 +1137,6 @@ void Tokenizer::simplifyTypedef()
11321137 simplifyTypedefCpp ();
11331138}
11341139
1135- static bool isEnumScope (const Token* tok)
1136- {
1137- if (!Token::simpleMatch (tok, " {" ))
1138- return false ;
1139- tok = tok->previous ();
1140- while (tok && !tok->isKeyword () && Token::Match (tok, " %name%|::|:" ))
1141- tok = tok->previous ();
1142- if (Token::simpleMatch (tok, " class" ))
1143- tok = tok->previous ();
1144- return Token::simpleMatch (tok, " enum" );
1145- }
1146-
11471140void Tokenizer::simplifyTypedefCpp ()
11481141{
11491142 bool isNamespace = false ;
@@ -1755,7 +1748,7 @@ void Tokenizer::simplifyTypedefCpp()
17551748 }
17561749 ++scope;
17571750 }
1758- if (isEnumScope (tok2))
1751+ if (isEnumStart (tok2))
17591752 inEnum = true ;
17601753 }
17611754
You can’t perform that action at this time.
0 commit comments