[llvm-commits] [llvm] r75199 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp

Chris Lattner clattner at apple.com
Thu Jul 9 19:44:09 PDT 2009


On Jul 9, 2009, at 5:36 PM, David Greene wrote:

> On Thursday 09 July 2009 18:58, Dan Gohman wrote:
>> On Jul 9, 2009, at 4:43 PM, David Greene wrote:
>>> void raw_ostream::flush_nonempty() {
>>>  assert(OutBufCur > OutBufStart && "Invalid call to
>>> flush_nonempty.");
>>> +  AboutToFlush();
>>>  write_impl(OutBufStart, OutBufCur - OutBufStart);
>>
>> Instead of introducing a new hook and making flush_nonempty make two
>> virtual
>> calls, could you make AsmOStream override write_impl to do its  
>> work, and
>> then call its superclass' write_impl?
>
> Makes sense.  I'll do that.  It also reminds me I need to fix
> something else in raw_ostream because there's at least one case
> where it bypasses its buffer and that will kill everything
> raw_asm_fd_stream is trying to do.

Thanks, a couple other nit-picky things :)

+  /// 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; }

Please add "Get" prefixes to these.  Also s/(void)/()/ for C++ code.   
Also, thanks for splitting this patch out from the other one.

-Chris



More information about the llvm-commits mailing list