@@ -240,9 +240,9 @@ nonneg int Tokenizer::sizeOfType(const Token *type) const
240240bool Tokenizer::duplicateTypedef (Token **tokPtr, const Token *name, const Token *typeDef) const
241241{
242242 // check for an end of definition
243- const Token * tok = *tokPtr;
243+ Token * tok = *tokPtr;
244244 if (tok && Token::Match (tok->next (), " ;|,|[|=|)|>|(|{" )) {
245- const Token * end = tok->next ();
245+ Token * end = tok->next ();
246246
247247 if (end->str () == " [" ) {
248248 if (!end->link ())
@@ -4405,11 +4405,11 @@ void Tokenizer::setVarIdPass2()
44054405
44064406 std::list<const Token *> classnameTokens;
44074407 classnameTokens.push_back (tok->next ());
4408- const Token* tokStart = tok->tokAt (2 );
4408+ Token* tokStart = tok->tokAt (2 );
44094409 while (Token::Match (tokStart, " :: %name%" ) || tokStart->str () == " <" ) {
44104410 if (tokStart->str () == " <" ) {
44114411 // skip the template part
4412- const Token* closeTok = tokStart->findClosingBracket ();
4412+ Token* closeTok = tokStart->findClosingBracket ();
44134413 if (!closeTok)
44144414 syntaxError (tok);
44154415 tokStart = closeTok->next ();
@@ -7408,7 +7408,8 @@ static bool isAlignAttribute(const Token * tok)
74087408 return Token::simpleMatch (tok, " alignas (" ) && tok->next ()->link ();
74097409}
74107410
7411- static const Token* skipCPPOrAlignAttribute (const Token * tok)
7411+ template <typename T>
7412+ static T* skipCPPOrAlignAttribute (T * tok)
74127413{
74137414 if (isCPPAttribute (tok)) {
74147415 return tok->link ();
@@ -8318,7 +8319,7 @@ void Tokenizer::simplifyCPPAttribute()
83188319 }
83198320 if (isCPPAttribute (tok)) {
83208321 if (Token::findsimplematch (tok->tokAt (2 ), " noreturn" , tok->link ())) {
8321- const Token * head = skipCPPOrAlignAttribute (tok);
8322+ Token * head = skipCPPOrAlignAttribute (tok);
83228323 while (isCPPAttribute (head) || isAlignAttribute (head))
83238324 head = skipCPPOrAlignAttribute (head);
83248325 head = head->next ();
@@ -8328,7 +8329,7 @@ void Tokenizer::simplifyCPPAttribute()
83288329 head->previous ()->isAttributeNoreturn (true );
83298330 }
83308331 } else if (Token::findsimplematch (tok->tokAt (2 ), " nodiscard" , tok->link ())) {
8331- const Token * head = skipCPPOrAlignAttribute (tok);
8332+ Token * head = skipCPPOrAlignAttribute (tok);
83328333 while (isCPPAttribute (head) || isAlignAttribute (head))
83338334 head = skipCPPOrAlignAttribute (head);
83348335 head = head->next ();
@@ -8338,7 +8339,7 @@ void Tokenizer::simplifyCPPAttribute()
83388339 head->previous ()->isAttributeNodiscard (true );
83398340 }
83408341 } else if (Token::findsimplematch (tok->tokAt (2 ), " maybe_unused" , tok->link ())) {
8341- const Token* head = skipCPPOrAlignAttribute (tok);
8342+ Token* head = skipCPPOrAlignAttribute (tok);
83428343 while (isCPPAttribute (head) || isAlignAttribute (head))
83438344 head = skipCPPOrAlignAttribute (head);
83448345 head->next ()->isAttributeMaybeUnused (true );
@@ -8903,7 +8904,7 @@ void Tokenizer::simplifyNamespaceStd()
89038904
89048905 std::set<std::string> userFunctions;
89058906
8906- for (const Token* tok = Token::findsimplematch (list.front (), " using namespace std ;" ); tok; tok = tok->next ()) {
8907+ for (Token* tok = Token::findsimplematch (list.front (), " using namespace std ;" ); tok; tok = tok->next ()) {
89078908 bool insert = false ;
89088909 if (Token::Match (tok, " enum class|struct| %name%| :|{" )) { // Don't replace within enum definitions
89098910 skipEnumBody (&tok);
0 commit comments