From 9a31254d0e51cfe08bc0e0c63ea04780cbc776f4 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 27 Jul 2009 20:49:44 +0000 Subject: [PATCH] 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 --- lib/Support/raw_ostream.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 3cec18b442e..7e34e06c8dc 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