[llvm-commits] [llvm] r106539 - /llvm/trunk/include/llvm/Support/MemoryBuffer.h
Dan Gohman
gohman at apple.com
Tue Jun 22 06:57:08 PDT 2010
Author: djg
Date: Tue Jun 22 08:57:08 2010
New Revision: 106539
URL: http://llvm.org/viewvc/llvm-project?rev=106539&view=rev
Log:
Add a comment explaining a non-obvious API.
Modified:
llvm/trunk/include/llvm/Support/MemoryBuffer.h
Modified: llvm/trunk/include/llvm/Support/MemoryBuffer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryBuffer.h?rev=106539&r1=106538&r2=106539&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/MemoryBuffer.h (original)
+++ llvm/trunk/include/llvm/Support/MemoryBuffer.h Tue Jun 22 08:57:08 2010
@@ -26,6 +26,11 @@
/// into a memory buffer. In addition to basic access to the characters in the
/// file, this interface guarantees you can read one character past the end of
/// the file, and that this character will read as '\0'.
+///
+/// The '\0' guarantee is needed to support an optimization -- it's intended to
+/// be more efficient for clients which are reading all the data to stop
+/// reading when they encounter a '\0' than to continually check the file
+/// position to see if it has reached the end of the file.
class MemoryBuffer {
const char *BufferStart; // Start of the buffer.
const char *BufferEnd; // End of the buffer.
More information about the llvm-commits
mailing list