Tokenizer: Added debug warning that is shown when bailing out in simplifyKnownVariables

This commit is contained in:
Daniel Marjamäki 2010-11-06 15:42:41 +01:00
parent 8a379d4826
commit afcc28e9ee
1 changed files with 23 additions and 0 deletions

View File

@ -5972,7 +5972,30 @@ bool Tokenizer::simplifyKnownVariables()
// Variable is used somehow in a non-defined pattern => bail out
if (tok3->varId() == varid)
{
// This is a really generic bailout so let's try to avoid this.
// There might be lots of false negatives.
if (_settings && _settings->debugwarnings)
{
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
ErrorLogger::ErrorMessage::FileLocation loc;
loc.line = tok3->linenr();
loc.setfile(file(tok3));
locationList.push_back(loc);
const ErrorLogger::ErrorMessage errmsg(locationList,
Severity::debug,
"simplifyKnownVariables: bailing out (variable="+tok3->str()+", value="+value+")",
"debug");
if (_errorLogger)
_errorLogger->reportErr(errmsg);
else
Check::reportError(errmsg);
}
break;
}
// Using the variable in condition..
if (Token::Match(tok3->previous(), "if ( %varid% ==|!=|<|<=|>|>=|)", varid) ||