File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1734,9 +1734,10 @@ bool Tokenizer::tokenize(std::istream &code,
17341734 for (std::size_t i = 0 ; i < _symbolDatabase->getVariableListSize (); i++) {
17351735 const Variable* var = _symbolDatabase->getVariableFromVarId (i);
17361736 if (var && var->isRValueReference ()) {
1737- const_cast <Token*>(var->typeEndToken ())->str (" &" );
1738- const_cast <Token*>(var->typeEndToken ())->insertToken (" &" );
1739- const_cast <Token*>(var->typeEndToken ()->next ())->scope (var->typeEndToken ()->scope ());
1737+ Token* endTok = const_cast <Token*>(var->typeEndToken ());
1738+ endTok->str (" &" );
1739+ endTok->insertToken (" &" );
1740+ endTok->next ()->scope (endTok->scope ());
17401741 }
17411742 }
17421743
@@ -2100,10 +2101,11 @@ void Tokenizer::simplifyArrayAccessSyntax()
21002101 // 0[a] -> a[0]
21012102 for (Token *tok = list.front (); tok; tok = tok->next ()) {
21022103 if (tok->isNumber () && Token::Match (tok, " %num% [ %name% ]" )) {
2103- std::string temp = tok->str ();
2104- tok->str (tok->strAt (2 ));
2105- tok->varId (tok->tokAt (2 )->varId ());
2106- tok->tokAt (2 )->str (temp);
2104+ const std::string number (tok->str ());
2105+ Token* indexTok = tok->tokAt (2 );
2106+ tok->str (indexTok->str ());
2107+ tok->varId (indexTok->varId ());
2108+ indexTok->str (number);
21072109 }
21082110 }
21092111}
You can’t perform that action at this time.
0 commit comments