From 178a7e9255d74a221ba860b9a5da68ab968a30d8 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 27 Mar 2015 22:58:05 +0000 Subject: [PATCH] DebugInfo: Don't call DIBuilder::retainType(nullptr) An upcoming LLVM commit will make calling `DIBuilder::retainType(nullptr)` illegal (actually, it already was, but it wasn't verified). Check for null before calling. This triggered in test/CodeGenObjC/debug-info-block-helper.m. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233443 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 186c522517..1e30cb69bb 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -3432,7 +3432,8 @@ void CGDebugInfo::finalize() { void CGDebugInfo::EmitExplicitCastType(QualType Ty) { if (CGM.getCodeGenOpts().getDebugInfo() < CodeGenOptions::LimitedDebugInfo) return; - llvm::DIType DieTy = getOrCreateType(Ty, getOrCreateMainFile()); - // Don't ignore in case of explicit cast where it is referenced indirectly. - DBuilder.retainType(DieTy); + + if (llvm::DIType DieTy = getOrCreateType(Ty, getOrCreateMainFile())) + // Don't ignore in case of explicit cast where it is referenced indirectly. + DBuilder.retainType(DieTy); } -- 2.50.1