[PATCH] Teach llvm::format_hex() to support formatting without a prefix '0x'

Sean Silva chisophugis at gmail.com
Sat Jan 24 08:14:54 PST 2015


On Fri, Jan 23, 2015 at 10:00 PM, Chandler Carruth <chandlerc at google.com>
wrote:

>
> On Fri, Jan 23, 2015 at 1:58 PM, Rui Ueyama <ruiu at google.com> wrote:
>
>> Why does format_hex prints out "0x" prefix in the first place? If it
>> doesn't, like printf %x, we don't need an extra parameter or a separate
>> function. It may be too late, though.
>
>
> I would be fine to change all users to just write '0x' into the stream
> first.
>

+1. Compare:

OS << format_hex(N, 16, false, true);
vs.
OS << "0x" << format_hex(N, 16);

-- Sean Silva


>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150124/341e01ef/attachment.html>


More information about the llvm-commits mailing list