Skip to content

Commit 84bdaba

Browse files
committed
TemplateSimplifier: Remove not needed variable indentlevel
1 parent 6cbd69b commit 84bdaba

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

lib/templatesimplifier.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,6 @@ void TemplateSimplifier::expandTemplate(
842842
else
843843
continue;
844844

845-
int indentlevel = 0;
846845
std::stack<Token *> brackets; // holds "(", "[" and "{" tokens
847846

848847
// FIXME use full name matching somehow
@@ -912,7 +911,6 @@ void TemplateSimplifier::expandTemplate(
912911
// link() newly tokens manually
913912
else if (tok3->str() == "{") {
914913
brackets.push(tokenlist.back());
915-
indentlevel++;
916914
} else if (tok3->str() == "(") {
917915
brackets.push(tokenlist.back());
918916
} else if (tok3->str() == "[") {
@@ -925,15 +923,10 @@ void TemplateSimplifier::expandTemplate(
925923
tokenlist.addtoken(tokSemicolon, tokSemicolon->linenr(), tokSemicolon->fileIndex());
926924
}
927925
brackets.pop();
928-
if (indentlevel <= 1 && brackets.empty()) {
929-
// there is a bug if indentlevel is 0
930-
// the "}" token should only be added if indentlevel is 1 but I add it always intentionally
931-
// if indentlevel ever becomes 0, cppcheck will write:
932-
// ### Error: Invalid number of character {
926+
if (brackets.empty()) {
933927
inTemplateDefinition = false;
934928
break;
935929
}
936-
--indentlevel;
937930
} else if (tok3->str() == ")") {
938931
assert(brackets.empty() == false && brackets.top()->str() == "(");
939932
Token::createMutualLinks(brackets.top(), tokenlist.back());

0 commit comments

Comments
 (0)