Tokenizer: various improvements to code.
This commit is contained in:
parent
40739eb3fb
commit
9019190a37
|
@ -3892,6 +3892,10 @@ void Tokenizer::simplifyFlowControl()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok->str() == "{") {
|
if (tok->str() == "{") {
|
||||||
|
if (tok->previous() && tok->previous()->str() == "=") {
|
||||||
|
tok = tok->link();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
beginindent = tok;
|
beginindent = tok;
|
||||||
++indentlevel;
|
++indentlevel;
|
||||||
} else if (tok->str() == "}") {
|
} else if (tok->str() == "}") {
|
||||||
|
@ -4213,7 +4217,7 @@ bool Tokenizer::simplifyIfAddBraces()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tempToken = tempToken->link();
|
tempToken = tempToken->link();
|
||||||
if (!tempToken || !tempToken->next())
|
if (!tempToken->next())
|
||||||
break;
|
break;
|
||||||
if (Token::simpleMatch(tempToken, "} else") && !Token::Match(tempToken->tokAt(2), "if|{"))
|
if (Token::simpleMatch(tempToken, "} else") && !Token::Match(tempToken->tokAt(2), "if|{"))
|
||||||
innerIf = false;
|
innerIf = false;
|
||||||
|
@ -4237,11 +4241,10 @@ bool Tokenizer::simplifyIfAddBraces()
|
||||||
if (!innerIf)
|
if (!innerIf)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (Token::simpleMatch(tempToken, "; else if"))
|
if (Token::simpleMatch(tempToken, "; else")) {
|
||||||
;
|
if (tempToken->strAt(2) != "if")
|
||||||
else if (Token::simpleMatch(tempToken, "; else"))
|
|
||||||
innerIf = false;
|
innerIf = false;
|
||||||
else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6716,10 +6719,8 @@ void Tokenizer::simplifyGoto()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!indentlevel && Token::Match(tok, ") const| {")) {
|
if (!indentlevel && Token::Match(tok, ") const| {"))
|
||||||
gotos.clear();
|
|
||||||
beginfunction = tok;
|
beginfunction = tok;
|
||||||
}
|
|
||||||
|
|
||||||
else if (indentlevel && Token::Match(tok, "[{};] goto %var% ;"))
|
else if (indentlevel && Token::Match(tok, "[{};] goto %var% ;"))
|
||||||
gotos.push_back(tok->next());
|
gotos.push_back(tok->next());
|
||||||
|
|
Loading…
Reference in New Issue