[llvm] [llvm][DebugInfo] formatv in LVReader (PR #192007)

Konrad Kleine via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 00:56:25 PDT 2026


https://github.com/kwk updated https://github.com/llvm/llvm-project/pull/192007

>From ba8e21d87218c9283fc29ac29ccc5911c93313e2 Mon Sep 17 00:00:00 2001
From: Konrad Kleine <kkleine at redhat.com>
Date: Mon, 13 Apr 2026 20:21:16 +0000
Subject: [PATCH 1/2] [llvm][DebugInfo] formatv in LVReader

This relates to #35980.
---
 llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp
index d973a47f68732..8273149f6fe63 100644
--- a/llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp
@@ -70,22 +70,19 @@ bool checkIntegrityScopesTree(LVScope *Root) {
     });
 
     auto PrintIndex = [](unsigned Index) {
-      if (Index)
-        dbgs() << format("%8d: ", Index);
-      else
-        dbgs() << format("%8c: ", ' ');
+      dbgs() << formatv("{0,8}: ", Index ? Index : ' ');
     };
     auto PrintElement = [&](LVElement *Element, unsigned Index = 0) {
       PrintIndex(Index);
       std::string ElementName(Element->getName());
-      dbgs() << format("%15s ID=0x%08x '%s'\n", Element->kind(),
-                       Element->getID(), ElementName.c_str());
+      dbgs() << formatv("{0,15} ID={1:x8} '{2}'\n", Element->kind(),
+                        Element->getID(), ElementName);
     };
 
     std::string RootName(Root->getName());
     dbgs() << formatv("{0}\n", fmt_repeat('=', 72));
-    dbgs() << format("Root: '%s'\nDuplicated elements: %d\n", RootName.c_str(),
-                     Duplicate.size());
+    dbgs() << formatv("Root: '{0}'\nDuplicated elements: {1}\n",
+                      RootName, Duplicate.size());
     dbgs() << formatv("{0}\n", fmt_repeat('=', 72));
 
     unsigned Index = 0;

>From 3da74bcf2fa374b6587712d0d7795fad22bc2f19 Mon Sep 17 00:00:00 2001
From: Konrad Kleine <kkleine at redhat.com>
Date: Tue, 14 Apr 2026 07:56:07 +0000
Subject: [PATCH 2/2] Fix format

---
 llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp
index 8273149f6fe63..3e38b28149eb9 100644
--- a/llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Core/LVReader.cpp
@@ -81,8 +81,8 @@ bool checkIntegrityScopesTree(LVScope *Root) {
 
     std::string RootName(Root->getName());
     dbgs() << formatv("{0}\n", fmt_repeat('=', 72));
-    dbgs() << formatv("Root: '{0}'\nDuplicated elements: {1}\n",
-                      RootName, Duplicate.size());
+    dbgs() << formatv("Root: '{0}'\nDuplicated elements: {1}\n", RootName,
+                      Duplicate.size());
     dbgs() << formatv("{0}\n", fmt_repeat('=', 72));
 
     unsigned Index = 0;



More information about the llvm-commits mailing list