Add 'exit' and 'abort' to the flow control list in order to simplify code after them.

This commit is contained in:
Edoardo Prezioso 2011-12-06 22:56:12 +01:00
parent eb5fe250ab
commit b9224439c1
2 changed files with 4 additions and 2 deletions

View File

@ -4609,8 +4609,8 @@ void Tokenizer::simplifyFlowControl()
tok = tok->next();
eraseDeadCode(tok, beginindent->link());
} else if (tok->str() == "return" || tok->str() == "throw") {
//catch the first ';' after the return|trow statement
} else if (Token::Match(tok,"return|throw|exit|abort")) {
//catch the first ';'
for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
if (tok2->str() == "(" || tok2->str() == "[") {
tok2 = tok2->link();

View File

@ -3075,6 +3075,8 @@ private:
std::list<std::string> beforedead;
beforedead.push_back("return");
beforedead.push_back("throw ( 10 )");
beforedead.push_back("exit ( 0 )");
beforedead.push_back("abort ( )");
beforedead.push_back("goto labels");
beforedead.push_back("break");
beforedead.push_back("continue");