mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
Changes to fix buffering that I forgot to commit with previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94222 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -456,8 +456,10 @@ public:
|
|||||||
explicit raw_svector_ostream(SmallVectorImpl<char> &O);
|
explicit raw_svector_ostream(SmallVectorImpl<char> &O);
|
||||||
~raw_svector_ostream();
|
~raw_svector_ostream();
|
||||||
|
|
||||||
/// clear - Flush the stream and clear the underlying vector.
|
/// resync - This is called when the SmallVector we're appending to is changed
|
||||||
void clear();
|
/// outside of the raw_svector_ostream's control. It is only safe to do this
|
||||||
|
/// if the raw_svector_ostream has previously been flushed.
|
||||||
|
void resync();
|
||||||
|
|
||||||
/// str - Flushes the stream contents to the target vector and return a
|
/// str - Flushes the stream contents to the target vector and return a
|
||||||
/// StringRef for the vector contents.
|
/// StringRef for the vector contents.
|
||||||
|
@ -136,6 +136,9 @@ void MCAsmStreamer::AddComment(const Twine &T) {
|
|||||||
T.toVector(CommentToEmit);
|
T.toVector(CommentToEmit);
|
||||||
// Each comment goes on its own line.
|
// Each comment goes on its own line.
|
||||||
CommentToEmit.push_back('\n');
|
CommentToEmit.push_back('\n');
|
||||||
|
|
||||||
|
// Tell the comment stream that the vector changed underneath it.
|
||||||
|
CommentStream.resync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::EmitCommentsAndEOL() {
|
void MCAsmStreamer::EmitCommentsAndEOL() {
|
||||||
@ -158,7 +161,9 @@ void MCAsmStreamer::EmitCommentsAndEOL() {
|
|||||||
Comments = Comments.substr(Position+1);
|
Comments = Comments.substr(Position+1);
|
||||||
} while (!Comments.empty());
|
} while (!Comments.empty());
|
||||||
|
|
||||||
CommentStream.clear();
|
CommentToEmit.clear();
|
||||||
|
// Tell the comment stream that the vector changed underneath it.
|
||||||
|
CommentStream.resync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -562,11 +562,14 @@ raw_svector_ostream::~raw_svector_ostream() {
|
|||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// clear - Flush the stream and clear the underlying vector.
|
/// resync - This is called when the SmallVector we're appending to is changed
|
||||||
void raw_svector_ostream::clear() {
|
/// outside of the raw_svector_ostream's control. It is only safe to do this
|
||||||
if (GetNumBytesInBuffer() == 0) flush();
|
/// if the raw_svector_ostream has previously been flushed.
|
||||||
|
void raw_svector_ostream::resync() {
|
||||||
OS.clear();
|
assert(GetNumBytesInBuffer() == 0 && "Didn't flush before mutating vector");
|
||||||
|
|
||||||
|
if (OS.capacity() - OS.size() < 64)
|
||||||
|
OS.reserve(OS.capacity() * 2);
|
||||||
SetBuffer(OS.end(), OS.capacity() - OS.size());
|
SetBuffer(OS.end(), OS.capacity() - OS.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user