From c4030638e65146f757e82979caf8ca3e16064277 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 4 Mar 2014 20:51:58 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202888 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 35bd57a053..c91b7a9744 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -3341,7 +3341,8 @@ void CGDebugInfo::finalize() { // up the final type in the type cache. for (std::vector::const_iterator RI = RetainedTypes.begin(), RE = RetainedTypes.end(); RI != RE; ++RI) - DBuilder.retainType(llvm::DIType(cast(TypeCache[*RI]))); + if (llvm::Value *V = TypeCache[*RI]) + DBuilder.retainType(llvm::DIType(cast(V))); DBuilder.finalize(); } -- 2.40.0