[PATCH] D40291: [Support] Add WritableMemoryBuffer class

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 07:08:25 PST 2017


labath updated this revision to Diff 127356.
labath added a comment.

Make WritableMemoryBuffer inherit from MemoryBuffer and use template-base-class
pattern on the two implementations.

I still have a slight feeling that using templates this way is wrong, but I must
admit that the overall result looks much nicer than I expected. In particular,
the fact that WritableMemoryBuffer inherits from the plain one allows us to
remove some const_casts (a couple of them in this patch, and a few more can be
done as a follow-up).


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.127356.patch
Type: text/x-patch
Size: 16816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171218/477723e1/attachment.bin>


More information about the llvm-commits mailing list