[llvm] Added --report=debugger option to llvm-debuginfo-analyzer (PR #159853)

Carlos Alberto Enciso via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 29 08:38:47 PDT 2025


================
@@ -1903,6 +1921,94 @@ void LVScopeFunction::printExtra(raw_ostream &OS, bool Full) const {
   }
 }
 
+void LVScopeFunction::printDebugger(raw_ostream &OS) const {
+  const LVLines *Lines = getLines();
+  // If there's no lines, this function has no body.
+  if (!Lines)
+    return;
+
+  OS << formattedKind(kind()) << " " << getName() << "\n";
+
+  std::vector<const LVLine *> AllLines;
+  std::unordered_map<LVAddress, std::vector<const LVLocation *>> LifetimeBegins;
+  std::unordered_map<LVAddress, std::vector<const LVLocation *>>
+      LifetimeEndsExclusive;
+
+  // Collect all child scope lines and symbols
+  std::vector<const LVScope *> Worklist = {this};
+  for (unsigned i = 0; i < Worklist.size(); i++) {
+    const LVScope *Scope = Worklist[i];
+    if (Scope->scopeCount()) {
+      for (const LVScope *ChildScope : *Scope->getScopes())
+        Worklist.push_back(ChildScope);
+    }
----------------
CarlosAlbertoEnciso wrote:

```
if (Scope->scopeCount()) {
  for (const LVScope *ChildScope : *Scope->getScopes())
    Worklist.push_back(ChildScope);
}
```
Can that be replaced with something like:
```
Worklist.insert(Worklist.end(), *Scope->getScopes()->begin(), *Scope->getScopes()->end());
```


https://github.com/llvm/llvm-project/pull/159853


More information about the llvm-commits mailing list