[llvm] r208007 - [Support/MemoryBuffer] Introduce a boolean parameter (false by default) 'IsVolatile' for the open file functions.
rafael.espindola at gmail.com
Mon May 5 17:13:03 PDT 2014
> The problem is not the data itself, the problem is that mmap may leave the buffer without a null terminator, because the file size changed by the time mmap brings in the last page.
> Initializing the memory with read/pread has no such issue, the null terminator is guaranteed.
This should be in a comment. Maybe it might be a good idea to change
the flag name to VolatileSize to make it clear what is being guarded
against? Do you have to handle the file shirking while it is being
read? I don't think the existing code handles that.
>> What is the intended use case for this?
> libclang passes isVolatile = true for user files, because it has to deal with user files constantly getting edited/updated while trying parse them.
And probably this too as an example.
More information about the llvm-commits