Tokenizer::simplifyTemplates: broke out the functionality that extract a list of template declarations

This commit is contained in:
Daniel Marjamäki 2011-02-12 20:12:07 +01:00
parent 654116af61
commit 25d6bfe3c4
2 changed files with 19 additions and 7 deletions

View File

@ -2617,13 +2617,8 @@ std::set<std::string> Tokenizer::simplifyTemplatesExpandSpecialized()
return expandedtemplates;
}
void Tokenizer::simplifyTemplates()
std::list<Token *> Tokenizer::simplifyTemplatesGetTemplateDeclarations()
{
std::set<std::string> expandedtemplates;
expandedtemplates = simplifyTemplatesExpandSpecialized();
// Locate templates..
std::list<Token *> templates;
for (Token *tok = _tokens; tok; tok = tok->next())
{
@ -2648,6 +2643,16 @@ void Tokenizer::simplifyTemplates()
}
}
}
return templates;
}
void Tokenizer::simplifyTemplates()
{
std::set<std::string> expandedtemplates(simplifyTemplatesExpandSpecialized());
// Locate templates..
std::list<Token *> templates(simplifyTemplatesGetTemplateDeclarations());
if (templates.empty())
{
removeTemplates(_tokens);

View File

@ -24,6 +24,7 @@
#include <string>
#include <map>
#include <list>
#include <vector>
#include <set>
@ -398,10 +399,16 @@ public:
/**
* Expand specialized templates : "template<>.."
* \return names of expanded templates
* @return names of expanded templates
*/
std::set<std::string> simplifyTemplatesExpandSpecialized();
/**
* Get template declarations
* @return list of template declarations
*/
std::list<Token *> simplifyTemplatesGetTemplateDeclarations();
/**
* Used after simplifyTemplates to perform a little cleanup.
* Sometimes the simplifyTemplates isn't fully successful and then