[PATCH] Fix unconditional dereference of a WeakVH in CGDebugInfo TypeCache
Reid Kleckner
rnk at google.com
Tue Mar 4 10:37:14 PST 2014
Hi dblaikie,
This fails during a clang-cl self-host on Windows on
MachineLoopInfo.cpp. I don't understand why. I assume a recent change
caused it, but I haven't isolated which one. However, this change by
itself appears correct, since the earlier code uses null checks after
WeakVH loads.
http://llvm-reviews.chandlerc.com/D2944
Files:
lib/CodeGen/CGDebugInfo.cpp
Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -3341,7 +3341,8 @@
// up the final type in the type cache.
for (std::vector<void *>::const_iterator RI = RetainedTypes.begin(),
RE = RetainedTypes.end(); RI != RE; ++RI)
- DBuilder.retainType(llvm::DIType(cast<llvm::MDNode>(TypeCache[*RI])));
+ if (llvm::Value *V = TypeCache[*RI])
+ DBuilder.retainType(llvm::DIType(cast<llvm::MDNode>(V)));
DBuilder.finalize();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2944.1.patch
Type: text/x-patch
Size: 568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140304/563f15a4/attachment.bin>
More information about the cfe-commits
mailing list