diff options
author | Dan Gohman <gohman@apple.com> | 2009-07-27 20:49:44 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-07-27 20:49:44 +0000 |
commit | ab7f07551d31de0a5819cc57619b5222b807af5d (patch) | |
tree | 316c0f025d8bd069dd19064f13abd3d891123901 | |
parent | 23bece4ef029f65575d1624ffeb9115e022468a0 (diff) | |
download | external_llvm-ab7f07551d31de0a5819cc57619b5222b807af5d.zip external_llvm-ab7f07551d31de0a5819cc57619b5222b807af5d.tar.gz external_llvm-ab7f07551d31de0a5819cc57619b5222b807af5d.tar.bz2 |
Add an assertion check to raw_ostream's destructor to verify
that the subclass hasn't left any pending data in the buffer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77245 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Support/raw_ostream.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 3cec18b..7e34e06 100644 --- a/lib/Support/raw_ostream.cpp +++ b/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 |