On 15 November 2017 at 17:42, Zachary Turner <ztur...@google.com> wrote:
> Can we just extend llvm's mapped_file_region to support a boolean Writable
> flag?
>
mapped_file_region already can be writable. The feature it is missing
is the ability to *not* use mmap. And that's not a good idea, as the
whole purpose of that class is to mmap things.

We could theoretically add a writable flag to llvm::MemoryBuffer,
but's its header says:
/// This interface provides simple ***read-only*** access to a block
of memory, and ...

I am not sure we should be changing that as MemoryBuffers are used all
over the place.

That said, I have found at least two instances in clang where they are
const_casting a MemoryBuffer and writing to it (just like we were),
but this behavior seems to be an exception, and at least one of those
two instances is a huge hack.

In the long run, we probably should have some MemoryBuffer-like class
that is writable, but this I think this need to be considered very
carefully. I am willing do to the work there, but I'd like to fix this
somehow first, as this is a huge regression.
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to