[flang] Replace manual mmap with llvm::MemoryBuffer
The previous code had handling for cases when too many file descriptors may be opened; this is not necessary with MemoryBuffer as the file descriptors are closed after the mapping occurs. MemoryBuffer also internally handles the case where a file is small and therefore an mmap is bad for performance; such files are simply copied to memory after being opened. Many places elsewhere in the code assume that the buffer is not empty, and the old file opening code handles this by replacing an empty file with a buffer containing a single newline. That behavior is now kept in the new MemoryBuffer based code. Original-commit: flang-compiler/f18@d34df8435127d847867e2c0bb157def9f20f4202 Reviewed-on: https://github.com/flang-compiler/f18/pull/1032
Loading
Please sign in to comment