@@ -10344,6 +10344,13 @@ static bool isStdSmartPointer(const Token* tok, const Settings& settings)
1034410344 return ptr && startsWith (ptr->name , " std::" );
1034510345}
1034610346
10347+ static bool isLibraryType (const Token* tok, const Settings& settings)
10348+ {
10349+ return settings.library .hasAnyTypeCheck (" std::" + tok->str ()) ||
10350+ settings.library .podtype (" std::" + tok->str ()) ||
10351+ isStdContainerOrIterator (tok, settings);
10352+ }
10353+
1034710354// Add std:: in front of std classes, when using namespace std; was given
1034810355void Tokenizer::simplifyNamespaceStd ()
1034910356{
@@ -10371,14 +10378,13 @@ void Tokenizer::simplifyNamespaceStd()
1037110378 if (start != tok && start->isName () && !start->isKeyword () && (!start->previous () || Token::Match (start->previous (), " [;{}]" )))
1037210379 userFunctions.insert (tok->str ());
1037310380 }
10374- if (userFunctions.find (tok->str ()) == userFunctions.end () && mSettings .library .matchArguments (tok, " std::" + tok->str ()))
10381+ if ((userFunctions.find (tok->str ()) == userFunctions.end () && mSettings .library .matchArguments (tok, " std::" + tok->str ())) ||
10382+ (tok->tokAt (-1 )->isKeyword () && isLibraryType (tok, mSettings )))
1037510383 insert = true ;
1037610384 } else if (Token::simpleMatch (tok->next (), " <" ) &&
1037710385 (isStdContainerOrIterator (tok, mSettings ) || isStdSmartPointer (tok, mSettings )))
1037810386 insert = true ;
10379- else if (mSettings .library .hasAnyTypeCheck (" std::" + tok->str ()) ||
10380- mSettings .library .podtype (" std::" + tok->str ()) ||
10381- isStdContainerOrIterator (tok, mSettings ))
10387+ else if (isLibraryType (tok, mSettings ))
1038210388 insert = true ;
1038310389 else if (Token::simpleMatch (tok, " aligned_storage" ))
1038410390 insert = true ;
0 commit comments