Skip to content

Commit f10922f

Browse files
committed
[lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: rename Current to current_vars to follow lldb codding style and to be consistent with m_live_vars
Signed-off-by: Nikita B <[email protected]>
1 parent f03a448 commit f10922f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lldb/source/Core/Disassembler.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ VariableAnnotator::AnnotateStructured(Instruction &inst, Target &target,
381381
// Prefer "register-only" output when we have an ABI.
382382
opts.PrintRegisterOnly = static_cast<bool>(abi_sp);
383383

384-
llvm::DenseMap<lldb::user_id_t, VariableAnnotation> Current;
384+
llvm::DenseMap<lldb::user_id_t, VariableAnnotation> current_vars;
385385

386386
for (size_t i = 0, e = var_list.GetSize(); i != e; ++i) {
387387
lldb::VariableSP v = var_list.GetVariableAtIndex(i);
@@ -423,17 +423,17 @@ VariableAnnotator::AnnotateStructured(Instruction &inst, Target &target,
423423
if (const char *type_str = type->GetName().AsCString())
424424
type_name = type_str;
425425

426-
Current.try_emplace(v->GetID(),
426+
current_vars.try_emplace(v->GetID(),
427427
VariableAnnotation{std::string(name), std::string(loc),
428428
true, entry.expr->GetRegisterKind(),
429429
entry.file_range, decl_file,
430430
decl_line, type_name});
431431
}
432432

433-
// Diff m_live_vars → Current.
433+
// Diff m_live_vars → current_vars.
434434

435-
// 1) Starts/changes: iterate Current and compare with m_live_vars.
436-
for (const auto &KV : Current) {
435+
// 1) Starts/changes: iterate current_vars and compare with m_live_vars.
436+
for (const auto &KV : current_vars) {
437437
auto it = m_live_vars.find(KV.first);
438438
if (it == m_live_vars.end()) {
439439
// Newly live.
@@ -449,18 +449,18 @@ VariableAnnotator::AnnotateStructured(Instruction &inst, Target &target,
449449
}
450450
}
451451

452-
// 2) Ends: anything that was live but is not in Current becomes
452+
// 2) Ends: anything that was live but is not in current_vars becomes
453453
// <kUndefLocation>.
454454
for (const auto &KV : m_live_vars)
455-
if (!Current.count(KV.first)) {
455+
if (!current_vars.count(KV.first)) {
456456
auto annotation_entity = KV.second;
457457
annotation_entity.is_live = false;
458458
annotation_entity.location_description = kUndefLocation;
459459
annotations.push_back(annotation_entity);
460460
}
461461

462462
// Commit new state.
463-
m_live_vars = std::move(Current);
463+
m_live_vars = std::move(current_vars);
464464
return annotations;
465465
}
466466

0 commit comments

Comments
 (0)