aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r--lib/Support/raw_ostream.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 9827ca776a..b9beac2869 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -268,3 +268,38 @@ void raw_os_ostream::flush_impl() {
OS.write(OutBufStart, OutBufCur-OutBufStart);
HandleFlush();
}
+
+//===----------------------------------------------------------------------===//
+// raw_string_ostream
+//===----------------------------------------------------------------------===//
+
+raw_string_ostream::~raw_string_ostream() {
+ flush();
+}
+
+/// flush_impl - The is the piece of the class that is implemented by
+/// subclasses. This outputs the currently buffered data and resets the
+/// buffer to empty.
+void raw_string_ostream::flush_impl() {
+ if (OutBufCur-OutBufStart)
+ OS.append(OutBufStart, OutBufCur-OutBufStart);
+ HandleFlush();
+}
+
+//===----------------------------------------------------------------------===//
+// raw_svector_ostream
+//===----------------------------------------------------------------------===//
+
+raw_svector_ostream::~raw_svector_ostream() {
+ flush();
+}
+
+/// flush_impl - The is the piece of the class that is implemented by
+/// subclasses. This outputs the currently buffered data and resets the
+/// buffer to empty.
+void raw_svector_ostream::flush_impl() {
+ if (OutBufCur-OutBufStart)
+ OS.append(OutBufStart, OutBufCur);
+ HandleFlush();
+}
+