[cfe-commits] r120032 - in /cfe/trunk/lib/Basic: FileManager.cpp FileSystemStatCache.cpp

Chris Lattner sabre at nondot.org
Tue Nov 23 11:38:22 PST 2010


Author: lattner
Date: Tue Nov 23 13:38:22 2010
New Revision: 120032

URL: http://llvm.org/viewvc/llvm-project?rev=120032&view=rev
Log:
r120013 dropped passing in the precomputed file size to 
MemoryBuffer::getFile, causing us to pick up a fstat for
every file.  Restore the optimization.


Modified:
    cfe/trunk/lib/Basic/FileManager.cpp
    cfe/trunk/lib/Basic/FileSystemStatCache.cpp

Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=120032&r1=120031&r2=120032&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Tue Nov 23 13:38:22 2010
@@ -394,11 +394,12 @@
 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::

Modified: cfe/trunk/lib/Basic/FileSystemStatCache.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileSystemStatCache.cpp?rev=120032&r1=120031&r2=120032&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileSystemStatCache.cpp (original)
+++ cfe/trunk/lib/Basic/FileSystemStatCache.cpp Tue Nov 23 13:38:22 2010
@@ -24,7 +24,6 @@
   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





More information about the cfe-commits mailing list