Add simple debug print to make it possible to detect cases where template simplification goes wrong.

http://sourceforge.net/apps/trac/cppcheck/ticket/1464
This commit is contained in:
Reijo Tomperi 2010-03-02 23:55:05 +02:00
parent e064208f54
commit 75c0ed7e6e
1 changed files with 17 additions and 0 deletions

View File

@ -1642,6 +1642,23 @@ void Tokenizer::simplifyTemplates()
if (pos > 0 && tok->tokAt(pos)->str() == "*")
++pos;
if (_settings && _settings->_debug)
{
int tempPos = pos;
if (tempPos == 0)
tempPos = 2;
if (!Token::Match(tok->tokAt(tempPos), "%var%"))
{
std::cout << "simplifyTemplates error: "
<< file(tok->tokAt(tempPos))
<< ": "
<< tok->tokAt(tempPos)->linenr()
<< ": "
<< tok->tokAt(tempPos)->str()
<< std::endl;
}
}
// name of template function/class..
const std::string name(tok->strAt(pos > 0 ? pos : 2));