]> granicus.if.org Git - clang/commitdiff
Ok, an AssertingVH definitely doesn't work for now because we free our cache after...
authorDaniel Dunbar <daniel@zuster.org>
Sat, 19 Sep 2009 20:17:48 +0000 (20:17 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 19 Sep 2009 20:17:48 +0000 (20:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82324 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h

index e1dca0e483fa6ef3a5e137153ff51d6cd08db94d..1bd0918f1ad0f3c4a6d93e1a74c1cdee7402b38f 100644 (file)
@@ -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);
index d0f0731d6b2f5fd6ec1b4b1fa74c5faa151c10b7..b796b1e97ce154b5e5d7f3902c859e07aabb1bf4 100644 (file)
@@ -49,7 +49,7 @@ class CGDebugInfo {
 
   /// TypeCache - Cache of previously constructed Types.
   // FIXME: Eliminate this map.  Be careful of iterator invalidation.
-  std::map<void *, llvm::AssertingVH<llvm::MDNode> > TypeCache;
+  std::map<void *, llvm::WeakVH> TypeCache;
 
   bool BlockLiteralGenericSet;
   llvm::DIType BlockLiteralGeneric;