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 | 6c9629b92a6eb92892833dada7229bfd8af425e4 (patch) | |
| tree | 93e77714c578909c496df513f1a446e8bd8fa180 /llvm/lib/Support | |
| parent | 4d6aa73d6bc2e7fa5d2d8377d694e04abbe10859 (diff) | |
| download | bcm5719-llvm-6c9629b92a6eb92892833dada7229bfd8af425e4.tar.gz bcm5719-llvm-6c9629b92a6eb92892833dada7229bfd8af425e4.zip | |
Add raw_ostream::write_hex
llvm-svn: 77614
Diffstat (limited to 'llvm/lib/Support')
| -rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index 20e50efd2cc..e3ab0c688a3 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/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); |

