[llvm-commits] [llvm] r133032 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp

John McCall rjmccall at apple.com
Tue Jun 14 19:03:01 PDT 2011


On Jun 14, 2011, at 5:51 PM, Ted Kremenek wrote:
> Author: kremenek
> Date: Tue Jun 14 19:51:55 2011
> New Revision: 133032
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=133032&view=rev
> Log:
> add option for literal formatting to APInt::toString()
> 
> toString() now takes an optional bool argument that,
> depending on the radix, adds the appropriate prefix
> to the integer's string representation that makes it into a
> meaningful C literal, e.g.:
> 
> hexademical: '-f' becomes '-0xf'
> octal: '77' becomes '077'
> binary: '110' becomes '0b110'
> 
> Patch by nobled at dreamwidth.org!

Test cases, please.  You can add them to the unit test in unittests/ADT/APIntTest.cpp.

John.



More information about the llvm-commits mailing list