OSDN Git Service

[Support] Add WritableMemoryBuffer::getNewMemBuffer
authorPavel Labath <labath@google.com>
Tue, 9 Jan 2018 17:26:06 +0000 (17:26 +0000)
committerPavel Labath <labath@google.com>
Tue, 9 Jan 2018 17:26:06 +0000 (17:26 +0000)
commit861f6eb24913a7a036d3723b7588d2f66767f8af
tree9a565fc52ae3d9aa9251a2539fbb375a8c04bee9
parent4f407a2b19a3fc9c3c93b3450d01574b2ef898ed
[Support] Add WritableMemoryBuffer::getNewMemBuffer

Summary:
The idea is that it would replace
(non-Writable)MemoryBuffer::getNewMemBuffer, which is quite useless
unless you const_cast its contents to write to it (which all (both)
callers of this function were doing). This patch also fixes one of the usages in
COFFWriter. After fixing the other usage in clang, I plan to delete the old
function.

Reviewers: dblaikie, Bigcheese

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D41540

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322094 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/MemoryBuffer.h
lib/Object/WindowsResource.cpp
lib/Support/MemoryBuffer.cpp
unittests/Support/MemoryBufferTest.cpp