OSDN Git Service

ADT: Correct APInt::getActiveWords for zero values
authorMeador Inge <meadori@codesourcery.com>
Thu, 7 Feb 2013 18:36:50 +0000 (18:36 +0000)
committerMeador Inge <meadori@codesourcery.com>
Thu, 7 Feb 2013 18:36:50 +0000 (18:36 +0000)
commit35b1423ee67a6ec7052016dda486e6ee4a118db4
treede4008f97ca37a551caff7463b7fb6c9ad87121a
parentdef0c1f756562601829364e3fca4bd1f0407316e
ADT: Correct APInt::getActiveWords for zero values

PR15138 was opened because of a segfault in the Bitcode writer.
The actual issue ended up being a bug in APInt where calls to
APInt::getActiveWords returns a bogus value when the APInt value
is 0.  This patch fixes the problem by ensuring that getActiveWords
returns 1 for 0 valued APInts.

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