Rewrite FileOutputBuffer as two separate classes.
authorRui Ueyama <ruiu@google.com>
Wed, 1 Nov 2017 21:38:14 +0000 (21:38 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 1 Nov 2017 21:38:14 +0000 (21:38 +0000)
commit7f53f83a3c23c4c7a1d24a9a8e24d407ad7dcb70
tree0f9de8da9a8a8c9f96c9d0f9c4448104e4133bc5
parent66f724ee92fbae13533ee546109710fcbe799ce4
Rewrite FileOutputBuffer as two separate classes.

This patch is to rewrite FileOutputBuffer as two separate classes;
one for file-backed output buffer and the other for memory-backed
output buffer. I think the new code is easier to follow because two
different implementations are now actually separated as different
classes.

Unlike the previous implementation, the class that does not replace the
final output file using rename(2) does not create a temporary file at
all. Instead, it allocates memory using mmap(2) and use it. I think
this is an improvement because it is now guaranteed that the temporary
memory region doesn't trigger any I/O and there's now zero chance to
leave a temporary file behind. Also, it shouldn't impose new restrictions
because were using mmap IO too.

Differential Revision: https://reviews.llvm.org/D39449

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317127 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/FileOutputBuffer.h
lib/Support/FileOutputBuffer.cpp