refactoring, use early continue in for loop
This commit is contained in:
parent
15b0eb42bd
commit
3ab8466415
|
@ -763,7 +763,17 @@ bool CheckUninitVar::checkLoopBody(const Token *tok, const Variable& var, const
|
||||||
assert(tok->str() == "{");
|
assert(tok->str() == "{");
|
||||||
|
|
||||||
for (const Token * const end = tok->link(); tok != end; tok = tok->next()) {
|
for (const Token * const end = tok->link(); tok != end; tok = tok->next()) {
|
||||||
if (tok->varId() == var.declarationId()) {
|
if (Token::Match(tok, "sizeof|typeof (")) {
|
||||||
|
tok = tok->next()->link();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Token::Match(tok, "asm ( %str% ) ;"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (tok->varId() != var.declarationId())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!membervar.empty()) {
|
if (!membervar.empty()) {
|
||||||
if (isMemberVariableAssignment(tok, membervar)) {
|
if (isMemberVariableAssignment(tok, membervar)) {
|
||||||
bool assign = true;
|
bool assign = true;
|
||||||
|
@ -820,13 +830,6 @@ bool CheckUninitVar::checkLoopBody(const Token *tok, const Variable& var, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token::Match(tok, "sizeof|typeof ("))
|
|
||||||
tok = tok->next()->link();
|
|
||||||
|
|
||||||
if (Token::Match(tok, "asm ( %str% ) ;"))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!suppressErrors && usetok) {
|
if (!suppressErrors && usetok) {
|
||||||
if (membervar.empty())
|
if (membervar.empty())
|
||||||
uninitvarError(usetok, usetok->str(), alloc);
|
uninitvarError(usetok, usetok->str(), alloc);
|
||||||
|
|
Loading…
Reference in New Issue