| 329 | } |
| 330 | |
| 331 | void |
| 332 | StatementFor::post_loop_analysis(CGContext& cg_context, vector<const Fact*>& pre_facts, Effect& pre_effect) |
| 333 | { |
| 334 | FactMgr* fm = get_fact_mgr(&cg_context); |
| 335 | assert(fm); |
| 336 | // if the control reached the end of this for-loop with must-return body, it means |
| 337 | // the loop is never entered. restore facts to pre-loop env |
| 338 | fm->global_facts = fm->map_facts_in[&body]; |
| 339 | if (body.must_return()) { |
| 340 | fm->restore_facts(pre_facts); |
| 341 | } |
| 342 | // add forward edges introduced by "break" |
| 343 | for (size_t i=0; i<body.break_stms.size(); i++) { |
| 344 | const StatementBreak* stm = dynamic_cast<const StatementBreak*>(body.break_stms[i]); |
| 345 | fm->create_cfg_edge(stm, this, true, false); |
| 346 | FactMgr::merge_jump_facts(fm->global_facts, fm->map_facts_out[stm]); |
| 347 | } |
| 348 | // compute accumulated effect |
| 349 | set_accumulated_effect_after_block(pre_effect, &body, cg_context); |
| 350 | } |
| 351 | |
| 352 | /* |
| 353 | * |
no test coverage detected