[llvm-commits] [llvm] r74550 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp unittests/ADT/APIntTest.cpp

Dan Gohman gohman at apple.com
Tue Jun 30 13:11:03 PDT 2009


Author: djg
Date: Tue Jun 30 15:10:56 2009
New Revision: 74550

URL: http://llvm.org/viewvc/llvm-project?rev=74550&view=rev
Log:
Reapply 74494, this time removing the conflicting definition of operator<<
in APIntTest.cpp.

Modified:
    llvm/trunk/include/llvm/ADT/APInt.h
    llvm/trunk/lib/Support/APInt.cpp
    llvm/trunk/unittests/ADT/APIntTest.cpp

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=74550&r1=74549&r2=74550&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Tue Jun 30 15:10:56 2009
@@ -1426,6 +1426,8 @@
   return OS;
 }
 
+std::ostream &operator<<(std::ostream &o, const APInt &I);
+
 namespace APIntOps {
 
 /// @brief Determine the smaller of two APInts considered to be signed.

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=74550&r1=74549&r2=74550&view=diff

==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Tue Jun 30 15:10:56 2009
@@ -2178,6 +2178,12 @@
   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.
 

Modified: llvm/trunk/unittests/ADT/APIntTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APIntTest.cpp?rev=74550&r1=74549&r2=74550&view=diff

==============================================================================
--- llvm/trunk/unittests/ADT/APIntTest.cpp (original)
+++ llvm/trunk/unittests/ADT/APIntTest.cpp Tue Jun 30 15:10:56 2009
@@ -17,19 +17,6 @@
 
 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;





More information about the llvm-commits mailing list