summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/MemoryBufferTest.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-23 20:25:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-23 20:25:01 +0000
commit3d2ac2e41a96f1989a4aa240b8323d09e5cdd397 (patch)
tree9290fa7a4deb8af7aa0cee250e301312ac6f7a84 /llvm/unittests/Support/MemoryBufferTest.cpp
parent03085c71848efe4b3308d87a345852ce554237d7 (diff)
downloadbcm5719-llvm-3d2ac2e41a96f1989a4aa240b8323d09e5cdd397.tar.gz
bcm5719-llvm-3d2ac2e41a96f1989a4aa240b8323d09e5cdd397.zip
Split getOpenFile into getOpenFile and getOpenFileSlice.
The main observation is that we never need both the filesize and the map size. When mapping a slice of a file, it doesn't make sense to request a null terminator and that would be the only case where the filesize would be used. There are other cleanups that should be done in this area: * A client should not have to pass the size (even an explicit -1) to say if it wants a null terminator or not, so we should probably swap the argument order. * The default should be to not require a null terminator. Very few clients require this, but many end up asking for it just because it is the default. llvm-svn: 186984
Diffstat (limited to 'llvm/unittests/Support/MemoryBufferTest.cpp')
-rw-r--r--llvm/unittests/Support/MemoryBufferTest.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/unittests/Support/MemoryBufferTest.cpp b/llvm/unittests/Support/MemoryBufferTest.cpp
index 336a0e441c0..d5ea8de3c17 100644
--- a/llvm/unittests/Support/MemoryBufferTest.cpp
+++ b/llvm/unittests/Support/MemoryBufferTest.cpp
@@ -113,13 +113,10 @@ TEST_F(MemoryBufferTest, getOpenFileNoNullTerminator) {
}
OwningBuffer Buf;
- error_code EC = MemoryBuffer::getOpenFile(TestFD,
- TestPath.c_str(),
- Buf,
- 40000, // Size
- -1,
- 8000, // Offset
- false);
+ error_code EC = MemoryBuffer::getOpenFileSlice(TestFD, TestPath.c_str(), Buf,
+ 40000, // Size
+ 8000 // Offset
+ );
EXPECT_FALSE(EC);
StringRef BufData = Buf->getBuffer();
OpenPOWER on IntegriCloud