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 | e95d409bdd8fb0c318645203098a7ae1bb6a5f06 (patch) | |
| tree | a302044ec7025f4884d9ebc6883ab0ef71c6c9a4 /llvm/lib/Support | |
| parent | c61089a6c231ecf07631d767d2d1db0ec0816262 (diff) | |
| download | bcm5719-llvm-e95d409bdd8fb0c318645203098a7ae1bb6a5f06.tar.gz bcm5719-llvm-e95d409bdd8fb0c318645203098a7ae1bb6a5f06.zip | |
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.
llvm-svn: 74494
Diffstat (limited to 'llvm/lib/Support')
| -rw-r--r-- | llvm/lib/Support/APInt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 73bf774b171..25e23e0ac00 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/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. |

