[cfe-commits] r82324 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h
Daniel Dunbar
daniel at zuster.org
Sat Sep 19 13:17:49 PDT 2009
Author: ddunbar
Date: Sat Sep 19 15:17:48 2009
New Revision: 82324
URL: http://llvm.org/viewvc/llvm-project?rev=82324&view=rev
Log:
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.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=82324&r1=82323&r2=82324&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sat Sep 19 15:17:48 2009
@@ -752,10 +752,13 @@
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);
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=82324&r1=82323&r2=82324&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Sat Sep 19 15:17:48 2009
@@ -49,7 +49,7 @@
/// 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;
More information about the cfe-commits
mailing list