From e136b59f2170ef4022e33d3c2d54d07aa4556029 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Wed, 12 Sep 2012 20:46:56 +0200 Subject: [PATCH] Removed redundant "simplifyTemplates" prefix (information already in class name) from function names in TemplateSimplifier. --- lib/templatesimplifier.cpp | 30 +++++++++++++++--------------- lib/templatesimplifier.h | 14 +++++++------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 78cc604ec..41d9baa31 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -305,7 +305,7 @@ bool TemplateSimplifier::removeTemplate(Token *tok) return false; } -std::set TemplateSimplifier::simplifyTemplatesExpandSpecialized(Token *tokens) +std::set TemplateSimplifier::expandSpecialized(Token *tokens) { std::set expandedtemplates; @@ -367,7 +367,7 @@ std::set TemplateSimplifier::simplifyTemplatesExpandSpecialized(Tok return expandedtemplates; } -std::list TemplateSimplifier::simplifyTemplatesGetTemplateDeclarations(Token *tokens, bool &codeWithTemplates) +std::list TemplateSimplifier::getTemplateDeclarations(Token *tokens, bool &codeWithTemplates) { std::list templates; for (Token *tok = tokens; tok; tok = tok->next()) { @@ -395,7 +395,7 @@ std::list TemplateSimplifier::simplifyTemplatesGetTemplateDeclarations( } -std::list TemplateSimplifier::simplifyTemplatesGetTemplateInstantiations(Token *tokens) +std::list TemplateSimplifier::getTemplateInstantiations(Token *tokens) { std::list used; @@ -431,7 +431,7 @@ std::list TemplateSimplifier::simplifyTemplatesGetTemplateInstantiation } -void TemplateSimplifier::simplifyTemplatesUseDefaultArgumentValues(const std::list &templates, +void TemplateSimplifier::useDefaultArgumentValues(const std::list &templates, const std::list &templateInstantiations) { for (std::list::const_iterator iter1 = templates.begin(); iter1 != templates.end(); ++iter1) { @@ -526,7 +526,7 @@ void TemplateSimplifier::simplifyTemplatesUseDefaultArgumentValues(const std::li } } -bool TemplateSimplifier::simplifyTemplatesInstantiateMatch(const Token *instance, const std::string &name, std::size_t numberOfArguments, const char patternAfter[]) +bool TemplateSimplifier::instantiateMatch(const Token *instance, const std::string &name, std::size_t numberOfArguments, const char patternAfter[]) { if (!Token::simpleMatch(instance, (name + " <").c_str())) return false; @@ -544,7 +544,7 @@ bool TemplateSimplifier::simplifyTemplatesInstantiateMatch(const Token *instance return true; } -int TemplateSimplifier::simplifyTemplatesGetTemplateNamePosition(const Token *tok) +int TemplateSimplifier::getTemplateNamePosition(const Token *tok) { // get the position of the template name int namepos = 0; @@ -565,7 +565,7 @@ int TemplateSimplifier::simplifyTemplatesGetTemplateNamePosition(const Token *to } -void TemplateSimplifier::simplifyTemplatesExpandTemplate( +void TemplateSimplifier::expandTemplate( TokenList& tokenlist, const Token *tok, const std::string &name, @@ -584,7 +584,7 @@ void TemplateSimplifier::simplifyTemplatesExpandTemplate( } // member function implemented outside class definition - else if (TemplateSimplifier::simplifyTemplatesInstantiateMatch(tok3, name, typeParametersInDeclaration.size(), ":: ~| %var% (")) { + else if (TemplateSimplifier::instantiateMatch(tok3, name, typeParametersInDeclaration.size(), ":: ~| %var% (")) { tokenlist.addtoken(newName.c_str(), tok3->linenr(), tok3->fileIndex()); while (tok3->str() != "::") tok3 = tok3->next(); @@ -969,7 +969,7 @@ bool TemplateSimplifier::simplifyTemplateInstantions( return false; // get the position of the template name - int namepos = TemplateSimplifier::simplifyTemplatesGetTemplateNamePosition(tok); + int namepos = TemplateSimplifier::getTemplateNamePosition(tok); if (namepos == -1) { // debug message that we bail out.. if (_settings->debugwarnings) { @@ -1006,7 +1006,7 @@ bool TemplateSimplifier::simplifyTemplateInstantions( continue; if (Token::Match(tok2->previous(), "[;{}=]") && - !TemplateSimplifier::simplifyTemplatesInstantiateMatch(*iter2, name, typeParametersInDeclaration.size(), isfunc ? "(" : "*| %var%")) + !TemplateSimplifier::instantiateMatch(*iter2, name, typeParametersInDeclaration.size(), isfunc ? "(" : "*| %var%")) continue; // New type.. @@ -1061,7 +1061,7 @@ bool TemplateSimplifier::simplifyTemplateInstantions( if (expandedtemplates.find(newName) == expandedtemplates.end()) { expandedtemplates.insert(newName); - TemplateSimplifier::simplifyTemplatesExpandTemplate(tokenlist, tok,name,typeParametersInDeclaration,newName,typesUsedInTemplateInstantion,templateInstantiations); + TemplateSimplifier::expandTemplate(tokenlist, tok,name,typeParametersInDeclaration,newName,typesUsedInTemplateInstantion,templateInstantiations); instantiated = true; } @@ -1124,11 +1124,11 @@ void TemplateSimplifier::simplifyTemplates( ) { - std::set expandedtemplates(TemplateSimplifier::simplifyTemplatesExpandSpecialized(tokenlist.front())); + std::set expandedtemplates(TemplateSimplifier::expandSpecialized(tokenlist.front())); // Locate templates and set member variable _codeWithTemplates if the code has templates. // this info is used by checks - std::list templates(TemplateSimplifier::simplifyTemplatesGetTemplateDeclarations(tokenlist.front(), _codeWithTemplates)); + std::list templates(TemplateSimplifier::getTemplateDeclarations(tokenlist.front(), _codeWithTemplates)); if (templates.empty()) return; @@ -1148,14 +1148,14 @@ void TemplateSimplifier::simplifyTemplates( } // Locate possible instantiations of templates.. - std::list templateInstantiations(TemplateSimplifier::simplifyTemplatesGetTemplateInstantiations(tokenlist.front())); + std::list templateInstantiations(TemplateSimplifier::getTemplateInstantiations(tokenlist.front())); // No template instantiations? Then return. if (templateInstantiations.empty()) return; // Template arguments with default values - TemplateSimplifier::simplifyTemplatesUseDefaultArgumentValues(templates, templateInstantiations); + TemplateSimplifier::useDefaultArgumentValues(templates, templateInstantiations); // expand templates //bool done = false; diff --git a/lib/templatesimplifier.h b/lib/templatesimplifier.h index 51e59173f..7da9f3aae 100644 --- a/lib/templatesimplifier.h +++ b/lib/templatesimplifier.h @@ -68,26 +68,26 @@ public: * Expand specialized templates : "template<>.." * @return names of expanded templates */ - static std::set simplifyTemplatesExpandSpecialized(Token *tokens); + static std::set expandSpecialized(Token *tokens); /** * Get template declarations * @return list of template declarations */ - static std::list simplifyTemplatesGetTemplateDeclarations(Token *tokens, bool &codeWithTemplates); + static std::list getTemplateDeclarations(Token *tokens, bool &codeWithTemplates); /** * Get template instantiations * @return list of template instantiations */ - static std::list simplifyTemplatesGetTemplateInstantiations(Token *tokens); + static std::list getTemplateInstantiations(Token *tokens); /** * simplify template instantiations (use default argument values) * @param templates list of template declarations * @param templateInstantiations list of template instantiations */ - static void simplifyTemplatesUseDefaultArgumentValues(const std::list &templates, + static void useDefaultArgumentValues(const std::list &templates, const std::list &templateInstantiations); /** @@ -98,7 +98,7 @@ public: * @param patternAfter pattern that must match the tokens after the ">" * @return match => true */ - static bool simplifyTemplatesInstantiateMatch(const Token *instance, const std::string &name, std::size_t numberOfArguments, const char patternAfter[]); + static bool instantiateMatch(const Token *instance, const std::string &name, std::size_t numberOfArguments, const char patternAfter[]); /** * Match template declaration/instantiation @@ -106,9 +106,9 @@ public: * @return -1 to bail out or positive integer to identity the position * of the template name. */ - static int simplifyTemplatesGetTemplateNamePosition(const Token *tok); + static int getTemplateNamePosition(const Token *tok); - static void simplifyTemplatesExpandTemplate( + static void expandTemplate( TokenList& tokenlist, const Token *tok, const std::string &name,