]> granicus.if.org Git - clang/commitdiff
Prepare for the DIBuilder populating DISubprogram's Variables with null.
authorFrederic Riss <friss@apple.com>
Thu, 20 Nov 2014 15:46:59 +0000 (15:46 +0000)
committerFrederic Riss <friss@apple.com>
Thu, 20 Nov 2014 15:46:59 +0000 (15:46 +0000)
This is a followup to r222373. A better solution to the problem solved
there is to not create the leaked nodes at all (we know that they will
never be used for forward declared functions anyway). To avoid bot
breakage in the interval between the cfe and llvm commits, add a check
that the nMDNode is not null before deleting it. This code can completely
go away after the LLVM part is in.

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

lib/CodeGen/CGDebugInfo.cpp

index 03a0cd92c253130035625cc5f0fbf2a386a77c3c..343b343207609986c4da37f46d54d2c63a039fa7 100644 (file)
@@ -3417,7 +3417,8 @@ void CGDebugInfo::finalize() {
     // to get RAUWed upon DIBuilder finalization. Do not leak these
     // nodes for the temporary functions we are about to delete.
     if (FwdDecl.isSubprogram())
-      llvm::MDNode::deleteTemporary(llvm::DISubprogram(FwdDecl).getVariablesNodes());
+      if (llvm::MDNode *Vars = llvm::DISubprogram(FwdDecl).getVariablesNodes())
+        llvm::MDNode::deleteTemporary(Vars);
 
     FwdDecl.replaceAllUsesWith(CGM.getLLVMContext(),
                                llvm::DIDescriptor(cast<llvm::MDNode>(VH)));