[PATCH] Fix unconditional dereference of a WeakVH in CGDebugInfo TypeCache

Reid Kleckner rnk at google.com
Tue Mar 4 10:41:47 PST 2014


This was caused by r202769.


On Tue, Mar 4, 2014 at 10:37 AM, Reid Kleckner <rnk at google.com> wrote:

> Hi dblaikie,
>
> This fails during a clang-cl self-host on Windows on
> MachineLoopInfo.cpp.  I don't understand why.  I assume a recent change
> caused it, but I haven't isolated which one.  However, this change by
> itself appears correct, since the earlier code uses null checks after
> WeakVH loads.
>
> http://llvm-reviews.chandlerc.com/D2944
>
> Files:
>   lib/CodeGen/CGDebugInfo.cpp
>
> Index: lib/CodeGen/CGDebugInfo.cpp
> ===================================================================
> --- lib/CodeGen/CGDebugInfo.cpp
> +++ lib/CodeGen/CGDebugInfo.cpp
> @@ -3341,7 +3341,8 @@
>    // up the final type in the type cache.
>    for (std::vector<void *>::const_iterator RI = RetainedTypes.begin(),
>           RE = RetainedTypes.end(); RI != RE; ++RI)
> -    DBuilder.retainType(llvm::DIType(cast<llvm::MDNode>(TypeCache[*RI])));
> +    if (llvm::Value *V = TypeCache[*RI])
> +      DBuilder.retainType(llvm::DIType(cast<llvm::MDNode>(V)));
>
>    DBuilder.finalize();
>  }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140304/a6f9b822/attachment.html>


More information about the cfe-commits mailing list