diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index c42a7151b..573bbffb6 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2651,35 +2651,6 @@ static void removeTemplates(Token *tok) void Tokenizer::simplifyTemplates() { - // Don't simplify C files - { - if (_files.empty()) - return; - - std::string::size_type pos = _files[0].rfind("."); - if (pos == std::string::npos) - return; - - const std::string ext(_files[0].substr(pos)); - if (ext == ".c" || ext == ".C") - return; - } - - // Remove "typename" unless used in template arguments.. - for (Token *tok = _tokens; tok; tok = tok->next()) - { - if (tok->str() == "typename") - tok->deleteThis(); - - if (Token::simpleMatch(tok, "template <")) - { - while (tok && tok->str() != ">") - tok = tok->next(); - if (!tok) - break; - } - } - std::set expandedtemplates; // Locate specialized templates.. @@ -2775,6 +2746,22 @@ void Tokenizer::simplifyTemplates() return; } + // There are templates.. + // Remove "typename" unless used in template arguments.. + for (Token *tok = _tokens; tok; tok = tok->next()) + { + if (tok->str() == "typename") + tok->deleteThis(); + + if (Token::simpleMatch(tok, "template <")) + { + while (tok && tok->str() != ">") + tok = tok->next(); + if (!tok) + break; + } + } + // Locate possible instantiations of templates.. std::list used; for (Token *tok = _tokens; tok; tok = tok->next())