diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 42616802d..f3f6d4c60 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -2993,7 +2993,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto temp_form = pool.alloc_single_form(nullptr, new_form); auto match_result = match(matcher, temp_form); if (match_result.matched) { - auto& type_1 = match_result.maps.strings.at(type_for_method); + auto type_1 = match_result.maps.strings.at(type_for_method); auto& name = match_result.maps.strings.at(method_name); if (name == "new" && type_1 == "object") { @@ -3042,7 +3042,7 @@ void FunctionCallElement::update_from_stack(const Env& env, alloc != "loading-level") { throw std::runtime_error("Unrecognized heap symbol for new: " + alloc); } - auto& type_2 = match_result.maps.strings.at(type_for_arg); + auto type_2 = match_result.maps.strings.at(type_for_arg); if (type_1 != type_2) { throw std::runtime_error( fmt::format("Inconsistent types in method call: {} and {}", type_1, type_2)); @@ -3096,7 +3096,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto temp_form = pool.alloc_single_form(nullptr, new_form); auto match_result = match(matcher, temp_form); if (match_result.matched) { - auto& name = match_result.maps.strings.at(method_name); + auto name = match_result.maps.strings.at(method_name); if (name != "new") { // only do these checks on non-new methods. New methods are treated as functions because // they are never virtual and are never called like a method. diff --git a/decompiler/analysis/expression_build.cpp b/decompiler/analysis/expression_build.cpp index e1ba4b3b2..72d2dea5b 100644 --- a/decompiler/analysis/expression_build.cpp +++ b/decompiler/analysis/expression_build.cpp @@ -27,7 +27,7 @@ bool convert_to_expressions( f.guessed_name.kind == FunctionName::FunctionKind::V_STATE) { f.ir2.env.set_remap_for_function(f.type); } else if (f.guessed_name.kind == FunctionName::FunctionKind::METHOD) { - auto method_type = + auto& method_type = dts.ts.lookup_method(f.guessed_name.type_name, f.guessed_name.method_id).type; if (f.guessed_name.method_id == GOAL_NEW_METHOD) { f.ir2.env.set_remap_for_new_method(method_type); diff --git a/test/decompiler/FormRegressionTest.cpp b/test/decompiler/FormRegressionTest.cpp index c57381516..2532bd99a 100644 --- a/test/decompiler/FormRegressionTest.cpp +++ b/test/decompiler/FormRegressionTest.cpp @@ -260,10 +260,10 @@ void FormRegressionTest::test(const std::string& code, auto ts = dts->parse_type_spec(type); auto test = make_function(code, ts, settings); ASSERT_TRUE(test); - auto expected_form = + auto& expected_form = pretty_print::get_pretty_printer_reader().read_from_string(expected, false).as_pair()->car; ASSERT_TRUE(test->func.ir2.top_form); - auto actual_form = + auto& actual_form = pretty_print::get_pretty_printer_reader() .read_from_string(test->func.ir2.top_form->to_form(test->func.ir2.env).print(), false) .as_pair() @@ -322,4 +322,4 @@ void FormRegressionTest::test_with_stack_structures(const std::string& code, } std::unique_ptr FormRegressionTest::parser; -std::unique_ptr FormRegressionTest::dts; \ No newline at end of file +std::unique_ptr FormRegressionTest::dts;