mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 20:23:59 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186984 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user