@@ -10328,6 +10328,13 @@ static bool isStdSmartPointer(const Token* tok, const Settings& settings)
1032810328 return ptr && startsWith (ptr->name , " std::" );
1032910329}
1033010330
10331+ static bool isLibraryType (const Token* tok, const Settings& settings)
10332+ {
10333+ return settings.library .hasAnyTypeCheck (" std::" + tok->str ()) ||
10334+ settings.library .podtype (" std::" + tok->str ()) ||
10335+ isStdContainerOrIterator (tok, settings);
10336+ }
10337+
1033110338// Add std:: in front of std classes, when using namespace std; was given
1033210339void Tokenizer::simplifyNamespaceStd ()
1033310340{
@@ -10345,11 +10352,7 @@ void Tokenizer::simplifyNamespaceStd()
1034510352 continue ;
1034610353 if (Token::Match (tok->previous (), " .|::|namespace" ))
1034710354 continue ;
10348- if (mSettings .library .hasAnyTypeCheck (" std::" + tok->str ()) ||
10349- mSettings .library .podtype (" std::" + tok->str ()) ||
10350- isStdContainerOrIterator (tok, mSettings ))
10351- insert = true ;
10352- else if (Token::simpleMatch (tok->next (), " (" )) {
10355+ if (Token::simpleMatch (tok->next (), " (" )) {
1035310356 if (TokenList::isFunctionHead (tok->next (), " {" ))
1035410357 userFunctions.insert (tok->str ());
1035510358 else if (TokenList::isFunctionHead (tok->next (), " ;" )) {
@@ -10359,11 +10362,14 @@ void Tokenizer::simplifyNamespaceStd()
1035910362 if (start != tok && start->isName () && !start->isKeyword () && (!start->previous () || Token::Match (start->previous (), " [;{}]" )))
1036010363 userFunctions.insert (tok->str ());
1036110364 }
10362- if (userFunctions.find (tok->str ()) == userFunctions.end () && mSettings .library .matchArguments (tok, " std::" + tok->str ()))
10365+ if ((userFunctions.find (tok->str ()) == userFunctions.end () && mSettings .library .matchArguments (tok, " std::" + tok->str ())) ||
10366+ (tok->tokAt (-1 )->isKeyword () && isLibraryType (tok, mSettings )))
1036310367 insert = true ;
1036410368 } else if (Token::simpleMatch (tok->next (), " <" ) &&
1036510369 (isStdContainerOrIterator (tok, mSettings ) || isStdSmartPointer (tok, mSettings )))
1036610370 insert = true ;
10371+ else if (isLibraryType (tok, mSettings ))
10372+ insert = true ;
1036710373 else if (Token::simpleMatch (tok, " aligned_storage" ))
1036810374 insert = true ;
1036910375
0 commit comments