diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-15 23:37:55 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-15 23:37:55 +0000 |
commit | 99ee0851015f0d334fa319c4ab9e14869520ebe5 (patch) | |
tree | febaa9f9e7c688e549c957da3f1c456122b3c48a /lib/Basic/SourceManager.cpp | |
parent | 7c1f1f158205efd07ab169772079ab527aed34dc (diff) |
In SourceManager::~SourceManager do a sanity check to make sure we
don't try to destruct a null ContentCache.
rdar://10567159
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146707 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r-- | lib/Basic/SourceManager.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index 18026dbdb7..5221ed49aa 100644 --- a/lib/Basic/SourceManager.cpp +++ b/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; |