Skip to content

Commit b118f4c

Browse files
committed
fix #13714
1 parent 5be3248 commit b118f4c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/tokenize.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6339,10 +6339,16 @@ void Tokenizer::simplifyHeadersAndUnusedTemplates()
63396339
}
63406340

63416341
const std::set<std::string> functionStart{"static", "const", "unsigned", "signed", "void", "bool", "char", "short", "int", "long", "float", "*"};
6342+
bool goBack = false;
63426343

63436344
for (Token *tok = list.front(); tok; tok = tok->next()) {
63446345
const bool isIncluded = (tok->fileIndex() != 0);
63456346

6347+
if (goBack) {
6348+
tok = tok->previous();
6349+
}
6350+
goBack = false;
6351+
63466352
// Remove executable code
63476353
if (isIncluded && !mSettings.checkHeaders && tok->str() == "{") {
63486354
// TODO: We probably need to keep the executable code if this function is called from the source file.
@@ -6408,6 +6414,7 @@ void Tokenizer::simplifyHeadersAndUnusedTemplates()
64086414
const Token *endToken = closingBracket->linkAt(3)->linkAt(1)->next();
64096415
Token::eraseTokens(tok, endToken);
64106416
tok->deleteThis();
6417+
goBack = true;
64116418
}
64126419
}
64136420
}

0 commit comments

Comments
 (0)