本文整理汇总了C++中PassManager::no_proguard_rules方法的典型用法代码示例。如果您正苦于以下问题:C++ PassManager::no_proguard_rules方法的具体用法?C++ PassManager::no_proguard_rules怎么用?C++ PassManager::no_proguard_rules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PassManager
的用法示例。
在下文中一共展示了PassManager::no_proguard_rules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_pass
void BridgePass::run_pass(DexStoresVector& stores,
ConfigFiles& /* conf */,
PassManager& mgr) {
if (mgr.no_proguard_rules()) {
TRACE(BRIDGE, 1, "BridgePass not run because no ProGuard configuration was provided.");
return;
}
Scope scope = build_class_scope(stores);
BridgeRemover(scope, mgr, m_black_list).run();
}
示例2: run_pass
void RemoveUnreachablePass::run_pass(DexStoresVector& stores,
ConfigFiles& conf,
PassManager& pm) {
// Store names of removed classes and methods
ConcurrentSet<std::string> removed_symbols;
if (pm.no_proguard_rules()) {
TRACE(RMU,
1,
"RemoveUnreachablePass not run because no "
"ProGuard configuration was provided.");
return;
}
bool output_unreachable_symbols = pm.get_current_pass_info()->repeat == 0 &&
!m_unreachable_symbols_file_name.empty();
int num_ignore_check_strings = 0;
auto reachables = reachability::compute_reachable_objects(
stores, m_ignore_sets, &num_ignore_check_strings);
reachability::ObjectCounts before = reachability::count_objects(stores);
TRACE(RMU, 1, "before: %lu classes, %lu fields, %lu methods\n",
before.num_classes, before.num_fields, before.num_methods);
reachability::sweep(stores, *reachables,
output_unreachable_symbols ? &removed_symbols : nullptr);
reachability::ObjectCounts after = reachability::count_objects(stores);
TRACE(RMU, 1, "after: %lu classes, %lu fields, %lu methods\n",
after.num_classes, after.num_fields, after.num_methods);
pm.incr_metric("num_ignore_check_strings", num_ignore_check_strings);
pm.incr_metric("classes_removed", before.num_classes - after.num_classes);
pm.incr_metric("fields_removed", before.num_fields - after.num_fields);
pm.incr_metric("methods_removed", before.num_methods - after.num_methods);
if (output_unreachable_symbols) {
std::string filepath = conf.metafile(m_unreachable_symbols_file_name);
write_out_removed_symbols(filepath, removed_symbols);
}
}
示例3: run_pass
void RemoveBuildersPass::run_pass(DexStoresVector& stores,
ConfigFiles&,
PassManager& mgr) {
if (mgr.no_proguard_rules()) {
TRACE(BUILDERS,
1,
"RemoveBuildersPass did not run because no Proguard configuration "
"was provided.");
return;
}
// Initialize couters.
b_counter = {0, 0, 0, 0};
auto obj_type = get_object_type();
auto scope = build_class_scope(stores);
for (DexClass* cls : scope) {
if (is_annotation(cls) || is_interface(cls) ||
cls->get_super_class() != obj_type) {
continue;
}
if (has_builder_name(cls->get_type())) {
m_builders.emplace(cls->get_type());
}
}
std::unordered_set<DexType*> escaped_builders;
walk::methods(scope, [&](DexMethod* m) {
auto builders = created_builders(m);
for (DexType* builder : builders) {
if (escapes_stack(builder, m)) {
TRACE(BUILDERS,
3,
"%s escapes in %s\n",
SHOW(builder),
m->get_deobfuscated_name().c_str());
escaped_builders.emplace(builder);
}
}
});
std::unordered_set<DexType*> stack_only_builders;
for (DexType* builder : m_builders) {
if (escaped_builders.find(builder) == escaped_builders.end()) {
stack_only_builders.emplace(builder);
}
}
std::unordered_set<DexType*> builders_and_supers;
for (DexType* builder : stack_only_builders) {
DexType* cls = builder;
while (cls != nullptr && cls != obj_type) {
builders_and_supers.emplace(cls);
cls = type_class(cls)->get_super_class();
}
}
std::unordered_set<DexType*> this_escapes;
for (DexType* cls_ty : builders_and_supers) {
DexClass* cls = type_class(cls_ty);
if (cls->is_external() ||
this_arg_escapes(cls, m_enable_buildee_constr_change)) {
this_escapes.emplace(cls_ty);
}
}
// set of builders that neither escape the stack nor pass their 'this' arg
// to another function
std::unordered_set<DexType*> no_escapes;
for (DexType* builder : stack_only_builders) {
DexType* cls = builder;
bool hierarchy_has_escape = false;
while (cls != nullptr) {
if (this_escapes.find(cls) != this_escapes.end()) {
hierarchy_has_escape = true;
break;
}
cls = type_class(cls)->get_super_class();
}
if (!hierarchy_has_escape) {
no_escapes.emplace(builder);
}
}
size_t dmethod_count = 0;
size_t vmethod_count = 0;
size_t build_count = 0;
for (DexType* builder : no_escapes) {
auto cls = type_class(builder);
auto buildee = get_buildee(builder);
dmethod_count += cls->get_dmethods().size();
vmethod_count += cls->get_vmethods().size();
for (DexMethod* m : cls->get_vmethods()) {
if (m->get_proto()->get_rtype() == buildee) {
build_count++;
}
}
}
//.........这里部分代码省略.........