当前位置: 首页>>代码示例>>C++>>正文


C++ TypeSystem::get_implementors方法代码示例

本文整理汇总了C++中TypeSystem::get_implementors方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeSystem::get_implementors方法的具体用法?C++ TypeSystem::get_implementors怎么用?C++ TypeSystem::get_implementors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypeSystem的用法示例。


在下文中一共展示了TypeSystem::get_implementors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: remove_inheritance

void RemoveInterfacePass::remove_inheritance(const Scope& scope,
                                             const TypeSystem& type_system,
                                             const TypeSet& interfaces) {
  for (const auto intf : interfaces) {
    always_assert(is_leaf(type_system, intf));
    auto impls = type_system.get_implementors(intf);
    for (const auto impl : impls) {
      TRACE(RM_INTF, 5, "Remove inheritance for %s on %s\n", SHOW(intf),
            SHOW(impl));
      auto new_impl_list = get_new_impl_list(impl, intf);
      type_class(impl)->set_interfaces(new_impl_list);
    }
    type_class(intf)->set_interfaces(DexTypeList::make_type_list({}));
  }
}
开发者ID:JoelMarcey,项目名称:redex,代码行数:15,代码来源:RemoveInterfacePass.cpp

示例2: remove_leaf_interfaces

TypeSet RemoveInterfacePass::remove_leaf_interfaces(
    const Scope& scope,
    const DexType* root,
    const TypeSet& interfaces,
    const TypeSystem& type_system) {
  TypeSet leaf_interfaces;
  for (const auto intf : interfaces) {
    if (is_leaf(type_system, intf)) {
      leaf_interfaces.insert(intf);
    }
  }

  std::unordered_map<DexMethod*, DexMethod*> intf_meth_to_dispatch;
  for (const auto intf : leaf_interfaces) {
    TRACE(RM_INTF, 5, "Found leaf interface %s\n", SHOW(intf));
    auto implementors = type_system.get_implementors(intf);
    auto intf_methods = type_class(intf)->get_vmethods();
    for (const auto meth : intf_methods) {
      TRACE(RM_INTF, 5, "Finding virt scope for %s\n", SHOW(meth));
      auto intf_scope = type_system.find_interface_scope(meth);
      MethodOrderedSet found_targets =
          find_dispatch_targets(type_system, intf_scope, implementors);
      std::vector<DexMethod*> dispatch_targets(found_targets.begin(),
                                               found_targets.end());
      auto replacement_type = get_replacement_type(type_system, intf, root);
      auto dispatch =
          generate_dispatch(replacement_type, dispatch_targets, meth,
                            m_keep_debug_info, m_interface_dispatch_anno);
      m_dispatch_stats[dispatch_targets.size()]++;
      intf_meth_to_dispatch[meth] = dispatch;
    }
  }
  update_interface_calls(scope, intf_meth_to_dispatch);
  remove_inheritance(scope, type_system, leaf_interfaces);
  m_num_interface_removed += leaf_interfaces.size();
  return leaf_interfaces;
}
开发者ID:JoelMarcey,项目名称:redex,代码行数:37,代码来源:RemoveInterfacePass.cpp


注:本文中的TypeSystem::get_implementors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。