[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 4 09:06:12 PST 2025
================
@@ -387,24 +439,24 @@ std::vector<std::string> VariableAnnotator::Annotate(Instruction &inst) {
auto it = m_live_vars.find(KV.first);
if (it == m_live_vars.end()) {
// Newly live.
- events.emplace_back(
- llvm::formatv("{0} = {1}", KV.second.name, KV.second.last_loc).str());
- } else if (it->second.last_loc != KV.second.last_loc) {
+ AddVariableAnnotationToVector(annotations, KV.second, true);
+ } else if (it->second.location_description !=
+ KV.second.location_description) {
// Location changed.
- events.emplace_back(
- llvm::formatv("{0} = {1}", KV.second.name, KV.second.last_loc).str());
+ AddVariableAnnotationToVector(annotations, KV.second, true);
}
}
- // 2) Ends: anything that was live but is not in current_vars becomes <undef>.
- for (const auto &KV : m_live_vars) {
- if (!current_vars.count(KV.first))
- events.emplace_back(llvm::formatv("{0} = <undef>", KV.second.name).str());
- }
+ // 2) Ends: anything that was live but is not in current_vars becomes
+ // UndefLocation.
+ for (const auto &KV : m_live_vars)
+ if (!current_vars.count(KV.first)) {
+ AddVariableAnnotationToVector(annotations, KV.second, false);
+ }
----------------
n2h9 wrote:
Fair enough, I should have been noticed this, sorry about that :blush:
thank you for spotting this on and for the quick review :bowing_woman:
https://github.com/llvm/llvm-project/pull/169408
More information about the lldb-commits
mailing list