aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-21 03:56:00 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-21 03:56:00 +0000
commitbd66f1607e2c9e866c66fdb4b1feb9a15718075b (patch)
tree985d21821824d448ac556a057d6c8052393b9441 /include/llvm
parent51481994a6a57871da58724cd6b9aa249833c4f8 (diff)
downloadexternal_llvm-bd66f1607e2c9e866c66fdb4b1feb9a15718075b.zip
external_llvm-bd66f1607e2c9e866c66fdb4b1feb9a15718075b.tar.gz
external_llvm-bd66f1607e2c9e866c66fdb4b1feb9a15718075b.tar.bz2
Don't allow formatted_ostream to be unbuffered, even if its underlying buffer
is. - The problem is that formatted_ostream forces its underlying buffer to be unbuffered, so if some client happens to wrap a formatted_ostream around something, but still use the underlying stream, then we can end up writing on a fully unbuffered output (which was never intended to be unbuffered). - This makes clang (and presumably llvm-gcc) -emit-llvm -S a mere 10x faster. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Support/FormattedStream.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/llvm/Support/FormattedStream.h b/include/llvm/Support/FormattedStream.h
index 24a3546..6b51144 100644
--- a/include/llvm/Support/FormattedStream.h
+++ b/include/llvm/Support/FormattedStream.h
@@ -105,10 +105,15 @@ namespace llvm
// own buffering, and it doesn't need or want TheStream to do another
// layer of buffering underneath. Resize the buffer to what TheStream
// had been using, and tell TheStream not to do its own buffering.
+ //
+ // If the underlying stream is unbuffered, just use its preferred buffer
+ // size. We can't treat this as an honest wish for unbuffered output,
+ // because it could very well be a stream we previously forced to be
+ // unbuffered.
if (size_t BufferSize = TheStream->GetBufferSize())
SetBufferSize(BufferSize);
else
- SetUnbuffered();
+ SetBuffered();
TheStream->SetUnbuffered();
Scanned = 0;