diff options
author | Kevin Enderby <enderby@apple.com> | 2011-12-14 22:34:45 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2011-12-14 22:34:45 +0000 |
commit | c3fc3136a1760601458267163ea0fe6d7e4af72b (patch) | |
tree | 5551b5fa9f745cc4abf4a534f2c68ef5055323e4 /lib/MC/MCParser | |
parent | 19154f457696f286b4a597179fa07e3b38ea0310 (diff) | |
download | external_llvm-c3fc3136a1760601458267163ea0fe6d7e4af72b.zip external_llvm-c3fc3136a1760601458267163ea0fe6d7e4af72b.tar.gz external_llvm-c3fc3136a1760601458267163ea0fe6d7e4af72b.tar.bz2 |
Improve the implementation of .incbin directive by replacing a loop by using
getStreamer().EmitBytes. Suggestion by Benjamin Kramer!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 9349237..4ab60c1 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -442,11 +442,11 @@ bool AsmParser::ProcessIncbinFile(const std::string &Filename) { if (NewBuf == -1) return true; - // Loop picking the bytes from the file and emitting them. + // Pick up the bytes from the file and emit them. const char *BufferStart = SrcMgr.getMemoryBuffer(NewBuf)->getBufferStart(); - const char *BufferEnd = SrcMgr.getMemoryBuffer(NewBuf)->getBufferEnd(); - for(const char *p = BufferStart; p < BufferEnd; p++) - getStreamer().EmitIntValue(*p, 1, DEFAULT_ADDRSPACE); + size_t BufferSize = SrcMgr.getMemoryBuffer(NewBuf)->getBufferSize(); + std::string Data(BufferStart, BufferSize); + getStreamer().EmitBytes(Data, DEFAULT_ADDRSPACE); return false; } |