r202888 - Fix unconditional dereference of a WeakVH in CGDebugInfo TypeCache

Reid Kleckner reid at kleckner.net
Tue Mar 4 12:51:58 PST 2014


Author: rnk
Date: Tue Mar  4 14:51:58 2014
New Revision: 202888

URL: http://llvm.org/viewvc/llvm-project?rev=202888&view=rev
Log:
Fix unconditional dereference of a WeakVH in CGDebugInfo TypeCache

This fails an "isa<> used with null pointer" assert during a clang-cl
self-host on Windows.  This was caused by r202769, and I'm currently
reducing a test case.

Reviewers: dblaikie

Differential Revision: http://llvm-reviews.chandlerc.com/D2944

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=202888&r1=202887&r2=202888&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Mar  4 14:51:58 2014
@@ -3341,7 +3341,8 @@ void CGDebugInfo::finalize() {
   // 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();
 }





More information about the cfe-commits mailing list