summaryrefslogtreecommitdiffstats
path: root/clang/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
commit0bc1293584cc02a83f57762098a9622f541f3b84 (patch)
tree96b2fade40882164aa87ab678fd1fed80eaf288e /clang/lib/Basic/SourceManager.cpp
parent1f1e1c7e393fe8ff1dc12357b24d9b145af3ff04 (diff)
downloadbcm5719-llvm-0bc1293584cc02a83f57762098a9622f541f3b84.tar.gz
bcm5719-llvm-0bc1293584cc02a83f57762098a9622f541f3b84.zip
Be more careful in our teardown of the PCHReader after deciding to
ignore a PCH file. llvm-svn: 70251
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 50576636db3..9ca00f5823d 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud