summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-07-27 20:49:44 +0000
committerDan Gohman <gohman@apple.com>2009-07-27 20:49:44 +0000
commit1b763293a6ddad19f09e8c2dbef5d6d26e295248 (patch)
treecfb060a5a914687d71d722d717ba57470f103524 /llvm
parente39f03351deb004f70a6e054e6704bf73298661e (diff)
downloadbcm5719-llvm-1b763293a6ddad19f09e8c2dbef5d6d26e295248.tar.gz
bcm5719-llvm-1b763293a6ddad19f09e8c2dbef5d6d26e295248.zip
Add an assertion check to raw_ostream's destructor to verify
that the subclass hasn't left any pending data in the buffer. llvm-svn: 77245
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 3cec18b442e..7e34e06c8dc 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -45,6 +45,11 @@
using namespace llvm;
raw_ostream::~raw_ostream() {
+ // raw_ostream's subclasses should take care to flush the buffer
+ // in their destructors.
+ assert(OutBufCur == OutBufStart &&
+ "raw_ostream destructor called with non-empty buffer!");
+
delete [] OutBufStart;
// If there are any pending errors, report them now. Clients wishing
OpenPOWER on IntegriCloud