Another improvement to the implementation of .incbin directive by avoiding a

buffer copy.  Suggestion by Chris Lattner!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146614 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby 2011-12-15 00:00:27 +00:00
parent 10e412ec6b
commit dac2953e3b

View File

@ -443,11 +443,8 @@ bool AsmParser::ProcessIncbinFile(const std::string &Filename) {
return true;
// Pick up the bytes from the file and emit them.
const char *BufferStart = SrcMgr.getMemoryBuffer(NewBuf)->getBufferStart();
size_t BufferSize = SrcMgr.getMemoryBuffer(NewBuf)->getBufferSize();
std::string Data(BufferStart, BufferSize);
getStreamer().EmitBytes(Data, DEFAULT_ADDRSPACE);
getStreamer().EmitBytes(SrcMgr.getMemoryBuffer(NewBuf)->getBuffer(),
DEFAULT_ADDRSPACE);
return false;
}