I'm explicitly not including llvm-commits on here because this patch isn't done. Unfortunately I have to switch gears because something high priority came up. You're welcome to finish this up if you want, otherwise I won't hold up the patch on the LLDB side. The quirk that I ran into is that llvm::sys::fs::openFileForWrite() does not have correct semantics when the file already exists. Currently it always overwrites the file. Fixing this is more work than I have time for at the moment :(
I might come back to this later if you don't feel up to it, but you're welcome to move forward with the LLDB patch to unblock yourself.