Re: [PATCH] D13959: Fix crash in EmitDeclMetadata mode

2015-11-05 Thread Phabricator via cfe-commits
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

2015-10-22 Thread Pavel Labath via cfe-commits
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

2015-10-22 Thread Keno Fischer via cfe-commits
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

2015-10-22 Thread John McCall via cfe-commits
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