]> granicus.if.org Git - clang/commitdiff
r120013 dropped passing in the precomputed file size to
authorChris Lattner <sabre@nondot.org>
Tue, 23 Nov 2010 19:38:22 +0000 (19:38 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 23 Nov 2010 19:38:22 +0000 (19:38 +0000)
MemoryBuffer::getFile, causing us to pick up a fstat for
every file.  Restore the optimization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120032 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/FileManager.cpp
lib/Basic/FileSystemStatCache.cpp

index 9572aaadb7a7dc68d501d6b6bb912065d7b98214..b884388c0b5eb3ae79226cbfe931d1921d90f3b3 100644 (file)
@@ -394,11 +394,12 @@ llvm::MemoryBuffer *FileManager::
 getBufferForFile(const FileEntry *Entry, std::string *ErrorStr) {
   llvm::StringRef Filename = Entry->getName();
   if (FileSystemOpts.WorkingDir.empty())
-    return llvm::MemoryBuffer::getFile(Filename, ErrorStr);
+    return llvm::MemoryBuffer::getFile(Filename, ErrorStr, Entry->getSize());
   
   llvm::sys::Path FilePath(Filename);
   FixupRelativePath(FilePath, FileSystemOpts);
-  return llvm::MemoryBuffer::getFile(FilePath.c_str(), ErrorStr);
+  return llvm::MemoryBuffer::getFile(FilePath.c_str(), ErrorStr,
+                                     Entry->getSize());
 }
 
 llvm::MemoryBuffer *FileManager::
index 3e13740caba8ced24d75d88d9cee3511e6d0eb0a..738af41a9eeb6c1d3848798e225229cbc55fba18 100644 (file)
@@ -24,7 +24,6 @@ MemorizeStatCalls::getStat(const char *Path, struct stat &StatBuf) {
   if (Result == CacheMiss)
     Result = ::stat(Path, &StatBuf) ? CacheHitMissing : CacheHitExists;
   
-  
   // Do not cache failed stats, it is easy to construct common inconsistent
   // situations if we do, and they are not important for PCH performance (which
   // currently only needs the stats to construct the initial FileManager