diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-12-12 18:13:23 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-12-12 18:13:23 +0000 |
| commit | c69f13bfe1b7c0f663ea204f6e961d669f4bab02 (patch) | |
| tree | 799e8c7483b1f2a83d663ee849f6a473ceb41204 /llvm/lib/Support/Unix/Path.inc | |
| parent | 555a7a6ad2267c196993839930e962588a1f62d0 (diff) | |
| download | bcm5719-llvm-c69f13bfe1b7c0f663ea204f6e961d669f4bab02.tar.gz bcm5719-llvm-c69f13bfe1b7c0f663ea204f6e961d669f4bab02.zip | |
Move the resize file feature from mapped_file_region to the only user.
This removes a duplicated stat on every file that llvm-ar looks at.
llvm-svn: 224138
Diffstat (limited to 'llvm/lib/Support/Unix/Path.inc')
| -rw-r--r-- | llvm/lib/Support/Unix/Path.inc | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 75bcc03bbd3..bd6a605a93d 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -414,19 +414,7 @@ std::error_code setLastModificationAndAccessTime(int FD, TimeValue Time) { std::error_code mapped_file_region::init(int FD, uint64_t Offset, mapmode Mode) { - // Figure out how large the file is. - struct stat FileInfo; - if (fstat(FD, &FileInfo) == -1) - return std::error_code(errno, std::generic_category()); - uint64_t FileSize = FileInfo.st_size; - - if (Size == 0) - Size = FileSize; - else if (FileSize < Size) { - // We need to grow the file. - if (ftruncate(FD, Size) == -1) - return std::error_code(errno, std::generic_category()); - } + assert(Size != 0); int flags = (Mode == readwrite) ? MAP_SHARED : MAP_PRIVATE; int prot = (Mode == readonly) ? PROT_READ : (PROT_READ | PROT_WRITE); |

