diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-01 06:05:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-01 06:05:21 +0000 |
commit | 5f449e3b515e53951315dc113172d91755775319 (patch) | |
tree | d87f943e29eaabf9e204fd2ab8af186183e915e9 /lib/Support/GraphWriter.cpp | |
parent | 157d70a3dff983450542757d5ddba1da3375589d (diff) | |
download | external_llvm-5f449e3b515e53951315dc113172d91755775319.zip external_llvm-5f449e3b515e53951315dc113172d91755775319.tar.gz external_llvm-5f449e3b515e53951315dc113172d91755775319.tar.bz2 |
Reimplement MemoryBuffer::getFile with three enhancements:
1) stop using MappedFile.
2) if profitable use the sys::path::MapInFilePages api to
read the file.
3) otherwise fallback to read.
When sys::path::MapInFilePages is implemented, this provides
several benefits:
#1: this avoids fragmenting memory for small files.
#2: this avoids extraneous stat calls when the file size is known.
#3: this only keeps the file descriptor open while reading the
file, not for the duration of the lifetime of the memory
buffer. This fixes a serious clang FD 'leak' problem.
I believe that this will work on a win32 machine, but I don't have
one to test on. I'd appreciate it if someone could check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/GraphWriter.cpp')
0 files changed, 0 insertions, 0 deletions