diff options
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/FormattedStream.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Support/FormattedStream.cpp b/llvm/lib/Support/FormattedStream.cpp index df91641962f..01dea3628c0 100644 --- a/llvm/lib/Support/FormattedStream.cpp +++ b/llvm/lib/Support/FormattedStream.cpp @@ -55,3 +55,16 @@ void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) } } +/// fouts() - This returns a reference to a formatted_raw_ostream for +/// standard output. Use it like: fouts() << "foo" << "bar"; +formatted_raw_ostream &llvm::fouts() { + static formatted_raw_ostream S(outs()); + return S; +} + +/// ferrs() - This returns a reference to a formatted_raw_ostream for +/// standard error. Use it like: ferrs() << "foo" << "bar"; +formatted_raw_ostream &llvm::ferrs() { + static formatted_raw_ostream S(errs()); + return S; +} diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index 42e6fda97ba..23a756e4df2 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -166,7 +166,7 @@ raw_ostream &raw_ostream::write(const char *Ptr, unsigned Size) { case 0: break; default: // Normally the string to emit is shorter than the buffer. - if (Size <= unsigned(OutBufEnd-OutBufStart)) { + if (Size <= unsigned(OutBufEnd-OutBufCur)) { memcpy(OutBufCur, Ptr, Size); break; } |