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());
|
eraseDeadCode(tok, beginindent->link());
|
||||||
|
|
||||||
} else if (tok->str() == "return") {
|
} else if (tok->str() == "return" || tok->str() == "throw") {
|
||||||
//catch the first ';' after the return
|
//catch the first ';' after the return|trow statement
|
||||||
for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
||||||
if (tok2->str() == "(" || tok2->str() == "[") {
|
if (tok2->str() == "(" || tok2->str() == "[") {
|
||||||
tok2 = tok2->link();
|
tok2 = tok2->link();
|
||||||
|
|
|
@ -372,7 +372,7 @@ public:
|
||||||
void simplifyGoto();
|
void simplifyGoto();
|
||||||
|
|
||||||
/** Simplify redundant code placed after control flow statements :
|
/** Simplify redundant code placed after control flow statements :
|
||||||
* 'return', 'goto', 'break' and 'continue'
|
* 'return', 'throw', 'goto', 'break' and 'continue'
|
||||||
*/
|
*/
|
||||||
void simplifyFlowControl();
|
void simplifyFlowControl();
|
||||||
|
|
||||||
|
|
|
@ -3085,8 +3085,7 @@ private:
|
||||||
void flowControl() {
|
void flowControl() {
|
||||||
std::list<std::string> beforedead;
|
std::list<std::string> beforedead;
|
||||||
beforedead.push_back("return");
|
beforedead.push_back("return");
|
||||||
beforedead.push_back("return 0");
|
beforedead.push_back("throw ( 10 )");
|
||||||
beforedead.push_back("return -1");
|
|
||||||
beforedead.push_back("goto labels");
|
beforedead.push_back("goto labels");
|
||||||
beforedead.push_back("break");
|
beforedead.push_back("break");
|
||||||
beforedead.push_back("continue");
|
beforedead.push_back("continue");
|
||||||
|
|
Loading…
Reference in New Issue