[llvm] [Support][ScopedPrinter] Emit valid JSON in printHex<ulittle16_t> (PR #200071)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 01:02:11 PDT 2026


================
@@ -549,7 +549,7 @@ template <>
 inline void
 ScopedPrinter::printHex<support::ulittle16_t>(StringRef Label,
                                               support::ulittle16_t Value) {
-  startLine() << Label << ": " << hex(Value) << "\n";
+  printHexImpl(Label, hex(static_cast<uint16_t>(Value)));
----------------
jh7370 wrote:

Better might be to call `printHex(Label, static_cast<uint16_t>(Value))`, to reduce the need to know about the exact way to invoke `printHexImpl` (I'm working on the assumption that there is actually a need to the `printHex` specialization that you're modifying here).

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


More information about the llvm-commits mailing list