Tokenizer::simplifyLabelsCaseDefault:

use more efficient check for 'const' token;
remove redundant NULL checks thanks to commit e3bbcf501f.
This commit is contained in:
Edoardo Prezioso 2012-10-09 17:52:20 +02:00
parent 2cf75d5339
commit 9668508b32
1 changed files with 2 additions and 5 deletions

View File

@ -2362,7 +2362,7 @@ void Tokenizer::simplifyLabelsCaseDefault()
// Simplify labels in the executable scope.. // Simplify labels in the executable scope..
if (Token::Match(tok, ") const| {")) { if (Token::Match(tok, ") const| {")) {
tok = tok->next(); tok = tok->next();
if (tok->str() == "const") if (tok->str() != "{")
tok = tok->next(); tok = tok->next();
executablescope = true; executablescope = true;
} }
@ -2389,10 +2389,7 @@ void Tokenizer::simplifyLabelsCaseDefault()
if (Token::Match(tok,"[:{};]")) if (Token::Match(tok,"[:{};]"))
break; break;
} }
if (!tok) if (tok->str() == ":" && tok->next()->str() != ";") {
break;
else if (tok->str() == ":" &&
(!tok->next() || tok->next()->str() != ";")) {
tok->insertToken(";"); tok->insertToken(";");
} }
} else if (Token::Match(tok, "[;{}] %var% : !!;")) { } else if (Token::Match(tok, "[;{}] %var% : !!;")) {