Make platform-specific mmap flags the exception. (#1929)

MAP_POPULATE is a Linux mmap flag that optionally assists read-ahead on
the mapping. It is nonstandard and omission does not affect the
underlying mapping, so fall back to not including the flag, rather than
the reverse.
This commit is contained in:
3405691582
2022-08-08 16:38:02 -07:00
committed by GitHub
parent 21d39ef4f9
commit 7147ea0144
+3 -3
View File
@@ -79,10 +79,10 @@ auto SourceBuffer::CreateFromFile(llvm::StringRef filename)
errno = 0;
void* mapped_text = mmap(nullptr, size, PROT_READ,
#ifdef __APPLE__
MAP_PRIVATE,
#else
#if defined(__linux__)
MAP_PRIVATE | MAP_POPULATE,
#else
MAP_PRIVATE,
#endif
file_descriptor, /*offset=*/0);
// The `MAP_FAILED` macro may expand to a cast to pointer that `clang-tidy`