Re: [PATCH] D13959: Fix crash in EmitDeclMetadata mode
This revision was automatically updated to reflect the committed changes. Closed by commit rL252229: Fix crash in EmitDeclMetadata mode (authored by kfischer). Changed prior to commit: http://reviews.llvm.org/D13959?vs=38049=39426#toc Repository: rL LLVM http://reviews.llvm.org/D13959 Files: cfe/trunk/lib/CodeGen/CodeGenModule.cpp Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp === --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp @@ -3707,10 +3707,12 @@ void CodeGenModule::EmitDeclMetadata() { llvm::NamedMDNode *GlobalMetadata = nullptr; - // StaticLocalDeclMap for (auto : 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); } } Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp === --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp @@ -3707,10 +3707,12 @@ void CodeGenModule::EmitDeclMetadata() { llvm::NamedMDNode *GlobalMetadata = nullptr; - // StaticLocalDeclMap for (auto : 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@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D13959: Fix crash in EmitDeclMetadata mode
labath resigned from this revision. labath removed a reviewer: labath. labath added a comment. I'll just observe this one. Someone with more knowledge of clang needs to review this. Repository: rL LLVM http://reviews.llvm.org/D13959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D13959: Fix crash in EmitDeclMetadata mode
loladiro added a comment. Can you provide insight as to why this is looking at MangledDeclNames rather than the StaticLocalDeclMap? I'd like to extend the comment with an explanation. Repository: rL LLVM http://reviews.llvm.org/D13959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D13959: Fix crash in EmitDeclMetadata mode
rjmccall added a comment. LGTM. Repository: rL LLVM http://reviews.llvm.org/D13959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D13959: Fix crash in EmitDeclMetadata mode
loladiro created this revision. loladiro added reviewers: rjmccall, labath. loladiro added a subscriber: cfe-commits. loladiro set the repository for this revision to rL LLVM. 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 here. I am not entirely sure this is the right fix. The comment says something about StaticLocalDeclMap, which may be better here, but I checked and that already existed when this functionality was added, which makes me think that there is some reason it wasn't used. Repository: rL LLVM http://reviews.llvm.org/D13959 Files: lib/CodeGen/CodeGenModule.cpp Index: lib/CodeGen/CodeGenModule.cpp === --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -3710,7 +3710,10 @@ // StaticLocalDeclMap for (auto : 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); } } Index: lib/CodeGen/CodeGenModule.cpp === --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -3710,7 +3710,10 @@ // StaticLocalDeclMap for (auto : 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@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits