From 2bf1eb09f06a9792fa94dff0703f2aa2c4bace2a Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 27 Apr 2009 21:28:04 +0000 Subject: 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 --- lib/Basic/SourceManager.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/Basic/SourceManager.cpp') 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. -- cgit v1.2.3-18-g5258