ADT: Add int64_t interoperability to APSInt
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 5 Feb 2015 00:17:43 +0000 (00:17 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 5 Feb 2015 00:17:43 +0000 (00:17 +0000)
commit97ec768f7f67d5a38281a329bc1e57036583b8e8
tree7f934624628652c120ac059cd85714a5b91d2f2e
parent91568ff3aa9a29819e94fb44d7c9f591bbfdd44e
ADT: Add int64_t interoperability to APSInt

Add some API to `APSInt` to make it easier to compare with `int64_t`.

  - `APSInt::compareValues(APSInt, APSInt)` returns 1, -1 or 0 for
    greater, lesser, or equal, doing the right thing for mismatched
    "has-sign" and bitwidths.  This is just like `isSameValue()` (and is
    now the implementation of it).
  - `APSInt::get(int64_t)` gets a signed `APSInt`.
  - `operator<(int64_t)`, etc., are implemented trivially via `get()`
    and `compareValues()`.
  - Also added `APSInt::getUnsigned(uint64_t)` to make it easier to test
    `compareValues()`.

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