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 | 9a31254d0e51cfe08bc0e0c63ea04780cbc776f4 (patch) | |
tree | 316c0f025d8bd069dd19064f13abd3d891123901 /lib/Support/raw_ostream.cpp | |
parent | 99a8205ae366d9e6bd3cdc6561a5715a5b665589 (diff) |
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
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-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 3cec18b442..7e34e06c8d 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 |