From f53b62a40c811eacce16680ac4b02a3fa4c0b205 Mon Sep 17 00:00:00 2001 From: Ivy Tang Date: Mon, 16 Oct 2023 17:35:28 -0700 Subject: [PATCH] Use the old resolve method API in TypedefAnnoCheckerPass Summary: Use the old resolve method API in TypedefAnnoCheckerPass so I can promote the pass to staging and stable without pulling in all the dependent diffs on the new API in D49440605. Once it gets promoted to stable, the checker will switch back to the new API Reviewed By: thezhangwei Differential Revision: D50338552 fbshipit-source-id: b9801cf7dbc4e3d681d6e7c40a026d131e229c4c --- .../TypedefAnnoCheckerPass.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/opt/typedef-anno-checker/TypedefAnnoCheckerPass.cpp b/opt/typedef-anno-checker/TypedefAnnoCheckerPass.cpp index 87a48d10e8d..b84783244c8 100644 --- a/opt/typedef-anno-checker/TypedefAnnoCheckerPass.cpp +++ b/opt/typedef-anno-checker/TypedefAnnoCheckerPass.cpp @@ -89,10 +89,12 @@ void TypedefAnnoChecker::check_instruction( case OPCODE_INVOKE_DIRECT: case OPCODE_INVOKE_STATIC: case OPCODE_INVOKE_INTERFACE: { - DexMethodRef* ref_method = insn->get_method(); - bool resolved_virtual_to_interface; auto def_method = - resolve_invoke_method(insn, m, &resolved_virtual_to_interface); + resolve_method(insn->get_method(), opcode_to_search(insn), m); + if (def_method == nullptr && opcode == OPCODE_INVOKE_VIRTUAL) { + def_method = + resolve_method(insn->get_method(), MethodSearch::InterfaceVirtual); + } if (!def_method) { return; } @@ -340,9 +342,12 @@ bool TypedefAnnoChecker::check_typedef_value( case OPCODE_INVOKE_DIRECT: case OPCODE_INVOKE_STATIC: case OPCODE_INVOKE_INTERFACE: { - bool resolved_virtual_to_interface; auto def_method = - resolve_invoke_method(def, m, &resolved_virtual_to_interface); + resolve_method(def->get_method(), opcode_to_search(def), m); + if (def_method == nullptr && def->opcode() == OPCODE_INVOKE_VIRTUAL) { + def_method = + resolve_method(def->get_method(), MethodSearch::InterfaceVirtual); + } if (!def_method) { std::ostringstream out; out << "TypedefAnnoCheckerPass: in the method " << SHOW(m)