[PATCH] D40291: [Support] Add WritableMemoryBuffer class
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 5 02:10:47 PST 2017
labath updated this revision to Diff 125484.
labath added a comment.
I've added a MemoryBufferRef (which is what most APIs accept) constructor that
takes a WritableMemoryBuffer. Since MemoryBufferRef (as well as MemoryBuffer)
operates with StringRefs, but WritableMemoryBuffer uses
(Mutable)ArrayRef<uint8_t> (I think was done because there is no equivalent to
MutableStringRef and having MutableArrayRef+StringRef combo would be weird),
I've also added a WritableMemoryBuffer::getBufferAsStringRef().
Let me know what you think.
FWIW, I think having a "const MemoryBuffer" mean read-only would not be so bad,
as this class isn't nearly as widespread as ArrayRef.
https://reviews.llvm.org/D40291
Files:
include/llvm/Support/MemoryBuffer.h
lib/Support/MemoryBuffer.cpp
unittests/Support/MemoryBufferTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40291.125484.patch
Type: text/x-patch
Size: 11084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171205/0961f046/attachment.bin>
More information about the llvm-commits
mailing list