summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-30 20:10:56 +0000
committerDan Gohman <gohman@apple.com>2009-06-30 20:10:56 +0000
commit10f1733d9a5cf39f7010bc8b29c3bb4d63a383fa (patch)
tree2daef69f06554d2a546eef124014d1a95fb65e0a /llvm
parent28d6d872447f401815e4fde75dd13741493e8565 (diff)
downloadbcm5719-llvm-10f1733d9a5cf39f7010bc8b29c3bb4d63a383fa.tar.gz
bcm5719-llvm-10f1733d9a5cf39f7010bc8b29c3bb4d63a383fa.zip
Reapply 74494, this time removing the conflicting definition of operator<<
in APIntTest.cpp. llvm-svn: 74550
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ADT/APInt.h2
-rw-r--r--llvm/lib/Support/APInt.cpp6
-rw-r--r--llvm/unittests/ADT/APIntTest.cpp13
3 files changed, 8 insertions, 13 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 63bf4f6d9ba..56cd3ccf84e 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -1426,6 +1426,8 @@ inline raw_ostream &operator<<(raw_ostream &OS, const APInt &I) {
return OS;
}
+std::ostream &operator<<(std::ostream &o, const APInt &I);
+
namespace APIntOps {
/// @brief Determine the smaller of two APInts considered to be signed.
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 73bf774b171..30dc3526abd 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 &llvm::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.
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 8ff7d1d8099..648faf13ad8 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -17,19 +17,6 @@ using namespace llvm;
namespace {
-// Make the Google Test failure output equivalent to APInt::dump()
-std::ostream& operator<<(std::ostream &OS, const llvm::APInt& I) {
- llvm::raw_os_ostream raw_os(OS);
-
- SmallString<40> S, U;
- I.toStringUnsigned(U);
- I.toStringSigned(S);
- raw_os << "APInt(" << I.getBitWidth()<< "b, "
- << U.c_str() << "u " << S.c_str() << "s)";
- raw_os.flush();
- return OS;
-}
-
// Test that APInt shift left works when bitwidth > 64 and shiftamt == 0
TEST(APIntTest, ShiftLeftByZero) {
APInt One = APInt::getNullValue(65) + 1;
OpenPOWER on IntegriCloud