summaryrefslogtreecommitdiff
path: root/openjdkjvmti/ti_method.cc
diff options
context:
space:
mode:
Diffstat (limited to 'openjdkjvmti/ti_method.cc')
-rw-r--r--openjdkjvmti/ti_method.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index a460b39556..a1f25c466b 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -249,6 +249,7 @@ jvmtiError MethodUtil::GetLocalVariableTable(jvmtiEnv* env,
return OK;
};
+ // To avoid defining visitor in the same line as the `if`. We define the lambda and use std::move.
auto visitor = [&](const art::DexFile::LocalInfo& entry) {
if (err != OK) {
return;
@@ -275,9 +276,8 @@ jvmtiError MethodUtil::GetLocalVariableTable(jvmtiEnv* env,
});
};
- if (!accessor.DecodeDebugLocalInfo(art_method->IsStatic(),
- art_method->GetDexMethodIndex(),
- visitor)) {
+ if (!accessor.DecodeDebugLocalInfo(
+ art_method->IsStatic(), art_method->GetDexMethodIndex(), std::move(visitor))) {
// Something went wrong with decoding the debug information. It might as well not be there.
return ERR(ABSENT_INFORMATION);
}
@@ -754,6 +754,7 @@ jvmtiError CommonLocalVariableClosure::GetSlotType(art::ArtMethod* method,
bool found = false;
*type = art::Primitive::kPrimVoid;
descriptor->clear();
+ // To avoid defining visitor in the same line as the `if`. We define the lambda and use std::move.
auto visitor = [&](const art::DexFile::LocalInfo& entry) {
if (!found && entry.start_address_ <= dex_pc && entry.end_address_ > dex_pc &&
entry.reg_ == slot_) {
@@ -762,7 +763,8 @@ jvmtiError CommonLocalVariableClosure::GetSlotType(art::ArtMethod* method,
*descriptor = entry.descriptor_;
}
};
- if (!accessor.DecodeDebugLocalInfo(method->IsStatic(), method->GetDexMethodIndex(), visitor) ||
+ if (!accessor.DecodeDebugLocalInfo(
+ method->IsStatic(), method->GetDexMethodIndex(), std::move(visitor)) ||
!found) {
// Something went wrong with decoding the debug information. It might as well not be there.
// Try to find the type with the verifier.