summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-23 06:09:11 +0000
committerChris Lattner <sabre@nondot.org>2010-11-23 06:09:11 +0000
commit4ac569b2c6b0ee6deba48242bcf6c7c0f0480651 (patch)
tree560005dc84fe38f00603e57095bdffff59f3bdde /clang/lib/Basic/FileManager.cpp
parent0c71f6c5d3a197240b53f92f161055077861a2e6 (diff)
downloadbcm5719-llvm-4ac569b2c6b0ee6deba48242bcf6c7c0f0480651.tar.gz
bcm5719-llvm-4ac569b2c6b0ee6deba48242bcf6c7c0f0480651.zip
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. llvm-svn: 120001
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r--clang/lib/Basic/FileManager.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index e5ec545f16a..c8515a356bc 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -399,15 +399,13 @@ void FileManager::FixupRelativePath(llvm::sys::Path &path,
llvm::MemoryBuffer *FileManager::
getBufferForFile(llvm::StringRef Filename,
const FileSystemOptions &FileSystemOpts,
- std::string *ErrorStr, int64_t FileSize,
- struct stat *FileInfo) {
+ std::string *ErrorStr, int64_t FileSize) {
if (FileSystemOpts.WorkingDir.empty())
- return llvm::MemoryBuffer::getFile(Filename, ErrorStr, FileSize, FileInfo);
+ return llvm::MemoryBuffer::getFile(Filename, ErrorStr, FileSize);
llvm::sys::Path FilePath(Filename);
FixupRelativePath(FilePath, FileSystemOpts);
- return llvm::MemoryBuffer::getFile(FilePath.c_str(), ErrorStr,
- FileSize, FileInfo);
+ return llvm::MemoryBuffer::getFile(FilePath.c_str(), ErrorStr, FileSize);
}
int FileManager::stat_cached(const char *path, struct stat *buf,
OpenPOWER on IntegriCloud