Second attempt after http://llvm.org/viewvc/llvm-project?rev=296166&view=rev
In the first attempt, Code (the memory buffer backing the input file) was reset before overwriteChangedFiles() was called, but overwriteChangedFiles() still reads from it.
This time, load the whole input file into memory instead of using mmap when formatting in-place.
(Since the test is identical to what was in the repo before chapuni's revert, svn diff doesn't show it – see the above link for the test.)
llvm.org seems to be down, so I cannot access the original patch - but I'm somewhat opposed to making this interface more complex. If we have a coupling of MemoryBuffer to the Rewriter, can we make that explicit instead?