[PATCH] D40291: [Support] Add WritableMemoryBuffer class

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 19:05:05 PST 2017


dblaikie accepted this revision.
dblaikie added a comment.

Good for me - addressing/removing the base class & type traits test before committing.



================
Comment at: lib/Support/MemoryBuffer.cpp:99-100
 
-  BufferKind getBufferKind() const override {
-    return MemoryBuffer_Malloc;
+  typename MB::BufferKind getBufferKind() const override {
+    return MB::MemoryBuffer_Malloc;
   }
----------------
Could potentially qualify these (& the MB::init above) as MemoryBuffer::* since we know that's the ultimate base that has these functions?


================
Comment at: lib/Support/MemoryBuffer.cpp:201-203
+            std::is_same<MB, WritableMemoryBuffer>::value
+                ? sys::fs::mapped_file_region::priv
+                : sys::fs::mapped_file_region::readonly,
----------------
That seems a bit tricky - perhaps this should be a property of the MemoryBuffer class instead? (a static const member or the like?)


https://reviews.llvm.org/D40291





More information about the llvm-commits mailing list