| 424 | } |
| 425 | |
| 426 | void OptState::call_with_opr( |
| 427 | OperatorNodeBase* opr, thin_function<void(void)> func, |
| 428 | OprPropertyFlag opr_property_flag) { |
| 429 | auto src_opr = cg::get_opr_root_source_opr(opr); |
| 430 | auto opr_priority = opr->node_prop().attribute().priority; |
| 431 | auto stream_prop_type = m_comp_node_opt.stream_prop_type(opr->output(0)); |
| 432 | ThinHashMap<OperatorNodeBase*, OprPropertyFlag> oprs_inserted; |
| 433 | |
| 434 | auto swap_properties = |
| 435 | [&, need_src_opr = opr_property_flag & OprPropertyFlag::SOURCE_OPR, |
| 436 | need_priority = opr_property_flag & OprPropertyFlag::PRIORITY] { |
| 437 | if (need_src_opr) { |
| 438 | std::swap(m_cur_iter_src_opr, src_opr); |
| 439 | } |
| 440 | if (need_priority) { |
| 441 | std::swap(m_cur_iter_opr_priority, opr_priority); |
| 442 | } |
| 443 | std::swap(m_cur_iter_opr_stream_prop_type, stream_prop_type); |
| 444 | std::swap(m_opr_property_flag, opr_property_flag); |
| 445 | std::swap(m_oprs_inserted, oprs_inserted); |
| 446 | }; |
| 447 | MGB_TRY { |
| 448 | swap_properties(); |
| 449 | func(); |
| 450 | } |
| 451 | MGB_FINALLY({ swap_properties(); }); |
| 452 | } |
| 453 |
no test coverage detected