<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 19, 2016 at 4:04 PM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Jan 19, 2016, at 3:52 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 19, 2016 at 3:42 PM, Adrian Prantl via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br>
Date: Tue Jan 19 17:42:53 2016<br>
New Revision: 258251<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=258251&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=258251&view=rev</a><br>
Log:<br>
Module Debugging: Don't emit external type references to anonymous types.<br>
Even if they exist in the module, they can't be matched with the forward<br>
declaration in the object file.<br></blockquote><div><br></div><div>They can't be matched because they're matched by (non-mangled) name? </div></div></div></div></div></blockquote><div><br></div></span><div>Yes, dsymutil and lldb use the (non-mangled) name + DeclContext (which includes the qualified module name).</div><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I thought at least they'd be matched by mangled name (& perhaps we need to emit DW_AT_linkage_name on them to make that possible)?</div></div></div></div></div></blockquote><div><br></div></span><div>Emitting the DW_AT_linkage_name and matching/indexing types based on it is definitely  interesting for the future (bag of dwarf ...), but currently LLVM doesn’t do that.</div></div></div></blockquote><div><br>Even before bag-of-dwarf, it seems using mangled names might be helpful, but I don't think I have enough context/brain-swap-space to think about it too hard right now.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<<a>rdar://problem/24199640</a>><br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
    cfe/trunk/test/Modules/ExtDebugInfo.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jan 19 17:42:53 2016<br>
@@ -1536,8 +1536,9 @@ static bool shouldOmitDefinition(CodeGen<br>
                                  const RecordDecl *RD,<br>
                                  const LangOptions &LangOpts) {<br>
   // Does the type exist in an imported clang module?<br>
-  if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition())<br>
-      return true;<br>
+  if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition() &&<br>
+      RD->isExternallyVisible())<br></blockquote><div><br></div><div>Not sure if this is the right check. There might be named things that are static (so not externally visible) in headers?<br></div></div></div></div></div></blockquote><div><br></div></span><div>I used isExternallyVisible() because it implies that the type won’t have a mangled name, (mostly thinking about the future where this would become more relevant), but at the moment we can relax this to RD->getName().isEmpty() and worry about nonexisting mangled names later.</div></div></div></blockquote><div><br></div><div>Might be more accurate.<br><br>Probably good to have a test case with a static named type in a module too, then?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-- adrian</div></font></span><div><div class="h5"><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    return true;<br>
<br>
   if (DebugKind > CodeGenOptions::LimitedDebugInfo)<br>
     return false;<br>
<br>
Modified: cfe/trunk/test/Modules/ExtDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/ExtDebugInfo.cpp (original)<br>
+++ cfe/trunk/test/Modules/ExtDebugInfo.cpp Tue Jan 19 17:42:53 2016<br>
@@ -84,4 +84,13 @@ void foo() {<br>
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, scope: ![[NS]],<br>
 // CHECK-SAME:             line: 16<br>
<br>
+// CHECK: !DIGlobalVariable(name: "GlobalUnion",<br>
+// CHECK-SAME:              type: ![[GLOBAL_UNION:[0-9]+]]<br>
+// CHECK: ![[GLOBAL_UNION]] = !DICompositeType(tag: DW_TAG_union_type,<br>
+// CHECK-SAME:                elements: !{{[0-9]+}})<br>
+// CHECK: !DIGlobalVariable(name: "GlobalStruct",<br>
+// CHECK-SAME:              type: ![[GLOBAL_STRUCT:[0-9]+]]<br>
+// CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,<br>
+// CHECK-SAME:                elements: !{{[0-9]+}})<br>
+<br>
 // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !"_ZTSN8DebugCXX6StructE", line: 24)<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>
</div></blockquote></div></div></div><br></div></blockquote></div><br></div></div>