@@ -5393,12 +5393,15 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_
53935393 if (tok2->strAt (1 ) == " *" )
53945394 break ;
53955395
5396+ if (Token::Match (tok2->next (), " & %name% ," ))
5397+ break ;
5398+
53965399 tok2 = tok2->next ();
53975400 ++typelen;
53985401 }
53995402
54005403 // strange looking variable declaration => don't split up.
5401- if (Token::Match (tok2, " %type% *| %name% , %type% *| %name%" ))
5404+ if (Token::Match (tok2, " %type% *|&| %name% , %type% *|& | %name%" ))
54025405 continue ;
54035406
54045407 if (Token::Match (tok2, " struct|union|class %type%" )) {
@@ -5470,9 +5473,9 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_
54705473 else
54715474 --typelen;
54725475 // skip all the pointer part
5473- bool ispointer = false ;
5474- while (varName && varName-> str () == " * " ) {
5475- ispointer = true ;
5476+ bool isPointerOrRef = false ;
5477+ while (Token::simpleMatch ( varName, " * " ) || Token::Match (varName, " & %name% , " ) ) {
5478+ isPointerOrRef = true ;
54765479 varName = varName->next ();
54775480 }
54785481
@@ -5487,7 +5490,7 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_
54875490 if (varName->str () != " operator" ) {
54885491 tok2 = varName->next (); // The ',' or '=' token
54895492
5490- if (tok2->str () == " =" && (isstatic || (isconst && !ispointer ))) {
5493+ if (tok2->str () == " =" && (isstatic || (isconst && !isPointerOrRef ))) {
54915494 // do not split const non-pointer variables..
54925495 while (tok2 && tok2->str () != " ," && tok2->str () != " ;" ) {
54935496 if (Token::Match (tok2, " {|(|[" ))
0 commit comments