diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-30 18:21:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-30 18:21:23 +0000 |
commit | 48018e08f0d47331e72e5dcfcde2173217091b0e (patch) | |
tree | 5ef81d0a746dd0452b848da3759588f7227aa170 /lib/Support/raw_ostream.cpp | |
parent | bd17a295c1fe7ac5669af033086209254a0887a3 (diff) | |
download | llvm-48018e08f0d47331e72e5dcfcde2173217091b0e.tar.gz llvm-48018e08f0d47331e72e5dcfcde2173217091b0e.tar.bz2 llvm-48018e08f0d47331e72e5dcfcde2173217091b0e.tar.xz |
Add raw_ostream::write_hex
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r-- | lib/Support/raw_ostream.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 20e50efd2c..e3ab0c688a 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -113,10 +113,7 @@ raw_ostream &raw_ostream::operator<<(long long N) { return this->operator<<(static_cast<unsigned long long>(N)); } -raw_ostream &raw_ostream::operator<<(const void *P) { - uintptr_t N = (uintptr_t) P; - *this << '0' << 'x'; - +raw_ostream &raw_ostream::write_hex(unsigned long long N) { // Zero is a special case. if (N == 0) return *this << '0'; @@ -134,6 +131,12 @@ raw_ostream &raw_ostream::operator<<(const void *P) { return write(CurPtr, EndPtr-CurPtr); } +raw_ostream &raw_ostream::operator<<(const void *P) { + *this << '0' << 'x'; + + return write_hex((uintptr_t) P); +} + void raw_ostream::flush_nonempty() { assert(OutBufCur > OutBufStart && "Invalid call to flush_nonempty."); write_impl(OutBufStart, OutBufCur - OutBufStart); |