[llvm-commits] [patch] Switch LTO to use MC

Chris Lattner clattner at apple.com
Sun Feb 27 11:47:02 PST 2011


On Feb 27, 2011, at 8:55 AM, Rafael Ávila de Espíndola wrote:

>>> 
>>> Yes, I just need a way to represent MemoryBuffers that are not NULL
>>> terminated :-)
>> 
>> I agree that having null termination be optional would be useful.
>> Clang really wants this (to make its lexer faster) but I don't think
>> anyone else cares.  I'd be fine with eliminating this requirement in
>> the MemBuffer API and giving MemoryBuffer::getFileOrSTDIN a flags
>> argument, where one flag would be "RequiresNullTerminatedBuffer" or
>> something like that.
> 
> OK, I will give that a try. I would probably still wrap MemoryBuffer in a ZMemoryBuffer that just sets RequiresNullTerminatedBuffer to true so that people don't accidentally pass the wrong type of buffer to the lexer.

I think it would be perfectly fine to just have the lexer assert that it is nul terminated.

The reason I mentioned adding a flag to the file open APIs is that MemoryBuffer does an optimization for the mmap case, when the file is not a multiple of a page size: it just knows the OS zero fills the rest of the mapped page.

-Chris



More information about the llvm-commits mailing list