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 | a542518315c1200b35ac17a90c5c7d560d42ef14 (patch) | |
tree | d6dd8c065994acd6c056d2766c3c758240807dc8 /clang/lib/Basic/SourceManager.cpp | |
parent | 3089e1d82e7560026831296b78b079bfce7dde19 (diff) | |
download | bcm5719-llvm-a542518315c1200b35ac17a90c5c7d560d42ef14.tar.gz bcm5719-llvm-a542518315c1200b35ac17a90c5c7d560d42ef14.zip |
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.
llvm-svn: 49031
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions