dead code: fix for if-else statements

This commit is contained in:
2024-04-06 17:52:18 +03:00
parent e5b4d6cc50
commit 5f3da5d708

View File

@@ -534,11 +534,12 @@ void removeDeadCode(SgStatement* func,
} }
else if (var == IF_NODE) else if (var == IF_NODE)
{ {
SgStatement* ifS = st->lexNext(); SgStatement* ifS = st;
while (ifS->variant() == ELSEIF_NODE) while (ifS->lexNext()->variant() == ELSEIF_NODE)
ifS = ifS->lexNext(); ifS = ifS->lexNext();
SgStatement* lastNode = st->lastNodeOfStmt(); SgStatement* lastNode = ifS->lastNodeOfStmt();
ifS = ifS->lexNext();
while (ifS->variant() == CONTROL_END && ifS != lastNode) while (ifS->variant() == CONTROL_END && ifS != lastNode)
ifS = ifS->lexNext(); ifS = ifS->lexNext();