[PATCH] D13959: Fix crash in EmitDeclMetadata mode

Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 15:21:10 PST 2015


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&id=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 &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);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13959.39426.patch
Type: text/x-patch
Size: 748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151105/2ff36dc9/attachment.bin>


More information about the cfe-commits mailing list