[llvm] 4c543ac - [llvm][DebugInfo] formatv in DWARFDebugRangeList (#191989)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 02:44:04 PDT 2026


Author: Konrad Kleine
Date: 2026-04-14T11:43:58+02:00
New Revision: 4c543ac848e0db170eaa223a734c1fed26468e24

URL: https://github.com/llvm/llvm-project/commit/4c543ac848e0db170eaa223a734c1fed26468e24
DIFF: https://github.com/llvm/llvm-project/commit/4c543ac848e0db170eaa223a734c1fed26468e24.diff

LOG: [llvm][DebugInfo] formatv in DWARFDebugRangeList (#191989)

This relates to #35980.

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
index db01719bed599..7c6a4fcf5b1f6 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
@@ -10,6 +10,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cinttypes>
 #include <cstdint>
@@ -68,20 +69,20 @@ void DWARFDebugRangeList::dump(raw_ostream &OS) const {
   const char *AddrFmt;
   switch (AddressSize) {
   case 2:
-    AddrFmt = "%08" PRIx64 " %04" PRIx64 " %04" PRIx64 "\n";
+    AddrFmt = "{0:x-8} {1:x-4} {2:x-4}\n";
     break;
   case 4:
-    AddrFmt = "%08" PRIx64 " %08" PRIx64 " %08" PRIx64 "\n";
+    AddrFmt = "{0:x-8} {1:x-8} {2:x-8}\n";
     break;
   case 8:
-    AddrFmt = "%08" PRIx64 " %016" PRIx64 " %016" PRIx64 "\n";
+    AddrFmt = "{0:x-8} {1:x-16} {2:x-16}\n";
     break;
   default:
     llvm_unreachable("unsupported address size");
   }
   for (const RangeListEntry &RLE : Entries)
-    OS << format(AddrFmt, Offset, RLE.StartAddress, RLE.EndAddress);
-  OS << format("%08" PRIx64 " <End of list>\n", Offset);
+    OS << formatv(AddrFmt, Offset, RLE.StartAddress, RLE.EndAddress);
+  OS << formatv("{0:x-8} <End of list>\n", Offset);
 }
 
 DWARFAddressRangesVector DWARFDebugRangeList::getAbsoluteRanges(


        


More information about the llvm-commits mailing list