* return true if there is no way out of this block other than function return */
| 357 | * return true if there is no way out of this block other than function return |
| 358 | */ |
| 359 | bool |
| 360 | Block::must_return(void) const |
| 361 | { |
| 362 | if (stms.size() > 0 && break_stms.size() == 0 && get_last_stm()->must_return()) { |
| 363 | vector<const CFGEdge*> edges; |
| 364 | if (find_edges_in(edges, false, true)) { |
| 365 | // if there is a statement goes back to block (most likely "continue") |
| 366 | // then this block has a chance to escape the return statement at the end |
| 367 | for (size_t i=0; i<edges.size(); i++) { |
| 368 | if (edges[i]->src != this) { |
| 369 | return false; |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | return true; |
| 374 | } |
| 375 | return false; |
| 376 | } |
| 377 | |
| 378 | /* |
| 379 | * return true if there is no way out of this block other than jump |
no test coverage detected