Add 'throw' to the flow control statements list for simplification of dead code.
This commit is contained in:
parent
42a557432d
commit
00bae586e9
|
@ -4504,8 +4504,8 @@ void Tokenizer::simplifyFlowControl()
|
|||
}
|
||||
eraseDeadCode(tok, beginindent->link());
|
||||
|
||||
} else if (tok->str() == "return") {
|
||||
//catch the first ';' after the return
|
||||
} else if (tok->str() == "return" || tok->str() == "throw") {
|
||||
//catch the first ';' after the return|trow statement
|
||||
for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
||||
if (tok2->str() == "(" || tok2->str() == "[") {
|
||||
tok2 = tok2->link();
|
||||
|
|
|
@ -372,7 +372,7 @@ public:
|
|||
void simplifyGoto();
|
||||
|
||||
/** Simplify redundant code placed after control flow statements :
|
||||
* 'return', 'goto', 'break' and 'continue'
|
||||
* 'return', 'throw', 'goto', 'break' and 'continue'
|
||||
*/
|
||||
void simplifyFlowControl();
|
||||
|
||||
|
|
|
@ -3085,8 +3085,7 @@ private:
|
|||
void flowControl() {
|
||||
std::list<std::string> beforedead;
|
||||
beforedead.push_back("return");
|
||||
beforedead.push_back("return 0");
|
||||
beforedead.push_back("return -1");
|
||||
beforedead.push_back("throw ( 10 )");
|
||||
beforedead.push_back("goto labels");
|
||||
beforedead.push_back("break");
|
||||
beforedead.push_back("continue");
|
||||
|
|
Loading…
Reference in New Issue