@@ -2972,6 +2972,19 @@ static unsigned int tokDistance(const Token* tok1, const Token* tok2) { // use w
29722972 return dist;
29732973}
29742974
2975+ // a parenthesis starting with a ptr-operator is a nested declarator, otherwise it is a parameter list
2976+ static bool isNestedDeclarator (const Token* paren)
2977+ {
2978+ if (!Token::simpleMatch (paren, " (" ))
2979+ return false ;
2980+ const Token* tok = paren->next ();
2981+ if (Token::simpleMatch (tok, " ::" ))
2982+ tok = tok->next ();
2983+ while (Token::Match (tok, " %name% ::" ))
2984+ tok = tok->tokAt (2 );
2985+ return Token::Match (tok, " *|&|&&" );
2986+ }
2987+
29752988static const Token* skipConstVolatileBackwards (const Token* tok) {
29762989 while (Token::Match (tok, " const|volatile" ))
29772990 tok = tok->previous ();
@@ -3464,18 +3477,8 @@ bool Tokenizer::simplifyUsing()
34643477 syntaxError (nameEnd);
34653478 TokenList::copyTokens (tok1, start, usingEnd->previous ());
34663479 tok1->deleteThis ();
3467- // a parenthesis starting with a ptr-operator is a nested declarator, otherwise it is a parameter list
3468- const auto isNestedDeclarator = [](const Token* paren) {
3469- if (!Token::simpleMatch (paren, " (" ))
3470- return false ;
3471- const Token* t = paren->next ();
3472- if (Token::simpleMatch (t, " ::" ))
3473- t = t->next ();
3474- while (Token::Match (t, " %name% ::" ))
3475- t = t->tokAt (2 );
3476- return Token::Match (t, " *|&|&&" );
3477- };
3478- // the name goes after the ptr-operators of the innermost nested declarator
3480+ // the name goes after the ptr-operators of the innermost nested declarator.
3481+ // after deleteThis() tok1 is the first copied token, so this is the copy of fpQual
34793482 Token* pos = tok1->tokAt (tokDistance (start, fpQual))->next ();
34803483 for (;;) {
34813484 while (Token::Match (pos, " %name%|::|*|&|&&" ))
0 commit comments