aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-19 20:17:48 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-19 20:17:48 +0000
commit65f13c3381a31eae8a7219477c37c247ac9838fc (patch)
tree2ad249f246ce63e4a8173f6fc878ca2cb0b830b8 /lib/CodeGen/CGDebugInfo.cpp
parent0d36dd28bb40b08a93d7f64196794882eee08ee8 (diff)
Ok, an AssertingVH definitely doesn't work for now because we free our cache after the optimizer may have hacked on the module. Use a WeakVH instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index e1dca0e483..1bd0918f1a 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -752,10 +752,13 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
return llvm::DIType();
// Check for existing entry.
- std::map<void *, llvm::AssertingVH<llvm::MDNode> >::iterator it =
+ std::map<void *, llvm::WeakVH>::iterator it =
TypeCache.find(Ty.getAsOpaquePtr());
- if (it != TypeCache.end())
- return llvm::DIType(it->second);
+ if (it != TypeCache.end()) {
+ // Verify that the debug info still exists.
+ if (&*it->second)
+ return llvm::DIType(cast<llvm::MDNode>(it->second));
+ }
// Otherwise create the type.
llvm::DIType Res = CreateTypeNode(Ty, Unit);