Changes to fix buffering that I forgot to commit with previous patch.
[oota-llvm.git] / lib / MC / MCAsmStreamer.cpp
index e284e15bca22a6a6ebcc651ad3466fae3e84cfc7..d4ef3ca826cad5f1ad8009c5f551bc656c1fd5e8 100644 (file)
@@ -136,6 +136,9 @@ void MCAsmStreamer::AddComment(const Twine &T) {
   T.toVector(CommentToEmit);
   // Each comment goes on its own line.
   CommentToEmit.push_back('\n');
+  
+  // Tell the comment stream that the vector changed underneath it.
+  CommentStream.resync();
 }
 
 void MCAsmStreamer::EmitCommentsAndEOL() {
@@ -158,7 +161,9 @@ void MCAsmStreamer::EmitCommentsAndEOL() {
     Comments = Comments.substr(Position+1);
   } while (!Comments.empty());
   
-  CommentStream.clear();
+  CommentToEmit.clear();
+  // Tell the comment stream that the vector changed underneath it.
+  CommentStream.resync();
 }