aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-12-15 23:37:55 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-12-15 23:37:55 +0000
commitaf41b3f0f2604c1e17be9f0caefe2fd546cf6d7d (patch)
treec68292af14bc23e2f3f3a9aca759dd4ee9376853 /clang/lib/Basic/SourceManager.cpp
parent06bb7988032509e5208c37c73871e83361f9c0f7 (diff)
downloadllvm-af41b3f0f2604c1e17be9f0caefe2fd546cf6d7d.zip
llvm-af41b3f0f2604c1e17be9f0caefe2fd546cf6d7d.tar.gz
llvm-af41b3f0f2604c1e17be9f0caefe2fd546cf6d7d.tar.bz2
In SourceManager::~SourceManager do a sanity check to make sure we
don't try to destruct a null ContentCache. rdar://10567159 llvm-svn: 146707
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 18026db..5221ed4 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -382,13 +382,17 @@ SourceManager::~SourceManager() {
// content cache objects are bump pointer allocated, we just have to run the
// dtors, but we call the deallocate method for completeness.
for (unsigned i = 0, e = MemBufferInfos.size(); i != e; ++i) {
- MemBufferInfos[i]->~ContentCache();
- ContentCacheAlloc.Deallocate(MemBufferInfos[i]);
+ if (MemBufferInfos[i]) {
+ MemBufferInfos[i]->~ContentCache();
+ ContentCacheAlloc.Deallocate(MemBufferInfos[i]);
+ }
}
for (llvm::DenseMap<const FileEntry*, SrcMgr::ContentCache*>::iterator
I = FileInfos.begin(), E = FileInfos.end(); I != E; ++I) {
- I->second->~ContentCache();
- ContentCacheAlloc.Deallocate(I->second);
+ if (I->second) {
+ I->second->~ContentCache();
+ ContentCacheAlloc.Deallocate(I->second);
+ }
}
delete FakeBufferForRecovery;