Add Method/Field iterator to ClassAccessor
Enables ranged based for loops on fields and methods.
For visiting both fields and methods, VisitFieldsAndMethods will
be faster because of not needing to decode the fields twice for
seeking purposes.
Added test.
Bug: 79758018
Bug: 77709234
Test: test-art-host-gtest
Change-Id: I593e23ccd138b87a27d8bab6927ff2b685c057f3
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index 103862b..c0892ff 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -155,8 +155,7 @@
bool has_failures = true;
bool found_method = false;
- accessor.VisitMethods([&](const ClassAccessor::Method& method)
- REQUIRES_SHARED(Locks::mutator_lock_) {
+ for (const ClassAccessor::Method& method : accessor.GetMethods()) {
ArtMethod* resolved_method =
class_linker_->ResolveMethod<ClassLinker::ResolveMode::kNoChecks>(
method.GetIndex(),
@@ -186,7 +185,7 @@
has_failures = verifier.HasFailures();
found_method = true;
}
- });
+ }
CHECK(found_method) << "Expected to find method " << method_name;
return !has_failures;
}