[llvm-commits] [llvm] r79862 - in /llvm/trunk: include/llvm/Support/Format.h lib/Support/raw_ostream.cpp unittests/Support/raw_ostream_test.cpp
Chris Lattner
clattner at apple.com
Sun Aug 23 14:09:32 PDT 2009
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?
> + unsigned print(char *Buffer, unsigned BufferSize) const {
> + assert(BufferSize && "Invalid buffer size!");
Is there a specific reason for this to be inline? This seems
perfectly fine to put into the .cpp file. I guess you're just
following the existing practice, but it would be nice to move this out
of line too.
-Chris
More information about the llvm-commits
mailing list