r252229 - Fix crash in EmitDeclMetadata mode
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 9 13:30:36 PST 2015
Any chance of a test case here?
(I don't know much about this code, but I am a bit confused about why we'd
ever need to visit a list of mangled names & look them up... )
On Thu, Nov 5, 2015 at 3:18 PM, Keno Fischer via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: kfischer
> Date: Thu Nov 5 17:18:44 2015
> New Revision: 252229
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252229&view=rev
> Log:
> Fix crash in EmitDeclMetadata mode
>
> Summary: This fixes a bug that's easily encountered in LLDB
> (https://llvm.org/bugs/show_bug.cgi?id=22875). The problem here is that we
> mangle a name during debug info emission, but never actually emit the
> actual
> Decl, so we run into problems in EmitDeclMetadata (which assumes such a
> Decl
> exists). Fix that by just skipping metadata emissions for mangled names
> that
> don't have associated Decls.
>
> Reviewers: rjmccall
>
> Subscribers: labath, cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D13959
>
> Modified:
> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=252229&r1=252228&r2=252229&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Nov 5 17:18:44 2015
> @@ -3707,10 +3707,12 @@ bool CodeGenModule::lookupRepresentative
> void CodeGenModule::EmitDeclMetadata() {
> llvm::NamedMDNode *GlobalMetadata = nullptr;
>
> - // StaticLocalDeclMap
> for (auto &I : MangledDeclNames) {
> llvm::GlobalValue *Addr = getModule().getNamedValue(I.second);
> - EmitGlobalDeclMetadata(*this, GlobalMetadata, I.first, Addr);
> + // Some mangled names don't necessarily have an associated GlobalValue
> + // in this module, e.g. if we mangled it for DebugInfo.
> + if (Addr)
> + EmitGlobalDeclMetadata(*this, GlobalMetadata, I.first, Addr);
> }
> }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151109/5ef35c49/attachment.html>
More information about the cfe-commits
mailing list