diff options
author | Dan Gohman <gohman@apple.com> | 2009-07-27 21:46:02 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-07-27 21:46:02 +0000 |
commit | 4b66b47a7ccde60c32f8004dd7e68239f9d67e1f (patch) | |
tree | b09561c5cb1f9f3b8f90d6795fad8191e74e17cf | |
parent | 9e3b01f697ecf6ba34bd95c31a01b1ad375f12c1 (diff) | |
download | bcm5719-llvm-4b66b47a7ccde60c32f8004dd7e68239f9d67e1f.tar.gz bcm5719-llvm-4b66b47a7ccde60c32f8004dd7e68239f9d67e1f.zip |
Make raw_null_ostream flush its buffer in its destructor, so that
it conforms to the assertion added in r77245. This fixes a failure
in qa_override.c in clang's testsuite.
llvm-svn: 77255
-rw-r--r-- | llvm/include/llvm/Support/raw_ostream.h | 1 | ||||
-rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h index 3527984d2a6..246fdb92ec7 100644 --- a/llvm/include/llvm/Support/raw_ostream.h +++ b/llvm/include/llvm/Support/raw_ostream.h @@ -420,6 +420,7 @@ class raw_null_ostream : public raw_ostream { public: explicit raw_null_ostream() {} + ~raw_null_ostream(); }; } // end llvm namespace diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index 7e34e06c8dc..992c11a8220 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -438,6 +438,15 @@ uint64_t raw_svector_ostream::tell() { // raw_null_ostream //===----------------------------------------------------------------------===// +raw_null_ostream::~raw_null_ostream() { +#ifndef NDEBUG + // ~raw_ostream asserts that the buffer is empty. This isn't necessary + // with raw_null_ostream, but it's better to have raw_null_ostream follow + // the rules than to change the rules just for raw_null_ostream. + flush(); +#endif +} + void raw_null_ostream::write_impl(const char *Ptr, size_t Size) { } |