r222433 - Prepare for the DIBuilder populating DISubprogram's Variables with null.

Frederic Riss friss at apple.com
Thu Nov 20 07:46:59 PST 2014


Author: friss
Date: Thu Nov 20 09:46:59 2014
New Revision: 222433

URL: http://llvm.org/viewvc/llvm-project?rev=222433&view=rev
Log:
Prepare for the DIBuilder populating DISubprogram's Variables with null.

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.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=222433&r1=222432&r2=222433&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Nov 20 09:46:59 2014
@@ -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)));





More information about the cfe-commits mailing list