Twine: Use raw_ostream::write_hex, remove unused itohexstr method.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 30 Jul 2009 18:30:19 +0000 (18:30 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 30 Jul 2009 18:30:19 +0000 (18:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77617 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/Twine.h
lib/Support/Twine.cpp
unittests/ADT/TwineTest.cpp

index 6c4905e643c144823369d3c1cf2ee4a57be9281a..cb5bb4d7b9fa07099c3cd9e2a918194b1dc44b62 100644 (file)
@@ -303,13 +303,6 @@ namespace llvm {
       return Twine(&Val, UHexKind, 0, EmptyKind);
     }
 
-    // Construct a twine to print \arg Val as an unsigned hexadecimal
-    // integer. This routine is provided as a convenience to sign extend values
-    // before printing.
-    static Twine itohexstr(const int64_t &Val) {
-      return Twine(&Val, UHexKind, 0, EmptyKind);
-    }
-
     /// @}
     /// @name String Operations
     /// @{
index 2b0cf062ec875ddeecf55a270887a4a5d937ba3e..83a3a6180f3f6e578860437131f434551018d501 100644 (file)
@@ -60,8 +60,7 @@ void Twine::printOneChild(raw_ostream &OS, const void *Ptr,
     OS << *static_cast<const int64_t*>(Ptr);
     break;
   case Twine::UHexKind:
-    // FIXME: Add raw_ostream functionality for this.
-    OS << ::utohexstr(*static_cast<const uint64_t*>(Ptr));
+    OS.write_hex(*static_cast<const uint64_t*>(Ptr));
     break;
   }
 }
index 9a31901864ef4c1afe818dcf7b76c4c91812ff76..61e8a0ac37cbbccfe7cd1cb13103cffaef24b276 100644 (file)
@@ -39,8 +39,7 @@ TEST(TwineTest, Numbers) {
   EXPECT_EQ("123", Twine((char) 123).str());
   EXPECT_EQ("-123", Twine((signed char) -123).str());
 
-  EXPECT_EQ("7B", Twine::utohexstr(123).str());
-  EXPECT_EQ("FFFFFFFFFFFFFF85", Twine::itohexstr(-123).str());
+  EXPECT_EQ("7b", Twine::utohexstr(123).str());
 }
 
 TEST(TwineTest, Concat) {