OSDN Git Service

Fix off-by-one in llvm::Format::print.
authorDaniel Dunbar <daniel@zuster.org>
Sun, 23 Aug 2009 20:31:39 +0000 (20:31 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 23 Aug 2009 20:31:39 +0000 (20:31 +0000)
commitffbbf314f1740b9d73c5af1ad1aa3e731dac026b
treece52791943346ccf557a8aa28979b3f157d58f4e
parent165b4dfeba7c1b0e7d3ca0ef71c276f585fee79f
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. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79862 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Format.h
lib/Support/raw_ostream.cpp
unittests/Support/raw_ostream_test.cpp