1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Add some hooks that a redesigned AsmStream needs to do its job. These

allow derived classes to examine the stream buffer before it's flushed.

llvm-svn: 75199
This commit is contained in:
David Greene 2009-07-09 23:43:41 +00:00
parent 1b15e9611e
commit 98610d5cfd
2 changed files with 17 additions and 0 deletions

View File

@ -44,6 +44,22 @@ private:
char *OutBufStart, *OutBufEnd, *OutBufCur;
bool Unbuffered;
protected:
/// CurBufPtr - Get a pointer to the current location in the buffer.
///
char *CurBufPtr(void) { return OutBufCur; }
/// StartBufPtr - Get a pointer to the start of the buffer
///
char *StartBufPtr(void) { return OutBufStart; }
/// EndBufPtr - Get a pointer to the end of the buffer
///
char *EndBufPtr(void) { return OutBufEnd; }
/// AboutToFlush- Called when the buffer is about to be flushed,
/// allowing derived classes to take some action.
///
virtual void AboutToFlush(void) {};
public:
// color order matches ANSI escape sequence, don't change
enum Colors {

View File

@ -120,6 +120,7 @@ raw_ostream &raw_ostream::operator<<(const void *P) {
void raw_ostream::flush_nonempty() {
assert(OutBufCur > OutBufStart && "Invalid call to flush_nonempty.");
AboutToFlush();
write_impl(OutBufStart, OutBufCur - OutBufStart);
OutBufCur = OutBufStart;
}