mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Add MemoryBufferRef(MemoryBuffer&) constructor.
patch by Jonathan Anderson! llvm-svn: 253311
This commit is contained in:
parent
192e197bb7
commit
b080f6e9fc
@ -152,6 +152,8 @@ class MemoryBufferRef {
|
||||
|
||||
public:
|
||||
MemoryBufferRef() {}
|
||||
MemoryBufferRef(MemoryBuffer& Buffer)
|
||||
: Buffer(Buffer.getBuffer()), Identifier(Buffer.getBufferIdentifier()) {}
|
||||
MemoryBufferRef(StringRef Buffer, StringRef Identifier)
|
||||
: Buffer(Buffer), Identifier(Identifier) {}
|
||||
|
||||
|
@ -170,6 +170,15 @@ TEST_F(MemoryBufferTest, getOpenFileReopened) {
|
||||
}
|
||||
|
||||
|
||||
TEST_F(MemoryBufferTest, reference) {
|
||||
OwningBuffer MB(MemoryBuffer::getMemBuffer(data));
|
||||
MemoryBufferRef MBR(*MB);
|
||||
|
||||
EXPECT_EQ(MB->getBufferStart(), MBR.getBufferStart());
|
||||
EXPECT_EQ(MB->getBufferIdentifier(), MBR.getBufferIdentifier());
|
||||
}
|
||||
|
||||
|
||||
TEST_F(MemoryBufferTest, slice) {
|
||||
// Create a file that is six pages long with different data on each page.
|
||||
int FD;
|
||||
|
Loading…
x
Reference in New Issue
Block a user