Move declarations closer to where they're first used

This commit is contained in:
Dmitry-Me 2014-09-01 10:05:59 +04:00
parent 4c18967329
commit 9199dde560
2 changed files with 2 additions and 3 deletions

View File

@ -86,11 +86,10 @@ static bool checkRvalueExpression(const Token * const vartok)
if (var == nullptr)
return false;
const Token * const next = vartok->next();
if (Token::Match(vartok->previous(), "& %var% [") && var->isPointer())
return false;
const Token * const next = vartok->next();
// &a.b[0]
if (Token::Match(vartok, "%var% . %var% [") && !var->isPointer()) {
const Variable *var2 = next->next()->variable();

View File

@ -8286,11 +8286,11 @@ void Tokenizer::eraseDeadCode(Token *begin, const Token *end)
} else if (isgoto && Token::Match(tok, "[{};] do|while|for|BOOST_FOREACH")) {
//it's possible that code inside loop is not dead,
//because of the possible presence of the label pointed by 'goto'
std::string labelpattern = "[{};] " + begin->previous()->str() + " : ;";
Token *start = tok->tokAt(2);
if (start && start->str() == "(")
start = start->link()->next();
if (start && start->str() == "{") {
std::string labelpattern = "[{};] " + begin->previous()->str() + " : ;";
bool simplify = true;
for (Token *tok2 = start->next(); tok2 != start->link(); tok2 = tok2->next()) {
if (Token::Match(tok2, labelpattern.c_str())) {