[llvm-commits] [PATCH] Handle negative values in StringRef::getAsInteger(unsigned Radix, APInt &).

Chris Lattner clattner at apple.com
Tue Feb 21 20:15:38 PST 2012


On Feb 16, 2012, at 2:45 PM, Michael Spencer wrote:

> On Thu, Feb 16, 2012 at 8:20 AM, Chris Lattner <clattner at apple.com> wrote:
>> 
>> On Feb 15, 2012, at 4:25 PM, Michael Spencer wrote:
>> 
>>> I have a use case for this in lld.
>> 
>> 
>> This is sorta strange to me, how about adding an APSInt overload that allows negative (also weird) or a new getAsSignedInteger method (probably better)?
>> 
>> -Chris
> 
> There is already precedent in the other StringRef::getAsInteger
> functions to accept negative values. I believe the interface should be
> uniform.
> 
> All I actually need is uint64_t and int64_t, however, these are
> unsigned long and long on my platform (x86-64 Linux), and thus don't
> match any of the overloads.
> 
> Would it be better for me to just cleanup the overload set?

I'd prefer you to clean up the overload set, but do what you think is best.  Thanks!

-Chris



More information about the llvm-commits mailing list