[llvm-commits] [PATCH] Bug 5207: sanitise APInt doubleToBits() and floatToBits()

Jay Foad jay.foad at gmail.com
Fri Nov 26 02:44:54 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=5207

This bug says, among other things, that the APInt methods "that update
in place should return void to make it really clear that they do not
return a new APInt".

The methods doubleToBits() and floatToBits() update the APInt in
place, and are defined to truncate or zero-extend the double/float
bits if the APInt isn't already 64/32 bits wide respectively. These
semantics don't seem very useful, and indeed no-one seems to use them,
so how about changing these methods to be static and return a new
APInt?

Patch attached. grep tells me that these methods aren't used in cfe or
llvm-gcc. "make check" shows no new failures beyond what I reported
here:

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-November/012292.html

OK to commit?

Thanks,
Jay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apint.diff
Type: text/x-patch
Size: 3615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101126/2eb07b2b/attachment.bin>


More information about the llvm-commits mailing list