Fixed #5054 (debug warnings when Variable::typeStartToken() or Variable::typeEndTypen() is not set correctly)
This commit is contained in:
parent
d3798958f4
commit
f96a88ec57
|
@ -3636,6 +3636,27 @@ bool Tokenizer::simplifyTokenList()
|
||||||
|
|
||||||
if (_settings->debugwarnings) {
|
if (_settings->debugwarnings) {
|
||||||
printUnknownTypes();
|
printUnknownTypes();
|
||||||
|
|
||||||
|
// #5054 - the typeStartToken() should come before typeEndToken()
|
||||||
|
for (const Token *tok = tokens(); tok; tok = tok->next()) {
|
||||||
|
if (tok->varId() == 0U)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const Variable *var = tok->variable();
|
||||||
|
if (!var)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const Token * typetok = var->typeStartToken();
|
||||||
|
while (typetok && typetok != var->typeEndToken())
|
||||||
|
typetok = typetok->next();
|
||||||
|
|
||||||
|
if (typetok != var->typeEndToken()) {
|
||||||
|
reportError(tok,
|
||||||
|
Severity::debug,
|
||||||
|
"debug",
|
||||||
|
"Variable::typeStartToken() is not located before Variable::typeEndToken(). The location of the typeStartToken() is '" + var->typeStartToken()->str() + "' at line " + MathLib::toString(var->typeStartToken()->linenr()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue