diff options
| author | Dan Gohman <gohman@apple.com> | 2009-06-30 01:28:08 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-06-30 01:28:08 +0000 |
| commit | 29e708b3359f84090fbcaacc0d7c2c73f5159317 (patch) | |
| tree | 31224654ef46fb6c5e3108fe5e6c920d38b1c64c /lib/Support | |
| parent | a7a87deadbedd003999f4da34959071aa7c0507b (diff) | |
| download | external_llvm-29e708b3359f84090fbcaacc0d7c2c73f5159317.zip external_llvm-29e708b3359f84090fbcaacc0d7c2c73f5159317.tar.gz external_llvm-29e708b3359f84090fbcaacc0d7c2c73f5159317.tar.bz2 | |
Define an operator<< for APInt to be used with std::ostream.
This will allow it to be used in unittests that use gtest's
EXPECT_EQ.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
| -rw-r--r-- | lib/Support/APInt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 73bf774..25e23e0 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -2178,6 +2178,12 @@ void APInt::print(raw_ostream &OS, bool isSigned) const { OS << S.c_str(); } +std::ostream &operator<<(std::ostream &o, const APInt &I) { + raw_os_ostream OS(o); + OS << I; + return o; +} + // This implements a variety of operations on a representation of // arbitrary precision, two's-complement, bignum integer values. |
