summaryrefslogtreecommitdiff
path: root/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-22 19:17:48 +0000
committerChris Lattner <sabre@nondot.org>2010-01-22 19:17:48 +0000
commitd79d9dce47d505369662ae5111dba24f9ccdef68 (patch)
treea6331f42bbf8981e99a5d78b0ca46729f41a8def /lib/Support/raw_ostream.cpp
parent8a23e0b07ba7eef3fd158be43f758d859b115f93 (diff)
downloadllvm-d79d9dce47d505369662ae5111dba24f9ccdef68.tar.gz
llvm-d79d9dce47d505369662ae5111dba24f9ccdef68.tar.bz2
llvm-d79d9dce47d505369662ae5111dba24f9ccdef68.tar.xz
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
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r--lib/Support/raw_ostream.cpp8
1 files changed, 8 insertions, 0 deletions
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!");