summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-26 07:37:49 +0000
committerChris Lattner <sabre@nondot.org>2009-01-26 07:37:49 +0000
commit43a85b1e4c8d72b6f49cb6c0f2eefbb0b852d3f1 (patch)
treead787e5247fb97a2911956b9b5a17e556b57cd29
parent3975bbec587a7b536ba76d8c8a3ca3cfe61d629b (diff)
downloadbcm5719-llvm-43a85b1e4c8d72b6f49cb6c0f2eefbb0b852d3f1.tar.gz
bcm5719-llvm-43a85b1e4c8d72b6f49cb6c0f2eefbb0b852d3f1.zip
Lazily paging in file contents is a big win for PTH, strip out the old
testing code. llvm-svn: 63006
-rw-r--r--clang/lib/Basic/SourceManager.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index e30e2a81315..fcca97774df 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -28,12 +28,6 @@ using llvm::MemoryBuffer;
// SourceManager Helper Classes
//===--------------------------------------------------------------------===//
-// This (temporary) directive toggles between lazy and eager creation of
-// MemBuffers. This directive is not permanent, and is here to test a few
-// potential optimizations in PTH. Once it is clear whether eager or lazy
-// creation of MemBuffers is better this directive will get removed.
-#define LAZY
-
ContentCache::~ContentCache() {
delete Buffer;
delete [] SourceLineCache;
@@ -54,15 +48,13 @@ unsigned ContentCache::getSize() const {
return Entry ? Entry->getSize() : Buffer->getBufferSize();
}
-const llvm::MemoryBuffer* ContentCache::getBuffer() const {
-#ifdef LAZY
+const llvm::MemoryBuffer *ContentCache::getBuffer() const {
// Lazily create the Buffer for ContentCaches that wrap files.
if (!Buffer && Entry) {
// FIXME: Should we support a way to not have to do this check over
// and over if we cannot open the file?
Buffer = MemoryBuffer::getFile(Entry->getName(), 0, Entry->getSize());
}
-#endif
return Buffer;
}
@@ -83,18 +75,8 @@ SourceManager::getOrCreateContentCache(const FileEntry *FileEnt) {
if (I != FileInfos.end() && I->Entry == FileEnt)
return &*I;
- // Nope, get information.
-#ifndef LAZY
- const MemoryBuffer *File =
- MemoryBuffer::getFile(FileEnt->getName(), 0, FileEnt->getSize());
- if (File == 0)
- return 0;
-#endif
-
+ // Nope, create a new Cache entry.
ContentCache& Entry = const_cast<ContentCache&>(*FileInfos.insert(I,FileEnt));
-#ifndef LAZY
- Entry.setBuffer(File);
-#endif
Entry.SourceLineCache = 0;
Entry.NumLines = 0;
return &Entry;
OpenPOWER on IntegriCloud