--check-headers=no: remove more templates in headers that are not used in the source file

This commit is contained in:
Daniel Marjamäki 2019-03-03 20:18:19 +01:00
parent d84dbf6b5f
commit c5a512338e
1 changed files with 17 additions and 15 deletions

View File

@ -4327,14 +4327,17 @@ void Tokenizer::simplifyHeaders()
Token::eraseTokens(tok, endToken->link()->next());
}
if (Token::simpleMatch(tok->next(), "template <")) {
if (Token::Match(tok->next(), "template < %name%")) {
const Token *tok2 = tok->tokAt(3);
while (Token::Match(tok2, "%name% %name% ,"))
tok2 = tok2->tokAt(3);
if (Token::Match(tok2, "%name% %name% >")) {
tok2 = tok2->tokAt(3);
if (Token::Match(tok2, "class|struct %name% [;:{]") && keep.find(tok2->strAt(1)) == keep.end()) {
const Token *endToken = tok2->tokAt(2);
while (Token::Match(tok2, "%name% %name% [,=>]")) {
tok2 = tok2->tokAt(2);
if (Token::Match(tok2, "= %name% [,>]"))
tok2 = tok2->tokAt(2);
if (tok2->str() == ",")
tok2 = tok2->next();
}
if (Token::Match(tok2, "> class|struct %name% [;:{]") && keep.find(tok2->strAt(2)) == keep.end()) {
const Token *endToken = tok2->tokAt(3);
if (endToken->str() == ":") {
endToken = endToken->next();
while (Token::Match(endToken, "%name%|,"))
@ -4349,7 +4352,6 @@ void Tokenizer::simplifyHeaders()
}
}
}
}
void Tokenizer::removeMacrosInGlobalScope()
{