================
@@ -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)
+ {
+ case ConversionSpecifier::Kind::xArg:
+ FormatSpec.push_back('x'); // Not strictly needed
+ break;
+ case ConversionSpecifier::Kind::XArg:
+ FormatSpec.push_back('X');
+ break;
+ default:
+ FormatSpec.push_back('d');
----------------
EugeneZelenko wrote:
```suggestion
FormatSpec.push_back('d');
break;
```
https://github.com/llvm/llvm-project/pull/155200
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits