add a new MCAsmStreamer::GetCommentOS method to simplify stuff
that doesn't want to use twines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94199 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index a820210..7cd16c8 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -562,6 +562,14 @@
flush();
}
+/// clear - Flush the stream and clear the underlying vector.
+void raw_svector_ostream::clear() {
+ if (GetNumBytesInBuffer() == 0) flush();
+
+ OS.clear();
+ SetBuffer(OS.end(), OS.capacity() - OS.size());
+}
+
void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) {
assert(Ptr == OS.end() && OS.size() + Size <= OS.capacity() &&
"Invalid write_impl() call!");