本文整理汇总了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({}));
}
}
示例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;
}