[llvm] [llvm][DebugInfo] Use formatv() instead of format() (PR #191308)
Konrad Kleine via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 08:28:16 PDT 2026
================
@@ -69,32 +69,32 @@ static void printOperand(raw_ostream &OS, const DIDumpOptions &DumpOpts,
break;
case CFIProgram::OT_FactoredCodeOffset: // Always Unsigned
if (P.codeAlign())
- OS << format(" %" PRId64, Operand * P.codeAlign());
+ OS << formatv(" {0}", Operand * P.codeAlign());
else
- OS << format(" %" PRId64 "*code_alignment_factor", Operand);
+ OS << formatv(" {0}*code_alignment_factor", Operand);
if (Address && P.codeAlign()) {
*Address += Operand * P.codeAlign();
- OS << format(" to 0x%" PRIx64, *Address);
+ OS << formatv(" to {0:x+}", *Address);
}
break;
case CFIProgram::OT_SignedFactDataOffset:
if (P.dataAlign())
- OS << format(" %" PRId64, int64_t(Operand) * P.dataAlign());
+ OS << formatv(" {0}", int64_t(Operand) * P.dataAlign());
else
- OS << format(" %" PRId64 "*data_alignment_factor", int64_t(Operand));
+ OS << formatv(" {0}*data_alignment_factor", int64_t(Operand));
break;
case CFIProgram::OT_UnsignedFactDataOffset:
if (P.dataAlign())
- OS << format(" %" PRId64, Operand * P.dataAlign());
+ OS << formatv(" {0:d}", int64_t(Operand * P.dataAlign()));
----------------
kwk wrote:
I had to put in the cast in order for tests not to fail. The previous `PRId64` expands to `d` or `ld` depending on the wordsize. And In order to mimic this I had to use the cast. If not, we see these tests fail
```
LLVM :: DebugInfo/dwarfdump-debug-frame-simple.test
LLVM :: MC/ELF/cfi-offset.s
LLVM :: MC/X86/dwarf-segment-register.s
LLVM :: tools/llvm-objdump/COFF/eh_frame.test
LLVM :: tools/llvm-objdump/MachO/eh_frame-arm64.test
LLVM :: tools/llvm-objdump/eh_frame-mipsel.test
LLVM :: tools/llvm-readobj/ELF/unwind.test
```
For the `unwind.test` we have this difference:
```
DW_CFA_offset: reg16 18446744073709551608
```
vs. the expected
```
DW_CFA_offset: reg16 -8
```
https://github.com/llvm/llvm-project/pull/191308
More information about the llvm-commits
mailing list