aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-27 21:28:04 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-27 21:28:04 +0000
commit2bf1eb09f06a9792fa94dff0703f2aa2c4bace2a (patch)
tree36e363b5a565b610b7db58ffbe2ca442c1bb8a22 /lib/Basic/SourceManager.cpp
parent1aee61a7138cd1df44f149528911930ac56819d4 (diff)
Be more careful in our teardown of the PCHReader after deciding to
ignore a PCH file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r--lib/Basic/SourceManager.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 50576636db..9ca00f5823 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -318,6 +318,22 @@ void SourceManager::PreallocateSLocEntries(ExternalSLocEntrySource *Source,
SLocEntryTable.resize(SLocEntryTable.size() + NumSLocEntries);
}
+void SourceManager::ClearPreallocatedSLocEntries() {
+ unsigned I = 0;
+ for (unsigned N = SLocEntryLoaded.size(); I != N; ++I)
+ if (!SLocEntryLoaded[I])
+ break;
+
+ // We've already loaded all preallocated source location entries.
+ if (I == SLocEntryLoaded.size())
+ return;
+
+ // Remove everything from location I onward.
+ SLocEntryTable.resize(I);
+ SLocEntryLoaded.clear();
+ ExternalSLocEntries = 0;
+}
+
//===----------------------------------------------------------------------===//
// Methods to create new FileID's and instantiations.