Skip to content
Commit 07ce1d02 authored by Alp Toker's avatar Alp Toker
Browse files

clang-format: Write files atomically

Switch clang-format over to Rewriter::overwriteChangedFiles().

The previous implementation was attempting to stream back directly to the
original file and failing if it was already memory mapped by MemoryBuffer,
an operation unsupported by Windows.

MemoryBuffer generally mmaps files larger than the physical page size so
this will have been difficult to reproduce consistently.

This change also reduces flicker in code editors and IDEs on all platforms
when reformatting in-place.

Note that other incorrect uses of MemoryBuffer exist in LLVM/clang and
will need a similar fix.

A test should be added for Windows when libFormat performance issues are
fixed (it takes longer than a day to format a 1MB file at present!)

llvm-svn: 194250
parent e994ebda
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment