diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-23 06:09:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-23 06:09:11 +0000 |
commit | 151466a18671df9cfd9abd59ba53df35b1d687da (patch) | |
tree | 0a2fca61f9f12fa1058b53442022bab26122ea1d /include/clang/Basic/FileManager.h | |
parent | 8e161ed8e63bd9d3783a987d837b72b2b96c4512 (diff) |
Partially revert Doug's PCH validation patch (r98585).
This patch completely defeated the "passing in a prestat'd size
to MemoryBuffer" optimization, leading to an extra fstat call for
every buffer opened, in order to find out if the datestamp and size
of the file on disk matches what is in the stat cache.
I fully admit that I don't completely understand what is going on here:
why punish code when a stat cache isn't in use? what is the point of a
stat cache if you have to turn around and stat stuff to validate it?
To resolve both these issues, just drop the modtime check and check the
file size, which is the important thing anyway. This should also resolve
PR6812, because presumably windows is stable when it comes to file sizes.
If the modtime is actually important, we should get it and keep it on the
first stat.
This eliminates 833 fstat syscalls when processing Cocoa.h, speeding up
system time on -Eonly Cocoa.h from 0.041 to 0.038s.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120001 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/FileManager.h')
-rw-r--r-- | include/clang/Basic/FileManager.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index 3ee7d40c1e..77eb1f4d1e 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -216,16 +216,14 @@ public: /// MemoryBuffer if successful, otherwise returning null. llvm::MemoryBuffer *getBufferForFile(const FileEntry *Entry, const FileSystemOptions &FileSystemOpts, - std::string *ErrorStr = 0, - struct stat *FileInfo = 0) { + std::string *ErrorStr = 0) { return getBufferForFile(Entry->getName(), FileSystemOpts, - ErrorStr, Entry->getSize(), FileInfo); + ErrorStr, Entry->getSize()); } llvm::MemoryBuffer *getBufferForFile(llvm::StringRef Filename, const FileSystemOptions &FileSystemOpts, std::string *ErrorStr = 0, - int64_t FileSize = -1, - struct stat *FileInfo = 0); + int64_t FileSize = -1); /// \brief If path is not absolute and FileSystemOptions set the working /// directory, the path is modified to be relative to the given |