[llvm] [llvm][DebugInfo] formatv in DWARFUnitIndex (PR #191998)
Konrad Kleine via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 00:48:29 PDT 2026
https://github.com/kwk created https://github.com/llvm/llvm-project/pull/191998
This relates to #35980.
>From 25d5ada488995aca3165f8c05bf387eafe081f01 Mon Sep 17 00:00:00 2001
From: Konrad Kleine <kkleine at redhat.com>
Date: Mon, 13 Apr 2026 20:19:44 +0000
Subject: [PATCH] [llvm][DebugInfo] formatv in DWARFUnitIndex
This relates to #35980.
---
llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
index a4487e2dc21be..d2cd84bb4fc72 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