From d79d9dce47d505369662ae5111dba24f9ccdef68 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 22 Jan 2010 19:17:48 +0000 Subject: 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 --- lib/Support/raw_ostream.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Support/raw_ostream.cpp') diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index a820210f7b..7cd16c888b 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -562,6 +562,14 @@ raw_svector_ostream::~raw_svector_ostream() { 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!"); -- cgit v1.2.3-18-g5258