Fixed #2484 (false positive because template is not instantiated properly)
This commit is contained in:
parent
bc31f317bc
commit
5c88129f01
|
@ -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<std::string> 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<Token *> used;
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
|
|
Loading…
Reference in New Issue