aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-06-22 13:57:08 +0000
committerDan Gohman <gohman@apple.com>2010-06-22 13:57:08 +0000
commit30f30e43861512d78023c84952e5e524c0003ae9 (patch)
tree8e66f0bf35cad29d09f3fa7087ac5bd53bdbcb31 /include
parent455164bdff2ea20ac43a26388a7bea760581708d (diff)
Add a comment explaining a non-obvious API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/MemoryBuffer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h
index 38f61935d9..0b6cd12f6f 100644
--- a/include/llvm/Support/MemoryBuffer.h
+++ b/include/llvm/Support/MemoryBuffer.h
@@ -26,6 +26,11 @@ namespace llvm {
/// 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.