[llvm] [DebugInfo] DWARFFormValue use formatv instead of format (PR #180498)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 03:15:12 PST 2026


================
@@ -552,19 +557,20 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
     break;
 
   case DW_FORM_rnglistx:
-    OS << format("indexed (0x%x) rangelist = ", (uint32_t)UValue);
+    OS << formatv("indexed ({0:x+}) rangelist = ", (uint32_t)UValue);
     break;
 
   case DW_FORM_loclistx:
-    OS << format("indexed (0x%x) loclist = ", (uint32_t)UValue);
+    OS << formatv("indexed ({0:x+}) loclist = ", (uint32_t)UValue);
     break;
 
   case DW_FORM_sec_offset:
-    AddrOS << format("0x%0*" PRIx64, OffsetDumpWidth, UValue);
+    AddrOS << formatv(
+        "0x{0:x-}", fmt_align(UValue, AlignStyle::Right, OffsetDumpWidth, '0'));
----------------
DavidSpickett wrote:

I think. The plus or minus is about whether to add the 0x, rather than controlling alignment. Right?

That's where I was confused. Some `0x...` became what looked to me like `{0:x<something>}` and then others without `0x` also became that.

I'll check that the plus and minus match the original 0x or not.

https://github.com/llvm/llvm-project/pull/180498


More information about the llvm-commits mailing list