Add some debugging code (inspired by #6021)
This commit is contained in:
parent
f09dded7b1
commit
5b6758b03b
|
@ -1274,6 +1274,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
|
|||
}
|
||||
}
|
||||
Token * const tok2 = *iter2;
|
||||
assert(tokenlist.validateToken(tok2)); // that assertion fails on examples from #6021
|
||||
if (tok2->str() != name)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1107,3 +1107,14 @@ std::string TokenList::fileLine(const Token *tok) const
|
|||
{
|
||||
return ErrorLogger::ErrorMessage::FileLocation(tok, this).stringify();
|
||||
}
|
||||
|
||||
bool TokenList::validateToken(const Token* tok) const
|
||||
{
|
||||
if (!tok)
|
||||
return true;
|
||||
for (Token *t = _front; t; t = t->next()) {
|
||||
if (tok==t)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -137,6 +137,14 @@ public:
|
|||
*/
|
||||
void validateAst();
|
||||
|
||||
/**
|
||||
* Verify that the given token is an element of the tokenlist.
|
||||
* That method is implemented for debugging purposes.
|
||||
* @param[in] tok token to be checked
|
||||
* \return true if token was found in tokenlist, false else. In case of nullptr true is returned.
|
||||
*/
|
||||
bool validateToken(const Token* tok) const;
|
||||
|
||||
private:
|
||||
|
||||
/** Disable copy constructor, no implementation */
|
||||
|
|
Loading…
Reference in New Issue