[llvm] [llvm][DebugInfo] formatv in DWARFDebugPubTable (PR #191988)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 01:48:51 PDT 2026
================
@@ -93,24 +95,30 @@ void DWARFDebugPubTable::extract(
void DWARFDebugPubTable::dump(raw_ostream &OS) const {
for (const Set &S : Sets) {
int OffsetDumpWidth = 2 * dwarf::getDwarfOffsetByteSize(S.Format);
- OS << "length = " << format("0x%0*" PRIx64, OffsetDumpWidth, S.Length);
+ OS << "length = "
+ << formatv("0x{0:x-}",
+ fmt_align(S.Length, AlignStyle::Right, OffsetDumpWidth, '0'));
----------------
s-barannikov wrote:
This pattern is used frequently, maybe it makes sense to extract this into a helper function / add a custom adapter (local to DebugInfo/DWARF?)? This would avoid confusion with `0x{0:x-}`.
Maybe it could support omitting `0x` to adopt wider use.
https://github.com/llvm/llvm-project/pull/191988
More information about the llvm-commits
mailing list