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

David Blaikie dblaikie at gmail.com
Thu Nov 20 09:05:25 PST 2014


On Thu, Nov 20, 2014 at 7:46 AM, Frederic Riss <friss at apple.com> wrote:

> 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);
>

Why do you need this deleteTemporary at all? We must always RAUW the
variables node somewhere (where?) and can delete this temporary node there
(without the need for extra/duplicate conditionals) maybe? Yeah, this seems
like it could be handled down in DIBuilder::finalize when it RAUW's the
variable node (& it'd be more symmetric that way - DIBuilder creates them,
DIBuilder destroys them, Clang (& any other DIBuilder client) doesn't
know/care about them)


>
>      FwdDecl.replaceAllUsesWith(CGM.getLLVMContext(),
>
> llvm::DIDescriptor(cast<llvm::MDNode>(VH)));
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141120/817e0a4c/attachment.html>


More information about the cfe-commits mailing list