[clang-tools-extra] [clang-tidy] modernize-use-std-format: Correct replacement types when signed stdint types are used, and when enums are printed in hex. #150343 (PR #155200)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 25 07:23:15 PDT 2025


================
@@ -453,8 +457,38 @@ bool FormatStringConverter::emitIntegerArgument(
     // std::format will print bool as either "true" or "false" by default,
     // but printf prints them as "0" or "1". Be compatible with printf by
     // requesting decimal output.
-    FormatSpec.push_back('d');
+
+    // In cases where `x` or `X` was specified in the format string
+    // these will technically have no effect, since the bool can only be zero or
+    // one. However, it seems best to leave them as-is anyway.
+    switch(ArgKind)
----------------
EugeneZelenko wrote:

Please run Clang-Format.

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


More information about the cfe-commits mailing list