Skip to content

Commit 4c9bde2

Browse files
committed
Refactoring: Use ranged for in TemplateSimplifier
1 parent f7148cb commit 4c9bde2

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

lib/templatesimplifier.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
15181518

15191519
bool instantiated = false;
15201520

1521-
for (std::list<TokenAndName>::const_iterator iter2 = templateInstantiations.begin(); iter2 != templateInstantiations.end(); ++iter2) {
1521+
for (const TokenAndName &instantiation : templateInstantiations) {
15221522
if (numberOfTemplateInstantiations != templateInstantiations.size()) {
15231523
numberOfTemplateInstantiations = templateInstantiations.size();
15241524
simplifyCalculations(tokenlist.front());
@@ -1530,16 +1530,16 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
15301530
}
15311531

15321532
// already simplified
1533-
if (!Token::Match(iter2->token, "%name% <"))
1533+
if (!Token::Match(instantiation.token, "%name% <"))
15341534
continue;
15351535

1536-
if (iter2->name != templateDeclaration.name)
1536+
if (instantiation.name != templateDeclaration.name)
15371537
continue;
15381538

1539-
if (!matchSpecialization(tok->tokAt(namepos), iter2->token, specializations))
1539+
if (!matchSpecialization(tok->tokAt(namepos), instantiation.token, specializations))
15401540
continue;
15411541

1542-
Token * const tok2 = iter2->token;
1542+
Token * const tok2 = instantiation.token;
15431543
if (errorlogger && !tokenlist.getFiles().empty())
15441544
errorlogger->reportProgress(tokenlist.getFiles()[0], "TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue());
15451545
#ifdef MAXTIME
@@ -1602,7 +1602,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
16021602
if (printDebug && errorlogger) {
16031603
std::list<const Token *> callstack(1, tok2);
16041604
errorlogger->reportErr(ErrorLogger::ErrorMessage(callstack, &tokenlist, Severity::debug, "debug",
1605-
"Failed to instantiate template \"" + iter2->name + "\". The checking continues anyway.", false));
1605+
"Failed to instantiate template \"" + instantiation.name + "\". The checking continues anyway.", false));
16061606
}
16071607
if (typeForNewName.empty())
16081608
continue;
@@ -1614,12 +1614,12 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
16141614

16151615
if (expandedtemplates.find(newName) == expandedtemplates.end()) {
16161616
expandedtemplates.insert(newName);
1617-
TemplateSimplifier::expandTemplate(tokenlist, tok, iter2->name, typeParametersInDeclaration, newName, typesUsedInTemplateInstantiation, templateInstantiations);
1617+
TemplateSimplifier::expandTemplate(tokenlist, tok, instantiation.name, typeParametersInDeclaration, newName, typesUsedInTemplateInstantiation, templateInstantiations);
16181618
instantiated = true;
16191619
}
16201620

16211621
// Replace all these template usages..
1622-
replaceTemplateUsage(tok2, iter2->name, typeStringsUsedInTemplateInstantiation, newName, typesUsedInTemplateInstantiation, templateInstantiations);
1622+
replaceTemplateUsage(tok2, instantiation.name, typeStringsUsedInTemplateInstantiation, newName, typesUsedInTemplateInstantiation, templateInstantiations);
16231623
}
16241624

16251625
// Template has been instantiated .. then remove the template declaration

0 commit comments

Comments
 (0)