@@ -1000,11 +1000,11 @@ void TemplateSimplifier::getTemplateInstantiations()
10001000 std::string::size_type offset = 0 ;
10011001 std::string::size_type pos = 0 ;
10021002 while ((pos = nameSpace.find (' ' , offset)) != std::string::npos) {
1003- qualificationTok->insertToken (nameSpace.substr (offset, pos - offset), emptyString, true );
1003+ qualificationTok->insertTokenBefore (nameSpace.substr (offset, pos - offset));
10041004 offset = pos + 1 ;
10051005 }
1006- qualificationTok->insertToken (nameSpace.substr (offset), emptyString, true );
1007- qualificationTok->insertToken (" ::" , emptyString, true );
1006+ qualificationTok->insertTokenBefore (nameSpace.substr (offset));
1007+ qualificationTok->insertTokenBefore (" ::" );
10081008 addInstantiation (tok, it1->scope ());
10091009 found = true ;
10101010 break ;
@@ -1635,9 +1635,9 @@ void TemplateSimplifier::expandTemplate(
16351635
16361636 // add forward declarations
16371637 if (copy && isClass) {
1638- templateDeclaration.token ()->insertToken (templateDeclarationToken->strAt (1 ), emptyString, true );
1639- templateDeclaration.token ()->insertToken (newName, emptyString, true );
1640- templateDeclaration.token ()->insertToken (" ;" , emptyString, true );
1638+ templateDeclaration.token ()->insertTokenBefore (templateDeclarationToken->strAt (1 ));
1639+ templateDeclaration.token ()->insertTokenBefore (newName);
1640+ templateDeclaration.token ()->insertTokenBefore (" ;" );
16411641 } else if ((isFunction && (copy || isSpecialization)) ||
16421642 (isVariable && !isSpecialization) ||
16431643 (isClass && isSpecialization && mTemplateSpecializationMap .find (templateDeclaration.token ()) != mTemplateSpecializationMap .end ())) {
@@ -1701,7 +1701,7 @@ void TemplateSimplifier::expandTemplate(
17011701 }
17021702
17031703 if (isStatic) {
1704- dst->insertToken (" static" , emptyString, true );
1704+ dst->insertTokenBefore (" static" );
17051705 if (start) {
17061706 dst->previous ()->linenr (start->linenr ());
17071707 dst->previous ()->column (start->column ());
@@ -1742,7 +1742,7 @@ void TemplateSimplifier::expandTemplate(
17421742 ++typeindentlevel;
17431743 else if (typetok->str () == " )" )
17441744 --typeindentlevel;
1745- dst->insertToken (typetok->str (), typetok->originalName (), true );
1745+ dst->insertToken (typetok->str (), typetok->originalName (), typetok-> getMacroName (), true );
17461746 dst->previous ()->linenr (start->linenr ());
17471747 dst->previous ()->column (start->column ());
17481748 Token *previous = dst->previous ();
@@ -1770,7 +1770,7 @@ void TemplateSimplifier::expandTemplate(
17701770 }
17711771 }
17721772 if (pointerType && Token::simpleMatch (dst1, " const" )) {
1773- dst->insertToken (" const" , dst1->originalName (), true );
1773+ dst->insertToken (" const" , dst1->originalName (), dst1-> getMacroName (), true );
17741774 dst->previous ()->linenr (start->linenr ());
17751775 dst->previous ()->column (start->column ());
17761776 dst1->deleteThis ();
@@ -1784,13 +1784,13 @@ void TemplateSimplifier::expandTemplate(
17841784 !(templateDeclaration.isFunction () && templateDeclaration.scope ().empty () &&
17851785 (start->strAt (-1 ) == " ." || Token::simpleMatch (start->tokAt (-2 ), " . template" )))) {
17861786 if (start->strAt (1 ) != " <" || Token::Match (start, newName.c_str ()) || !inAssignment) {
1787- dst->insertToken (newName, emptyString, true );
1787+ dst->insertTokenBefore (newName);
17881788 dst->previous ()->linenr (start->linenr ());
17891789 dst->previous ()->column (start->column ());
17901790 if (start->strAt (1 ) == " <" )
17911791 start = start->next ()->findClosingBracket ();
17921792 } else {
1793- dst->insertToken (start->str (), emptyString, true );
1793+ dst->insertTokenBefore (start->str ());
17941794 dst->previous ()->linenr (start->linenr ());
17951795 dst->previous ()->column (start->column ());
17961796 newInstantiations.emplace_back (dst->previous (), templateDeclaration.scope ());
@@ -1814,23 +1814,23 @@ void TemplateSimplifier::expandTemplate(
18141814 return Token::simpleMatch (inst.token (), name.c_str (), name.size ());
18151815 })) {
18161816 // use the instantiated name
1817- dst->insertToken (name, " " , true );
1817+ dst->insertTokenBefore (name);
18181818 dst->previous ()->linenr (start->linenr ());
18191819 dst->previous ()->column (start->column ());
18201820 start = closing;
18211821 }
18221822 }
18231823 // just copy the token if it wasn't instantiated
18241824 if (start != closing) {
1825- dst->insertToken (start->str (), start->originalName (), true );
1825+ dst->insertToken (start->str (), start->originalName (), start-> getMacroName (), true );
18261826 dst->previous ()->linenr (start->linenr ());
18271827 dst->previous ()->column (start->column ());
18281828 dst->previous ()->isSigned (start->isSigned ());
18291829 dst->previous ()->isUnsigned (start->isUnsigned ());
18301830 dst->previous ()->isLong (start->isLong ());
18311831 }
18321832 } else {
1833- dst->insertToken (start->str (), start->originalName (), true );
1833+ dst->insertToken (start->str (), start->originalName (), start-> getMacroName (), true );
18341834 dst->previous ()->linenr (start->linenr ());
18351835 dst->previous ()->column (start->column ());
18361836 dst->previous ()->isSigned (start->isSigned ());
@@ -1858,7 +1858,7 @@ void TemplateSimplifier::expandTemplate(
18581858
18591859 start = start->next ();
18601860 }
1861- dst->insertToken (" ;" , emptyString, true );
1861+ dst->insertTokenBefore (" ;" );
18621862 dst->previous ()->linenr (dst->tokAt (-2 )->linenr ());
18631863 dst->previous ()->column (dst->tokAt (-2 )->column () + 1 );
18641864
0 commit comments