[llvm-commits] [llvm] r77245 - /llvm/trunk/lib/Support/raw_ostream.cpp

Dan Gohman gohman at apple.com
Mon Jul 27 13:49:45 PDT 2009


Author: djg
Date: Mon Jul 27 15:49:44 2009
New Revision: 77245

URL: http://llvm.org/viewvc/llvm-project?rev=77245&view=rev
Log:
Add an assertion check to raw_ostream's destructor to verify
that the subclass hasn't left any pending data in the buffer.

Modified:
    llvm/trunk/lib/Support/raw_ostream.cpp

Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=77245&r1=77244&r2=77245&view=diff

==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Mon Jul 27 15:49:44 2009
@@ -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





More information about the llvm-commits mailing list