Refactorization: Removed some redundant conditions and an unused syntax check from tokenize.cpp

This commit is contained in:
PKEuS 2015-08-19 19:29:32 +02:00
parent a720153e1e
commit 11be2f79a6
1 changed files with 20 additions and 39 deletions

View File

@ -2215,7 +2215,6 @@ static Token *skipTernaryOp(Token *tok)
Token * Tokenizer::startOfFunction(Token * tok) const
{
if (tok && tok->str() == ")") {
tok = tok->next();
while (tok && tok->str() != "{") {
if (isCPP() && Token::Match(tok, "const|volatile")) {
@ -2239,9 +2238,6 @@ Token * Tokenizer::startOfFunction(Token * tok) const
}
return tok;
}
return nullptr;
}
const Token * Tokenizer::startOfExecutableScope(const Token * tok)
@ -2359,12 +2355,6 @@ void Tokenizer::simplifyTemplates()
if (isC())
return;
for (const Token *tok = list.front(); tok; tok = tok->next()) {
if (tok->str()[0] == '=' && tok->str().length() > 2) {
std::cout << "BAD TOKEN" << std::endl;
}
}
for (Token *tok = list.front(); tok; tok = tok->next()) {
// #2648 - simple fix for sizeof used as template parameter
// TODO: this is a bit hardcoded. make a bit more generic
@ -3096,12 +3086,6 @@ bool Tokenizer::simplifySizeof()
if (tok->str() != "sizeof")
continue;
if (!tok->next())
break;
if (tok->strAt(1) == "sizeof")
continue;
if (Token::simpleMatch(tok->next(), ". . .")) {
tok->deleteNext(3);
}
@ -4202,10 +4186,7 @@ bool Tokenizer::removeRedundantConditions()
bool ret = false;
for (Token *tok = list.front(); tok; tok = tok->next()) {
if (tok->str() != "if")
continue;
if (!Token::Match(tok->next(), "( %bool% ) {"))
if (!Token::Match(tok, "if ( %bool% ) {"))
continue;
// Find matching else