[LLVMdev] MemoryBuffer

Chris Lattner clattner at apple.com
Thu Sep 24 13:32:23 PDT 2009


On Sep 24, 2009, at 1:23 PM, OvermindDL1 wrote:

> I was writing something using MemoryBuffer, and while looking through
> its code I came across line 59:
>  assert(BufEnd[0] == 0 && "Buffer is not null terminated!");
> I am curious if the MemoryBuffer only supports non-binary, non-null
> embedded files, or if it supports binary as well.  I do not see
> anything inherently not expecting binary files except for that one
> line, so I am curious as to the purpose of that assert?

Your question is difficult to understand.  MemoryBuffer doesn't care  
what is in the file.  It works fine if you have embedded nul's in the  
file.  It just requires the mapped image to have a nul at the end.

-Chris



More information about the llvm-dev mailing list