[llvm] 008c3af - [llvm][DebugInfo] Use formatv in DWARFUnitIndex (#191998)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 00:41:14 PDT 2026


Author: Konrad Kleine
Date: 2026-04-16T09:41:09+02:00
New Revision: 008c3afaad14b5cb1121f56d35e6eed5f48afae8

URL: https://github.com/llvm/llvm-project/commit/008c3afaad14b5cb1121f56d35e6eed5f48afae8
DIFF: https://github.com/llvm/llvm-project/commit/008c3afaad14b5cb1121f56d35e6eed5f48afae8.diff

LOG: [llvm][DebugInfo] Use formatv in DWARFUnitIndex (#191998)

This relates to #35980.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
index a4487e2dc21be..08abcf13d0618 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
@@ -12,6 +12,7 @@
 #include "llvm/Support/DataExtractor.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cinttypes>
 #include <cstdint>
@@ -113,7 +114,8 @@ bool DWARFUnitIndex::Header::parse(DataExtractor IndexData,
 }
 
 void DWARFUnitIndex::Header::dump(raw_ostream &OS) const {
-  OS << format("version = %u, units = %u, slots = %u\n\n", Version, NumUnits, NumBuckets);
+  OS << formatv("version = {0}, units = {1}, slots = {2}\n\n", Version,
+                NumUnits, NumBuckets);
 }
 
 bool DWARFUnitIndex::parse(DataExtractor IndexData) {
@@ -226,7 +228,7 @@ void DWARFUnitIndex::dump(raw_ostream &OS) const {
          << left_justify(Name,
                          Kind == DWARFSectionKind::DW_SECT_INFO ? 40 : 24);
     else
-      OS << format(" Unknown: %-15" PRIu32, RawSectionIds[i]);
+      OS << formatv(" Unknown: {0,-15}", RawSectionIds[i]);
   }
   OS << "\n----- ------------------";
   for (unsigned i = 0; i != Header.NumColumns; ++i) {
@@ -241,19 +243,17 @@ void DWARFUnitIndex::dump(raw_ostream &OS) const {
   for (unsigned i = 0; i != Header.NumBuckets; ++i) {
     auto &Row = Rows[i];
     if (auto *Contribs = Row.Contributions.get()) {
-      OS << format("%5u 0x%016" PRIx64 " ", i + 1, Row.Signature);
+      OS << formatv("{0,5} {1:x16} ", i + 1, Row.Signature);
       for (unsigned i = 0; i != Header.NumColumns; ++i) {
         auto &Contrib = Contribs[i];
         DWARFSectionKind Kind = ColumnKinds[i];
         if (Kind == DWARFSectionKind::DW_SECT_INFO ||
             Kind == DWARFSectionKind::DW_SECT_EXT_TYPES)
-          OS << format("[0x%016" PRIx64 ", 0x%016" PRIx64 ") ",
-                       Contrib.getOffset(),
-                       Contrib.getOffset() + Contrib.getLength());
+          OS << formatv("[{0:x16}, {1:x16}) ", Contrib.getOffset(),
+                        Contrib.getOffset() + Contrib.getLength());
         else
-          OS << format("[0x%08" PRIx32 ", 0x%08" PRIx32 ") ",
-                       Contrib.getOffset32(),
-                       Contrib.getOffset32() + Contrib.getLength32());
+          OS << formatv("[{0:x8}, {1:x8}) ", Contrib.getOffset32(),
+                        Contrib.getOffset32() + Contrib.getLength32());
       }
       OS << '\n';
     }


        


More information about the llvm-commits mailing list