]> granicus.if.org Git - clang/commitdiff
DebugInfo: Don't call DIBuilder::retainType(nullptr)
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 27 Mar 2015 22:58:05 +0000 (22:58 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 27 Mar 2015 22:58:05 +0000 (22:58 +0000)
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

index 186c52251755acc7ec51ea9c9f9a659cdfd69abe..1e30cb69bbb432e53901bacac3dbfddb8564a0d1 100644 (file)
@@ -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);
 }