llvm.org GIT mirror llvm / 48018e0
Add raw_ostream::write_hex git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77614 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 10 years ago
2 changed file(s) with 10 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
197197 return *this;
198198 }
199199
200 /// write_hex - Output \arg N in hexadecimal, without any prefix or padding.
201 raw_ostream &write_hex(unsigned long long N);
202
200203 raw_ostream &write(unsigned char C);
201204 raw_ostream &write(const char *Ptr, size_t Size);
202205
112112 return this->operator<<(static_cast(N));
113113 }
114114
115 raw_ostream &raw_ostream::operator<<(const void *P) {
116 uintptr_t N = (uintptr_t) P;
117 *this << '0' << 'x';
118
115 raw_ostream &raw_ostream::write_hex(unsigned long long N) {
119116 // Zero is a special case.
120117 if (N == 0)
121118 return *this << '0';
131128 }
132129
133130 return write(CurPtr, EndPtr-CurPtr);
131 }
132
133 raw_ostream &raw_ostream::operator<<(const void *P) {
134 *this << '0' << 'x';
135
136 return write_hex((uintptr_t) P);
134137 }
135138
136139 void raw_ostream::flush_nonempty() {