[llvm-commits] [llvm] r79862 - in /llvm/trunk: include/llvm/Support/Format.h lib/Support/raw_ostream.cpp unittests/Support/raw_ostream_test.cpp

Daniel Dunbar daniel at zuster.org
Sun Aug 23 14:18:08 PDT 2009


On Sun, Aug 23, 2009 at 2:09 PM, Chris Lattner<clattner at apple.com> wrote:
> On Aug 23, 2009, at 1:31 PM, Daniel Dunbar wrote:
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=79862&view=rev
>> Log:
>> Fix off-by-one in llvm::Format::print.
>> - This also shortens the Format.h implementation, and uses the print
>> buffer
>>  fully (it was wasting a character).
>>
>> - This manifested as llvm-test failures, because one side effect was that
>>  raw_ostream would write garbage '\x00' values into the output stream if
>> it
>>  happened that the string was at the end of the buffer. This meant that
>> grep
>>  would report 'Binary file matches', which meant the silly pattern
>> matching
>>  llvm-test eventually does would fail. Cute. :)
>
> Nice catch, should this be pulled into 2.6?

Probably might as well, I'll forward.

>> +  unsigned print(char *Buffer, unsigned BufferSize) const {
>> +    assert(BufferSize && "Invalid buffer size!");
>
> Is there a specific reason for this to be inline?

Not that I know of, I'll move it to a .cpp, even if its yours. :)

 - Daniel




More information about the llvm-commits mailing list