diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-22 19:17:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-22 19:17:48 +0000 |
commit | 8fa0e35f9775bc562eedf468fde63623b2da18bf (patch) | |
tree | 81f52fc4ac0d888d14e37371ffc1949ad80beaff /llvm/lib/Support | |
parent | 6c0c8d41b4ada062842458bc627b72e87542f3fc (diff) | |
download | bcm5719-llvm-8fa0e35f9775bc562eedf468fde63623b2da18bf.tar.gz bcm5719-llvm-8fa0e35f9775bc562eedf468fde63623b2da18bf.zip |
add a new MCAsmStreamer::GetCommentOS method to simplify stuff
that doesn't want to use twines.
llvm-svn: 94199
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index a820210f7bd..7cd16c888b9 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/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!"); |