[llvm] [Support] Add mapped_file_region::sync(), equivalent to msync (PR #153632)

Steven Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 10:49:30 PDT 2025


cachemeifyoucan wrote:

I did some simplification of the original PR. Will be good to have some windows expert to comment.

* I am not sure if `FlushFileBuffers` is needed for `sync`
* Update test to use `TempFile`

Some comments from origin PR:
> (2) that the test be shown to fail without the msync call.
I don't think this is possible since there are OS will just flush in background regardless of explicit sync or not. The only thing that we care about is the file on disk is updated after sync (and the best we can do is to read through file I/O, but OS can still keep a cached version but that will be a bug on OS).


https://github.com/llvm/llvm-project/pull/153632


More information about the llvm-commits mailing list