Use factory pattern for dex_ir objects

In preparation for memory improvements, make dex_ir API more friendly to
pre-allocated or in-place type allocation.

Bug: 33017139
Test: make -j 50 test-art-host
Change-Id: I09b67e279a04535b175433287ce98ecbdc37f7a3
diff --git a/dexlayout/dex_verify.cc b/dexlayout/dex_verify.cc
index 18ddc86..2e4756b 100644
--- a/dexlayout/dex_verify.cc
+++ b/dexlayout/dex_verify.cc
@@ -769,8 +769,8 @@
     return false;
   }
   for (size_t i = 0; i < orig->size(); ++i) {
-    dex_ir::FieldItem* orig_field = (*orig)[i].get();
-    dex_ir::FieldItem* output_field = (*output)[i].get();
+    dex_ir::FieldItem* orig_field = &(*orig)[i];
+    dex_ir::FieldItem* output_field = &(*output)[i];
     if (orig_field->GetFieldId()->GetIndex() != output_field->GetFieldId()->GetIndex()) {
       *error_msg = StringPrintf("Mismatched field index for class data at offset %x: %u vs %u.",
                                 orig_offset,
@@ -802,8 +802,8 @@
     return false;
   }
   for (size_t i = 0; i < orig->size(); ++i) {
-    dex_ir::MethodItem* orig_method = (*orig)[i].get();
-    dex_ir::MethodItem* output_method = (*output)[i].get();
+    dex_ir::MethodItem* orig_method = &(*orig)[i];
+    dex_ir::MethodItem* output_method = &(*output)[i];
     if (orig_method->GetMethodId()->GetIndex() != output_method->GetMethodId()->GetIndex()) {
       *error_msg = StringPrintf("Mismatched method index for class data at offset %x: %u vs %u.",
                                 orig_offset,