diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-11-29 18:16:10 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-11-29 18:16:10 +0000 |
commit | 1f6efa3996dd1929fbc129203ce5009b620e6969 (patch) | |
tree | 6b782914982f90d3a983bcefef98b8ef68ab2961 /lib/Support/MemoryBuffer.cpp | |
parent | 9363f739cdc3bd02e8516a25de0090f52ae12fbb (diff) |
Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/MemoryBuffer.cpp')
-rw-r--r-- | lib/Support/MemoryBuffer.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index 5b701a5c60..07a5ed478c 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -15,10 +15,10 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/MathExtras.h" -#include "llvm/System/Errno.h" -#include "llvm/System/Path.h" -#include "llvm/System/Process.h" -#include "llvm/System/Program.h" +#include "llvm/Support/Errno.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/Process.h" +#include "llvm/Support/Program.h" #include <cassert> #include <cstdio> #include <cstring> @@ -203,14 +203,14 @@ MemoryBuffer *MemoryBuffer::getFile(const char *Filename, std::string *ErrStr, if (ErrStr) *ErrStr = sys::StrError(); return 0; } - + return getOpenFile(FD, Filename, ErrStr, FileSize); } - + MemoryBuffer *MemoryBuffer::getOpenFile(int FD, const char *Filename, std::string *ErrStr, int64_t FileSize) { FileCloser FC(FD); // Close FD on return. - + // If we don't know the file size, use fstat to find out. fstat on an open // file descriptor is cheaper than stat on a random path. if (FileSize == -1) { @@ -222,8 +222,8 @@ MemoryBuffer *MemoryBuffer::getOpenFile(int FD, const char *Filename, } FileSize = FileInfo.st_size; } - - + + // If the file is large, try to use mmap to read it in. We don't use mmap // for small files, because this can severely fragment our address space. Also // don't try to map files that are exactly a multiple of the system page size, |