aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-23 19:38:22 +0000
committerChris Lattner <sabre@nondot.org>2010-11-23 19:38:22 +0000
commitf8f6129861f3972dab2c5a6cde29711ac780a7d0 (patch)
treebd04b96ceb59c6bc705551d490d5c8eca32abd10 /lib/Basic/FileManager.cpp
parent74e976ba4b0d407bb798ea26476f618e256fc8c7 (diff)
r120013 dropped passing in the precomputed file size to
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
Diffstat (limited to 'lib/Basic/FileManager.cpp')
-rw-r--r--lib/Basic/FileManager.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp
index 9572aaadb7..b884388c0b 100644
--- a/lib/Basic/FileManager.cpp
+++ b/lib/Basic/FileManager.cpp
@@ -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::