]> granicus.if.org Git - clang/commitdiff
Fix unconditional dereference of a WeakVH in CGDebugInfo TypeCache
authorReid Kleckner <reid@kleckner.net>
Tue, 4 Mar 2014 20:51:58 +0000 (20:51 +0000)
committerReid Kleckner <reid@kleckner.net>
Tue, 4 Mar 2014 20:51:58 +0000 (20:51 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202888 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index 35bd57a053158cb7e4d111793b2cc5f6aaba0cde..c91b7a97443033266883851c0cf9ee68d237f3bd 100644 (file)
@@ -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();
 }