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@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits