libredex/CFGInliner.cpp
/*
 * Move ownership of blocks and edges from callee to caller
 */
Move ownership of blocks and edges from callee to caller
Move ownership of blocks and edges from callee to caller
void CFGInliner::steal_contents(ControlFlowGraph* caller,
                                Block* callsite,
                                ControlFlowGraph* callee) {
  always_assert(!caller->m_blocks.empty());
  for (auto& entry : callee->m_blocks) {
    Block* b = entry.second;
    b->m_parent = caller;
    size_t id = caller->m_blocks.rbegin()->first + 1;
    b->m_id = id;
    caller->m_blocks.emplace(id, b);
  }
  callee->m_blocks.clear();
  caller->m_edges.reserve(caller->m_edges.size() + callee->m_edges.size());
  caller->m_edges.insert(callee->m_edges.begin(), callee->m_edges.end());
  callee->m_edges.clear();
}
void CFGInliner :: steal_contents ( ControlFlowGraph * caller , Block * callsite , ControlFlowGraph * callee ) { always_assert ( ! caller -> m_blocks . empty ( ) ) ; for ( auto & entry : callee -> m_blocks ) { Block * b = entry . second ; b -> m_parent = caller ; size_t id = caller -> m_blocks . rbegin ( ) -> first + 1 ; b -> m_id = id ; caller -> m_blocks . emplace ( id , b ) ; } callee -> m_blocks . clear ( ) ; caller -> m_edges . reserve ( caller -> m_edges . size ( ) + callee -> m_edges . size ( ) ) ; caller -> m_edges . insert ( callee -> m_edges . begin ( ) , callee -> m_edges . end ( ) ) ; callee -> m_edges . clear ( ) ; }
Move ownership of blocks and edges from callee to caller
Move ownership of blocks and edges from callee to caller
// transfer ownership of the edges