llvm.org GIT mirror llvm / de75d7f
Add slow path for single character write, and use exclusively for single characters writes outside of the fast path in raw_ostream.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67053 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 10 years ago
2 changed file(s) with 12 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
8181
8282 raw_ostream &operator<<(char C) {
8383 if (OutBufCur >= OutBufEnd)
84 flush_impl();
84 return write(C);
8585 *OutBufCur++ = C;
8686 if (Unbuffered)
8787 flush_impl();
9090
9191 raw_ostream &operator<<(unsigned char C) {
9292 if (OutBufCur >= OutBufEnd)
93 flush_impl();
93 return write(C);
9494 *OutBufCur++ = C;
9595 if (Unbuffered)
9696 flush_impl();
9999
100100 raw_ostream &operator<<(signed char C) {
101101 if (OutBufCur >= OutBufEnd)
102 flush_impl();
102 return write(C);
103103 *OutBufCur++ = C;
104104 if (Unbuffered)
105105 flush_impl();
131131 return this->operator<<(ftostr(N));
132132 }
133133
134 raw_ostream &write(unsigned char C);
134135 raw_ostream &write(const char *Ptr, unsigned Size);
135136
136137 // Formatted output, see the format() function in Support/Format.h.
6262
6363 raw_ostream &raw_ostream::operator<<(long N) {
6464 if (N < 0) {
65 if (OutBufCur >= OutBufEnd)
66 flush_impl();
67 *OutBufCur++ = '-';
68
65 *this << '-';
6966 N = -N;
7067 }
7168
9087
9188 raw_ostream &raw_ostream::operator<<(long long N) {
9289 if (N < 0) {
93 if (OutBufCur >= OutBufEnd)
94 flush_impl();
95 *OutBufCur++ = '-';
96
90 *this << '-';
9791 N = -N;
9892 }
9993
10599 return *this << format("%p", P);
106100 }
107101
102 raw_ostream &raw_ostream::write(unsigned char C) {
103 if (OutBufCur >= OutBufEnd)
104 flush_impl();
105
106 *OutBufCur++ = C;
107 }
108108
109109 raw_ostream &raw_ostream::write(const char *Ptr, unsigned Size) {
110110 if (OutBufCur+Size > OutBufEnd)