[Support] Add MemoryBuffer::getFileSlice()
authorNick Kledzik <kledzik@apple.com>
Wed, 8 Oct 2014 00:22:18 +0000 (00:22 +0000)
committerNick Kledzik <kledzik@apple.com>
Wed, 8 Oct 2014 00:22:18 +0000 (00:22 +0000)
commit52688c3aff57defe144c7a87e3622050ba2d3997
tree4f67b9a85149ccc774c1b6b2635702c2bb98e8ea
parenta29287d90da7b3b37e06345fd50b863b2cf1731a
[Support] Add MemoryBuffer::getFileSlice()

mach-o supports "fat" files which are a header/table-of-contents followed by a
concatenation of mach-o files built for different architectures. Currently,
MemoryBuffer has no easy way to map a subrange (slice) of a file which lld
will need to select a mach-o slice of a fat file. The new function provides
an easy way to map a slice of a file into a MemoryBuffer. Test case included.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219260 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/MemoryBuffer.h
lib/Support/MemoryBuffer.cpp
unittests/Support/MemoryBufferTest.cpp