OSDN Git Service

add option for literal formatting to APInt::toString()
authorTed Kremenek <kremenek@apple.com>
Wed, 15 Jun 2011 00:51:55 +0000 (00:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 15 Jun 2011 00:51:55 +0000 (00:51 +0000)
commitcf886188fb04d9521db39fe5213df1295673f51e
tree6ec35a5a4465367e62d725a57fc8b7aec3198f39
parenta990e071f2f29ba326b97a4288207a2c406c5b66
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@dreamwidth.org!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133032 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/APInt.h
lib/Support/APInt.cpp