[llvm] [Support] Fixup for formatting hex on 32 bit (PR #181338)

Konrad Kleine via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 01:40:41 PST 2026


https://github.com/kwk updated https://github.com/llvm/llvm-project/pull/181338

>From c483ab93b973083d162cae514d0b35c219b07490 Mon Sep 17 00:00:00 2001
From: Konrad Kleine <kkleine at redhat.com>
Date: Fri, 13 Feb 2026 09:33:36 +0000
Subject: [PATCH] [Support] Fixup for formatting hex on 32 bit

Without the `PRIx64`, the test won't work on 32 bit architectures.

See this comment: https://github.com/llvm/llvm-project/pull/180498#issuecomment-3891979182

This is a fixup for #180498.
---
 llvm/unittests/Support/FormatVariadicTest.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/unittests/Support/FormatVariadicTest.cpp b/llvm/unittests/Support/FormatVariadicTest.cpp
index 8265c2783566d..a3e9841536fdc 100644
--- a/llvm/unittests/Support/FormatVariadicTest.cpp
+++ b/llvm/unittests/Support/FormatVariadicTest.cpp
@@ -404,8 +404,9 @@ TEST(FormatAndFormatvTest, EquivalentHexFormatting) {
 
   // Here's the old format() way of printing a hex number with
   // dynamic width and precision, both being the same.
-  EXPECT_EQ("0x00000000ff",
-            printToString(100, format("0x%*.*x", HexDigits, HexDigits, N)));
+  EXPECT_EQ(
+      "0x00000000ff",
+      printToString(100, format("0x%*.*" PRIx64, HexDigits, HexDigits, N)));
 
   // Now, do the same with formatv()
   EXPECT_EQ("0x00000000ff",



More information about the llvm-commits mailing list