[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 02:31:39 PDT 2023


hazohelet marked an inline comment as done.
hazohelet added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:966
+        // size. e.g.(("%#3x", 0xf) is "0xf")
+
+        // If the result is zero, o, b, x, X adds nothing.
----------------
serge-sans-paille wrote:
> Then couldn't we increase the Size if the `FieldWidth` is unspecified?
We cannot, unless the formatted integer is known to be nonzero.
`("%#x", 0)` is `"0"` and not `"0x0"`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159138/new/

https://reviews.llvm.org/D159138



More information about the cfe-commits mailing list