Cppcheck
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
TemplateSimplifier Class Reference

Simplify templates from the preprocessed and partially simplified code. More...

#include <templatesimplifier.h>

Classes

class  TokenAndName
 Token and its full scopename. More...
 

Public Member Functions

 TemplateSimplifier (Tokenizer &tokenizer)
 
const std::string & dump () const
 
void checkComplicatedSyntaxErrorsInTemplates ()
 
int getTemplateNamePosition (const Token *tok)
 Match template declaration/instantiation. More...
 
void simplifyTemplates (const std::time_t maxtime)
 Simplify templates. More...
 
bool simplifyCalculations (Token *frontToken=nullptr, const Token *backToken=nullptr, bool isTemplate=true)
 Simplify constant calculations such as "1+2" => "3". More...
 
void simplifyTemplateArgs (Token *start, const Token *end, std::vector< newInstantiation > *newInst=nullptr)
 Simplify template instantiation arguments. More...
 

Static Public Member Functions

static unsigned int templateParameters (const Token *tok)
 is the token pointing at a template parameters block < int , 3 > => yes More...
 
static TokenfindTemplateDeclarationEnd (Token *tok)
 Find last token of a template declaration. More...
 
static const TokenfindTemplateDeclarationEnd (const Token *tok)
 
static bool instantiateMatch (const Token *instance, const std::size_t numberOfArguments, bool variadic, const char patternAfter[])
 Match template declaration/instantiation. More...
 
static bool getTemplateNamePositionTemplateClass (const Token *tok, int &namepos)
 Get class template name position. More...
 
static bool getTemplateNamePositionTemplateFunction (const Token *tok, int &namepos)
 Get function template name position. More...
 
static bool getTemplateNamePositionTemplateVariable (const Token *tok, int &namepos)
 Get variable template name position. More...
 
static bool simplifyNumericCalculations (Token *tok, bool isTemplate=true)
 Simplify constant calculations such as "1+2" => "3". More...
 

Private Member Functions

bool getTemplateDeclarations ()
 Get template declarations. More...
 
void addInstantiation (Token *token, const std::string &scope)
 Add template instantiation. More...
 
void getTemplateInstantiations ()
 Get template instantiations. More...
 
void fixForwardDeclaredDefaultArgumentValues ()
 Fix forward declared default argument values by copying them when they are not present in the declaration. More...
 
void useDefaultArgumentValues ()
 simplify template instantiations (use default argument values) More...
 
void useDefaultArgumentValues (TokenAndName &declaration)
 simplify template instantiations (use default argument values) More...
 
void getSpecializations ()
 Try to locate a matching declaration for each user defined specialization. More...
 
void getPartialSpecializations ()
 Try to locate a matching declaration for each user defined partial specialization. More...
 
void simplifyTemplateAliases ()
 simplify template aliases More...
 
bool simplifyTemplateInstantiations (const TokenAndName &templateDeclaration, const std::list< const Token * > &specializations, const std::time_t maxtime, std::set< std::string > &expandedtemplates)
 Simplify templates : expand all instantiations for a template. More...
 
void addNamespace (const TokenAndName &templateDeclaration, const Token *tok)
 Simplify templates : add namespace to template name. More...
 
void expandTemplate (const TokenAndName &templateDeclaration, const TokenAndName &templateInstantiation, const std::vector< const Token * > &typeParametersInDeclaration, const std::string &newName, bool copy)
 Expand a template. More...
 
void replaceTemplateUsage (const TokenAndName &instantiation, const std::list< std::string > &typeStringsUsedInTemplateInstantiation, const std::string &newName)
 Replace all matching template usages 'Foo < int >' => 'Foo<int>'. More...
 
std::string getNewName (Token *tok2, std::list< std::string > &typeStringsUsedInTemplateInstantiation)
 Get the new token name. More...
 
void printOut (const TokenAndName &tokenAndName, const std::string &indent=" ") const
 
void printOut (const std::string &text=emptyString) const
 

Static Private Member Functions

static bool alreadyHasNamespace (const TokenAndName &templateDeclaration, const Token *tok)
 Simplify templates : check if namespace already present. More...
 
static void getTemplateParametersInDeclaration (const Token *tok, std::vector< const Token * > &typeParametersInDeclaration)
 TemplateParametersInDeclaration. More...
 
static bool removeTemplate (Token *tok, std::map< Token *, Token * > *forwardDecls=nullptr)
 Remove a specific "template < ..." template class/function. More...
 
static NORETURN void syntaxError (const Token *tok)
 Syntax error. More...
 
static bool matchSpecialization (const Token *templateDeclarationNameToken, const Token *templateInstantiationNameToken, const std::list< const Token * > &specializations)
 
static void eraseTokens (Token *begin, const Token *end)
 
static void deleteToken (Token *tok)
 Delete specified token without invalidating pointer to following token. More...
 

Private Attributes

TokenizermTokenizer
 
TokenListmTokenList
 
const SettingsmSettings
 
ErrorLoggermErrorLogger
 
bool mChanged {}
 
std::list< TokenAndNamemTemplateDeclarations
 
std::list< TokenAndNamemTemplateForwardDeclarations
 
std::map< Token *, Token * > mTemplateForwardDeclarationsMap
 
std::map< Token *, Token * > mTemplateSpecializationMap
 
std::map< Token *, Token * > mTemplatePartialSpecializationMap
 
std::list< TokenAndNamemTemplateInstantiations
 
std::list< TokenAndNamemInstantiatedTemplates
 
std::list< TokenAndNamemMemberFunctionsToDelete
 
std::vector< TokenAndNamemExplicitInstantiationsToDelete
 
std::vector< TokenAndNamemTypesUsedInTemplateInstantiation
 
std::unordered_map< const Token *, int > mTemplateNamePos
 
std::string mDump
 

Friends

class TestSimplifyTemplate
 

Detailed Description

Simplify templates from the preprocessed and partially simplified code.

Definition at line 46 of file templatesimplifier.h.

Constructor & Destructor Documentation

◆ TemplateSimplifier()

TemplateSimplifier::TemplateSimplifier ( Tokenizer tokenizer)
explicit

Definition at line 276 of file templatesimplifier.cpp.

Member Function Documentation

◆ addInstantiation()

void TemplateSimplifier::addInstantiation ( Token token,
const std::string &  scope 
)
private

Add template instantiation.

Parameters
tokenfirst token of instantiation
scopescope of instantiation

Definition at line 712 of file templatesimplifier.cpp.

References Token::findClosingBracket(), mTemplateInstantiations, Token::next(), simplifyTemplateArgs(), and Token::tokAt().

Referenced by getTemplateInstantiations(), and simplifyTemplateAliases().

◆ addNamespace()

void TemplateSimplifier::addNamespace ( const TokenAndName templateDeclaration,
const Token tok 
)
private

Simplify templates : add namespace to template name.

Parameters
templateDeclarationtemplate declaration
tokplace to insert namespace

Definition at line 1534 of file templatesimplifier.cpp.

References TokenList::addtoken(), TokenList::back(), Token::column(), emptyString, Token::fileIndex(), Token::insertToken(), Token::linenr(), Token::Match(), mTokenList, TemplateSimplifier::TokenAndName::scope(), Token::str(), Token::strAt(), and Token::tokAt().

Referenced by expandTemplate().

◆ alreadyHasNamespace()

bool TemplateSimplifier::alreadyHasNamespace ( const TokenAndName templateDeclaration,
const Token tok 
)
staticprivate

Simplify templates : check if namespace already present.

Parameters
templateDeclarationtemplate declaration
tokplace to start looking for namespace
Returns
true if namespace already present

Definition at line 1596 of file templatesimplifier.cpp.

References TemplateSimplifier::TokenAndName::scope(), Token::simpleMatch(), and Token::tokAt().

Referenced by expandTemplate().

◆ checkComplicatedSyntaxErrorsInTemplates()

void TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates ( )

◆ deleteToken()

void TemplateSimplifier::deleteToken ( Token tok)
staticprivate

Delete specified token without invalidating pointer to following token.

tok will be invalidated.

Parameters
toktoken to delete

Definition at line 619 of file templatesimplifier.cpp.

References Token::deletePrevious(), Token::deleteThis(), and Token::next().

Referenced by removeTemplate(), and simplifyTemplateAliases().

◆ dump()

const std::string& TemplateSimplifier::dump ( ) const
inline

Definition at line 52 of file templatesimplifier.h.

Referenced by Tokenizer::dump().

◆ eraseTokens()

void TemplateSimplifier::eraseTokens ( Token begin,
const Token end 
)
staticprivate

◆ expandTemplate()

void TemplateSimplifier::expandTemplate ( const TokenAndName templateDeclaration,
const TokenAndName templateInstantiation,
const std::vector< const Token * > &  typeParametersInDeclaration,
const std::string &  newName,
bool  copy 
)
private

Expand a template.

Create "expanded" class/function at end of tokenlist.

Parameters
templateDeclarationTemplate declaration information
templateInstantiationFull name of template
typeParametersInDeclarationThe type parameters of the template
newNameNew name of class/function.
copycopy or expand in place

Definition at line 1618 of file templatesimplifier.cpp.

References addNamespace(), TokenList::addtoken(), alreadyHasNamespace(), TokenList::back(), Token::column(), Token::createMutualLinks(), Token::deleteThis(), eraseTokens(), Token::fileIndex(), Token::findClosingBracket(), findTemplateDeclarationEnd(), TokenList::front(), Token::getMacroName(), getTemplateNamePosition(), getTemplateParametersInDeclaration(), Token::insertToken(), Token::insertTokenBefore(), instantiateMatch(), TemplateSimplifier::TokenAndName::isClass(), TemplateSimplifier::TokenAndName::isFunction(), Tokenizer::isFunctionHead(), Token::isLong(), Token::isName(), Token::isSigned(), TemplateSimplifier::TokenAndName::isSpecialization(), Token::isStandardType(), Token::isTemplateArg(), Token::isUnsigned(), TemplateSimplifier::TokenAndName::isVariable(), TemplateSimplifier::TokenAndName::isVariadic(), Token::linenr(), Token::link(), Token::linkAt(), Token::Match(), mExplicitInstantiationsToDelete, mMemberFunctionsToDelete, mTemplateDeclarations, mTemplateForwardDeclarations, mTemplateForwardDeclarationsMap, mTemplateInstantiations, mTemplateSpecializationMap, mTokenList, mTypesUsedInTemplateInstantiation, TemplateSimplifier::TokenAndName::name(), TemplateSimplifier::TokenAndName::nameToken(), Token::next(), Token::originalName(), TemplateSimplifier::TokenAndName::paramEnd(), Token::previous(), TemplateSimplifier::TokenAndName::scope(), Token::simpleMatch(), simplifyTemplateArgs(), Token::str(), Token::strAt(), templateParameters(), Token::tokAt(), and TemplateSimplifier::TokenAndName::token().

Referenced by simplifyTemplateInstantiations().

◆ findTemplateDeclarationEnd() [1/2]

const Token * TemplateSimplifier::findTemplateDeclarationEnd ( const Token tok)
static

Definition at line 604 of file templatesimplifier.cpp.

References findTemplateDeclarationEndImpl().

◆ findTemplateDeclarationEnd() [2/2]

Token * TemplateSimplifier::findTemplateDeclarationEnd ( Token tok)
static

Find last token of a template declaration.

Parameters
tokstart token of declaration "template" or token after "template < ... >"
Returns
last token of declaration or nullptr if syntax error

Definition at line 599 of file templatesimplifier.cpp.

References findTemplateDeclarationEndImpl().

Referenced by expandTemplate(), getTemplateDeclarations(), getTemplateInstantiations(), removeTemplate(), and Tokenizer::simplifyUsing().

◆ fixForwardDeclaredDefaultArgumentValues()

void TemplateSimplifier::fixForwardDeclaredDefaultArgumentValues ( )
private

Fix forward declared default argument values by copying them when they are not present in the declaration.

Definition at line 3485 of file templatesimplifier.cpp.

References TokenList::copyTokens(), getTemplateParametersInDeclaration(), Token::Match(), mTemplateDeclarations, mTemplateForwardDeclarations, mTemplateForwardDeclarationsMap, Token::next(), and Token::previous().

Referenced by simplifyTemplates().

◆ getNewName()

std::string TemplateSimplifier::getNewName ( Token tok2,
std::list< std::string > &  typeStringsUsedInTemplateInstantiation 
)
private

Get the new token name.

Parameters
tok2name token
typeStringsUsedInTemplateInstantiationtype strings use in template instantiation
Returns
new token name

Definition at line 2993 of file templatesimplifier.cpp.

References Token::findClosingBracket(), Token::Match(), mTypesUsedInTemplateInstantiation, Token::next(), templateParameters(), and Token::tokAt().

Referenced by simplifyTemplateInstantiations().

◆ getPartialSpecializations()

void TemplateSimplifier::getPartialSpecializations ( )
private

Try to locate a matching declaration for each user defined partial specialization.

Definition at line 3464 of file templatesimplifier.cpp.

References mTemplateDeclarations, mTemplateForwardDeclarations, and mTemplatePartialSpecializationMap.

Referenced by simplifyTemplates().

◆ getSpecializations()

void TemplateSimplifier::getSpecializations ( )
private

Try to locate a matching declaration for each user defined specialization.

Definition at line 3443 of file templatesimplifier.cpp.

References mTemplateDeclarations, mTemplateForwardDeclarations, and mTemplateSpecializationMap.

Referenced by simplifyTemplates().

◆ getTemplateDeclarations()

bool TemplateSimplifier::getTemplateDeclarations ( )
private

◆ getTemplateInstantiations()

void TemplateSimplifier::getTemplateInstantiations ( )
private

◆ getTemplateNamePosition()

int TemplateSimplifier::getTemplateNamePosition ( const Token tok)

Match template declaration/instantiation.

Parameters
tokThe ">" token e.g. before "class"
Returns
-1 to bail out or positive integer to identity the position of the template name.

Definition at line 1509 of file templatesimplifier.cpp.

References Settings::debugtemplate, getTemplateNamePositionTemplateClass(), getTemplateNamePositionTemplateFunction(), getTemplateNamePositionTemplateVariable(), Token::Match(), mSettings, mTemplateNamePos, Token::str(), syntaxError(), and Token::tokAt().

Referenced by expandTemplate(), getTemplateDeclarations(), and getTemplateInstantiations().

◆ getTemplateNamePositionTemplateClass()

bool TemplateSimplifier::getTemplateNamePositionTemplateClass ( const Token tok,
int &  namepos 
)
static

Get class template name position.

Parameters
tokThe ">" token e.g. before "class"
nameposreturn offset to name
Returns
true if name found, false if not

Definition at line 1480 of file templatesimplifier.cpp.

References Token::findClosingBracket(), Token::Match(), Token::next(), Token::strAt(), and Token::tokAt().

Referenced by getTemplateNamePosition().

◆ getTemplateNamePositionTemplateFunction()

bool TemplateSimplifier::getTemplateNamePositionTemplateFunction ( const Token tok,
int &  namepos 
)
static

Get function template name position.

Parameters
tokThe ">" token
nameposreturn offset to name
Returns
true if name found, false if not

Definition at line 1416 of file templatesimplifier.cpp.

References Token::findClosingBracket(), Tokenizer::isFunctionHead(), Token::linkAt(), Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::strAt(), and Token::tokAt().

Referenced by getTemplateNamePosition().

◆ getTemplateNamePositionTemplateVariable()

bool TemplateSimplifier::getTemplateNamePositionTemplateVariable ( const Token tok,
int &  namepos 
)
static

Get variable template name position.

Parameters
tokThe ">" token
nameposreturn offset to name
Returns
true if name found, false if not

Definition at line 1448 of file templatesimplifier.cpp.

References Token::findClosingBracket(), Token::linkAt(), Token::Match(), Token::next(), Token::simpleMatch(), and Token::tokAt().

Referenced by getTemplateNamePosition().

◆ getTemplateParametersInDeclaration()

void TemplateSimplifier::getTemplateParametersInDeclaration ( const Token tok,
std::vector< const Token * > &  typeParametersInDeclaration 
)
staticprivate

TemplateParametersInDeclaration.

Parameters
toktemplate < typename T, typename S > ^ tok
typeParametersInDeclarationtemplate < typename T, typename S > ^ [0] ^ [1]

Definition at line 2909 of file templatesimplifier.cpp.

References Token::findClosingBracket(), Token::link(), Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), and Token::strAt().

Referenced by expandTemplate(), fixForwardDeclaredDefaultArgumentValues(), getTemplateInstantiations(), matchSpecialization(), simplifyTemplateAliases(), and simplifyTemplateInstantiations().

◆ instantiateMatch()

bool TemplateSimplifier::instantiateMatch ( const Token instance,
const std::size_t  numberOfArguments,
bool  variadic,
const char  patternAfter[] 
)
static

Match template declaration/instantiation.

Parameters
instancetemplate instantiation
numberOfArgumentsnumber of template arguments
variadiclast template argument is variadic
patternAfterpattern that must match the tokens after the ">"
Returns
match => true

Definition at line 1397 of file templatesimplifier.cpp.

References Token::findClosingBracket(), Token::Match(), Token::next(), numberOfArguments(), Token::strAt(), and templateParameters().

Referenced by expandTemplate(), and simplifyTemplateInstantiations().

◆ matchSpecialization()

bool TemplateSimplifier::matchSpecialization ( const Token templateDeclarationNameToken,
const Token templateInstantiationNameToken,
const std::list< const Token * > &  specializations 
)
staticprivate

◆ printOut() [1/2]

void TemplateSimplifier::printOut ( const std::string &  text = emptyString) const
private

◆ printOut() [2/2]

void TemplateSimplifier::printOut ( const TokenAndName tokenAndName,
const std::string &  indent = "    " 
) const
private

◆ removeTemplate()

bool TemplateSimplifier::removeTemplate ( Token tok,
std::map< Token *, Token * > *  forwardDecls = nullptr 
)
staticprivate

Remove a specific "template < ..." template class/function.

Definition at line 639 of file templatesimplifier.cpp.

References deleteToken(), eraseTokens(), findTemplateDeclarationEnd(), invalidateForwardDecls(), Token::next(), and Token::simpleMatch().

Referenced by simplifyTemplates().

◆ replaceTemplateUsage()

void TemplateSimplifier::replaceTemplateUsage ( const TokenAndName instantiation,
const std::list< std::string > &  typeStringsUsedInTemplateInstantiation,
const std::string &  newName 
)
private

Replace all matching template usages 'Foo < int >' => 'Foo<int>'.

Parameters
instantiationTemplate instantiation information.
typeStringsUsedInTemplateInstantiationtemplate parameters. list of token strings.
newNameThe new type name

Definition at line 3346 of file templatesimplifier.cpp.

References eraseTokens(), Token::findClosingBracket(), TokenList::front(), TemplateSimplifier::TokenAndName::fullName(), Token::Match(), matchTemplateParameters(), mTemplateInstantiations, mTemplateNamePos, mTokenList, TemplateSimplifier::TokenAndName::name(), Token::next(), Token::simpleMatch(), and Token::str().

Referenced by simplifyTemplateInstantiations().

◆ simplifyCalculations()

bool TemplateSimplifier::simplifyCalculations ( Token frontToken = nullptr,
const Token backToken = nullptr,
bool  isTemplate = true 
)

Simplify constant calculations such as "1+2" => "3".

This also performs simple cleanup of parentheses etc.

Returns
true if modifications to token-list are done. false if no modifications are done.

Definition at line 2650 of file templatesimplifier.cpp.

References Token::deleteNext(), eraseTokens(), TokenList::front(), MathLib::getSuffix(), MathLib::isFloat(), MathLib::isInt(), isLowerThanLogicalAnd(), isLowerThanMulDiv(), isLowerThanXor(), Token::Match(), mTokenList, Token::next(), op1, op2, simplifyNumericCalculations(), Token::str(), MathLib::toBigNumber(), Token::tokAt(), validTokenEnd(), and validTokenStart().

Referenced by simplifyTemplateArgs().

◆ simplifyNumericCalculations()

bool TemplateSimplifier::simplifyNumericCalculations ( Token tok,
bool  isTemplate = true 
)
static

◆ simplifyTemplateAliases()

void TemplateSimplifier::simplifyTemplateAliases ( )
private

◆ simplifyTemplateArgs()

void TemplateSimplifier::simplifyTemplateArgs ( Token start,
const Token end,
std::vector< newInstantiation > *  newInst = nullptr 
)

◆ simplifyTemplateInstantiations()

bool TemplateSimplifier::simplifyTemplateInstantiations ( const TokenAndName templateDeclaration,
const std::list< const Token * > &  specializations,
const std::time_t  maxtime,
std::set< std::string > &  expandedtemplates 
)
private

Simplify templates : expand all instantiations for a template.

Todo:
It seems that inner templates should be instantiated recursively
Parameters
templateDeclarationtemplate declaration
specializationstemplate specializations (list each template name token)
maxtimetime when the simplification will stop
expandedtemplatesall templates that has been expanded so far. The full names are stored.
Returns
true if the template was instantiated

Definition at line 3049 of file templatesimplifier.cpp.

References debug, Settings::debugwarnings, emptyString, expandTemplate(), Token::findOpeningBracket(), TemplateSimplifier::TokenAndName::fullName(), TokenList::getFiles(), getFunctionArguments(), getNewName(), getTemplateParametersInDeclaration(), information, instantiateMatch(), SimpleEnableGroup< T >::isEnabled(), TemplateSimplifier::TokenAndName::isFunction(), TemplateSimplifier::TokenAndName::isSpecialization(), TemplateSimplifier::TokenAndName::isVariable(), TemplateSimplifier::TokenAndName::isVariadic(), Token::linkAt(), Tokenizer::list, Token::Match(), matchSpecialization(), Settings::maxTemplateRecursion, mChanged, mErrorLogger, mSettings, mTemplateInstantiations, mTokenizer, mTokenList, mTypesUsedInTemplateInstantiation, TemplateSimplifier::TokenAndName::name(), TemplateSimplifier::TokenAndName::nameToken(), Token::next(), normal, Token::previous(), Token::progressValue(), replaceTemplateUsage(), ErrorLogger::reportErr(), ErrorLogger::reportProgress(), TemplateSimplifier::TokenAndName::scope(), Settings::severity, Token::simpleMatch(), Token::str(), Token::strAt(), Token::tokAt(), TemplateSimplifier::TokenAndName::token(), and TokenList::validateToken().

Referenced by simplifyTemplates().

◆ simplifyTemplates()

void TemplateSimplifier::simplifyTemplates ( const std::time_t  maxtime)

Simplify templates.

Parameters
maxtimetime when the simplification should be stopped

Definition at line 3726 of file templatesimplifier.cpp.

References Tokenizer::calculateScopes(), Standards::cpp, Standards::CPP17, Standards::CPP20, Token::createMutualLinks(), debug, Settings::debugnormal, Settings::debugtemplate, Settings::debugwarnings, Token::deleteNext(), Token::deleteThis(), eraseTokens(), Token::eraseTokens(), Token::findClosingBracket(), fixForwardDeclaredDefaultArgumentValues(), TokenList::front(), TemplateSimplifier::TokenAndName::fullName(), TokenList::getFiles(), getFunctionArguments(), getPartialSpecializations(), getSpecializations(), getTemplateDeclarations(), getTemplateInstantiations(), isConstMethod(), isFalse(), TemplateSimplifier::TokenAndName::isFunction(), Token::isName(), Token::link(), Tokenizer::list, Token::Match(), mChanged, mDump, mErrorLogger, mExplicitInstantiationsToDelete, mInstantiatedTemplates, mMemberFunctionsToDelete, mSettings, mTemplateDeclarations, mTemplateForwardDeclarations, mTemplateForwardDeclarationsMap, mTemplateInstantiations, mTemplateNamePos, mTemplatePartialSpecializationMap, mTemplateSpecializationMap, mTokenizer, mTokenList, TemplateSimplifier::TokenAndName::nameToken(), Token::next(), normal, Token::previous(), Token::printOut(), printOut(), removeTemplate(), ErrorLogger::reportErr(), Token::simpleMatch(), simplifyTemplateAliases(), simplifyTemplateInstantiations(), Tokenizer::simplifyUsing(), skipRequires(), Settings::standards, Token::str(), Token::tokAt(), and useDefaultArgumentValues().

Referenced by Tokenizer::simplifyTemplates().

◆ syntaxError()

void TemplateSimplifier::syntaxError ( const Token tok)
staticprivate

◆ templateParameters()

unsigned int TemplateSimplifier::templateParameters ( const Token tok)
static

◆ useDefaultArgumentValues() [1/2]

void TemplateSimplifier::useDefaultArgumentValues ( )
private

simplify template instantiations (use default argument values)

Definition at line 1032 of file templatesimplifier.cpp.

References mTemplateDeclarations, and mTemplateForwardDeclarations.

Referenced by simplifyTemplates().

◆ useDefaultArgumentValues() [2/2]

void TemplateSimplifier::useDefaultArgumentValues ( TokenAndName declaration)
private

Friends And Related Function Documentation

◆ TestSimplifyTemplate

friend class TestSimplifyTemplate
friend

Definition at line 47 of file templatesimplifier.h.

Member Data Documentation

◆ mChanged

bool TemplateSimplifier::mChanged {}
private

◆ mDump

std::string TemplateSimplifier::mDump
private

Definition at line 511 of file templatesimplifier.h.

Referenced by simplifyTemplates().

◆ mErrorLogger

ErrorLogger& TemplateSimplifier::mErrorLogger
private

◆ mExplicitInstantiationsToDelete

std::vector<TokenAndName> TemplateSimplifier::mExplicitInstantiationsToDelete
private

Definition at line 508 of file templatesimplifier.h.

Referenced by expandTemplate(), and simplifyTemplates().

◆ mInstantiatedTemplates

std::list<TokenAndName> TemplateSimplifier::mInstantiatedTemplates
private

Definition at line 506 of file templatesimplifier.h.

Referenced by simplifyTemplates().

◆ mMemberFunctionsToDelete

std::list<TokenAndName> TemplateSimplifier::mMemberFunctionsToDelete
private

Definition at line 507 of file templatesimplifier.h.

Referenced by expandTemplate(), and simplifyTemplates().

◆ mSettings

const Settings& TemplateSimplifier::mSettings
private

◆ mTemplateDeclarations

std::list<TokenAndName> TemplateSimplifier::mTemplateDeclarations
private

◆ mTemplateForwardDeclarations

std::list<TokenAndName> TemplateSimplifier::mTemplateForwardDeclarations
private

◆ mTemplateForwardDeclarationsMap

std::map<Token *, Token *> TemplateSimplifier::mTemplateForwardDeclarationsMap
private

◆ mTemplateInstantiations

std::list<TokenAndName> TemplateSimplifier::mTemplateInstantiations
private

◆ mTemplateNamePos

std::unordered_map<const Token*, int> TemplateSimplifier::mTemplateNamePos
private

◆ mTemplatePartialSpecializationMap

std::map<Token *, Token *> TemplateSimplifier::mTemplatePartialSpecializationMap
private

Definition at line 504 of file templatesimplifier.h.

Referenced by getPartialSpecializations(), printOut(), and simplifyTemplates().

◆ mTemplateSpecializationMap

std::map<Token *, Token *> TemplateSimplifier::mTemplateSpecializationMap
private

◆ mTokenizer

Tokenizer& TemplateSimplifier::mTokenizer
private

◆ mTokenList

TokenList& TemplateSimplifier::mTokenList
private

◆ mTypesUsedInTemplateInstantiation

std::vector<TokenAndName> TemplateSimplifier::mTypesUsedInTemplateInstantiation
private

The documentation for this class was generated from the following files: