@@ -1358,7 +1358,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * arg, const Settings *settings,
13581358 top = top->astParent ();
13591359 const ValueType *valuetype = top->argumentType ();
13601360 if (valuetype && valuetype->type >= ValueType::Type::BOOL) {
1361- typeToken = tempToken = new Token ();
1361+ typeToken = tempToken = new Token (top );
13621362 if (valuetype->pointer && valuetype->constness & 1 ) {
13631363 tempToken->str (" const" );
13641364 tempToken->insertToken (" a" );
@@ -1440,9 +1440,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * arg, const Settings *settings,
14401440 if (function->retType ->classScope ->enumType )
14411441 typeToken = function->retType ->classScope ->enumType ;
14421442 else {
1443- tempToken = new Token ();
1444- tempToken->fileIndex (tok1->fileIndex ());
1445- tempToken->linenr (tok1->linenr ());
1443+ tempToken = new Token (tok1);
14461444 tempToken->str (" int" );
14471445 typeToken = tempToken;
14481446 }
@@ -1461,9 +1459,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * arg, const Settings *settings,
14611459 if (function->retType ->classScope ->enumType )
14621460 typeToken = function->retType ->classScope ->enumType ;
14631461 else {
1464- tempToken = new Token ();
1465- tempToken->fileIndex (tok1->fileIndex ());
1466- tempToken->linenr (tok1->linenr ());
1462+ tempToken = new Token (tok1);
14671463 tempToken->str (" int" );
14681464 typeToken = tempToken;
14691465 }
@@ -1487,9 +1483,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * arg, const Settings *settings,
14871483 // check for some common well known functions
14881484 else if (isCPP && ((Token::Match (tok1->previous (), " %var% . size|empty|c_str ( ) [,)]" ) && isStdContainer (tok1->previous ())) ||
14891485 (Token::Match (tok1->previous (), " ] . size|empty|c_str ( ) [,)]" ) && isStdContainer (tok1->previous ()->link ()->previous ())))) {
1490- tempToken = new Token ();
1491- tempToken->fileIndex (tok1->fileIndex ());
1492- tempToken->linenr (tok1->linenr ());
1486+ tempToken = new Token (tok1);
14931487 if (tok1->next ()->str () == " size" ) {
14941488 // size_t is platform dependent
14951489 if (settings->platform .sizeof_size_t == 8 ) {
@@ -1548,9 +1542,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * arg, const Settings *settings,
15481542 if (variableInfo->type () && variableInfo->type ()->classScope && variableInfo->type ()->classScope ->enumType )
15491543 typeToken = variableInfo->type ()->classScope ->enumType ;
15501544 else {
1551- tempToken = new Token ();
1552- tempToken->fileIndex (tok1->fileIndex ());
1553- tempToken->linenr (tok1->linenr ());
1545+ tempToken = new Token (tok1);
15541546 tempToken->str (" int" );
15551547 typeToken = tempToken;
15561548 }
@@ -1588,9 +1580,7 @@ bool CheckIO::ArgumentInfo::isStdVectorOrString()
15881580 return true ;
15891581 }
15901582 if (variableInfo->isStlType (stl_string)) {
1591- tempToken = new Token ();
1592- tempToken->fileIndex (variableInfo->typeStartToken ()->fileIndex ());
1593- tempToken->linenr (variableInfo->typeStartToken ()->linenr ());
1583+ tempToken = new Token (variableInfo->typeStartToken ());
15941584 if (variableInfo->typeStartToken ()->strAt (2 ) == " string" )
15951585 tempToken->str (" char" );
15961586 else
@@ -1608,9 +1598,7 @@ bool CheckIO::ArgumentInfo::isStdVectorOrString()
16081598 return true ;
16091599 }
16101600 if (Token::Match (nameTok, " std :: string|wstring" )) {
1611- tempToken = new Token ();
1612- tempToken->fileIndex (variableInfo->typeStartToken ()->fileIndex ());
1613- tempToken->linenr (variableInfo->typeStartToken ()->linenr ());
1601+ tempToken = new Token (variableInfo->typeStartToken ());
16141602 if (nameTok->strAt (2 ) == " string" )
16151603 tempToken->str (" char" );
16161604 else
0 commit comments