Tokenizer: Added debug warning that is shown when bailing out in simplifyKnownVariables
This commit is contained in:
parent
8a379d4826
commit
afcc28e9ee
|
@ -5972,7 +5972,30 @@ bool Tokenizer::simplifyKnownVariables()
|
||||||
|
|
||||||
// Variable is used somehow in a non-defined pattern => bail out
|
// Variable is used somehow in a non-defined pattern => bail out
|
||||||
if (tok3->varId() == varid)
|
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;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Using the variable in condition..
|
// Using the variable in condition..
|
||||||
if (Token::Match(tok3->previous(), "if ( %varid% ==|!=|<|<=|>|>=|)", varid) ||
|
if (Token::Match(tok3->previous(), "if ( %varid% ==|!=|<|<=|>|>=|)", varid) ||
|
||||||
|
|
Loading…
Reference in New Issue