diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-29 19:11:22 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-29 19:11:22 +0000 |
commit | c7f485fd717e02d9d7a59b149acf2abb6ce00770 (patch) | |
tree | 2f8715d8e4426e0b2f9c91d55b88791529c3b2cf | |
parent | 200c6f9c3df13173717add8b4fa802447bca17ea (diff) | |
download | bcm5719-llvm-c7f485fd717e02d9d7a59b149acf2abb6ce00770.tar.gz bcm5719-llvm-c7f485fd717e02d9d7a59b149acf2abb6ce00770.zip |
Use the stat information in the Path object, if it is already obtained. This
avoids a call to ::fstat by MappedFile when the file size information was
already obtained by the Path object.
llvm-svn: 35477
-rw-r--r-- | llvm/lib/System/Unix/MappedFile.inc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/System/Unix/MappedFile.inc b/llvm/lib/System/Unix/MappedFile.inc index 4dccd138c1e..5e76e2bc26a 100644 --- a/llvm/lib/System/Unix/MappedFile.inc +++ b/llvm/lib/System/Unix/MappedFile.inc @@ -54,15 +54,14 @@ bool MappedFile::initialize(std::string* ErrMsg) { MakeErrMsg(ErrMsg, "can't open file '" + path_.toString() + "'"); return true; } - struct stat sbuf; - if(::fstat(FD, &sbuf) < 0) { - MakeErrMsg(ErrMsg, "can't stat file '"+ path_.toString() + "'"); + const FileStatus *Status = path_.getFileStatus(false, ErrMsg); + if (!Status) { ::close(FD); return true; } info_ = new MappedFileInfo; info_->FD = FD; - info_->Size = sbuf.st_size; + info_->Size = Status->getSize(); return false; } |