Tokenizer::simplifyFlowControl: separated the 'throw' case because it's not a reserved keyword in C, hence the function shouldn't simplify in C source files.

This commit is contained in:
Edoardo Prezioso 2012-08-07 19:38:51 +02:00
parent 77b8e496d6
commit d68d035e22
1 changed files with 2 additions and 1 deletions

View File

@ -3649,7 +3649,8 @@ void Tokenizer::simplifyFlowControl()
eraseDeadCode(tok, 0);
} else if (Token::Match(tok,"return|goto") ||
(Token::Match(tok,"exit|throw|abort") && !Token::Match(tok->previous(),"%type%"))) {
(Token::Match(tok,"exit|abort") && !Token::Match(tok->previous(),"%type%")) ||
(tok->str() == "throw" && !isC())) {
//catch the first ';'
for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
if (tok2->str() == "(" || tok2->str() == "[") {