[llvm] r208021 - [Support/MemoryBuffer] Move the IsVolatile check inside shouldUseMmap() and make sure to zero-initialize the rest

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue May 6 08:44:19 PDT 2014


On May 6, 2014, at 8:02 AM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

>> +      assert(IsVolatile && "We got inaccurate FileSize value or fstat reported "
>> +                           "an invalid file size.");
>> +      memset(BufPtr, 0, BytesLeft); // zero-initialize rest of the buffer.
> 
> This can be reached because of uses error, right? Editing a file at
> the right moment while clang is running for example. If that is the
> case, this should probably be a report_fatal_error instead of an
> assert.

Are you saying if IsVolatile is false it should crash the compiler ?
I'm not fond of crashing the compiler because of user actions that we know how to recover from.

> 
> Cheers,
> Rafael





More information about the llvm-commits mailing list