Add a write(raw_ostream&) method to RewriteBuffer. This uses an inefficient
implementation today but is the right place if we want to make it faster some
day.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101521 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/Rewriter.cpp b/lib/Rewrite/Rewriter.cpp
index bf8ba70..376678a 100644
--- a/lib/Rewrite/Rewriter.cpp
+++ b/lib/Rewrite/Rewriter.cpp
@@ -20,6 +20,12 @@
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
 
+llvm::raw_ostream &RewriteBuffer::write(llvm::raw_ostream &os) const {
+  // FIXME: eliminate the copy by writing out each chunk at a time
+  os << std::string(begin(), end());
+  return os;
+}
+
 void RewriteBuffer::RemoveText(unsigned OrigOffset, unsigned Size) {
   // Nothing to remove, exit early.
   if (Size == 0) return;
@@ -222,5 +228,3 @@
   ReplaceText(From->getLocStart(), Size, Str);
   return false;
 }
-
-