<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 19, 2016, at 3:52 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jan 19, 2016 at 3:42 PM, Adrian Prantl via cfe-commits <span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br class="">
Date: Tue Jan 19 17:42:53 2016<br class="">
New Revision: 258251<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=258251&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=258251&view=rev</a><br class="">
Log:<br class="">
Module Debugging: Don't emit external type references to anonymous types.<br class="">
Even if they exist in the module, they can't be matched with the forward<br class="">
declaration in the object file.<br class=""></blockquote><div class=""><br class=""></div><div class="">They can't be matched because they're matched by (non-mangled) name? </div></div></div></div></div></blockquote><div><br class=""></div><div>Yes, dsymutil and lldb use the (non-mangled) name + DeclContext (which includes the qualified module name).</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">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 class=""></div><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><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<<a href="rdar://problem/24199640" class="">rdar://problem/24199640</a>><br class="">
<br class="">
Modified:<br class="">
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
    cfe/trunk/test/Modules/ExtDebugInfo.cpp<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
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" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jan 19 17:42:53 2016<br class="">
@@ -1536,8 +1536,9 @@ static bool shouldOmitDefinition(CodeGen<br class="">
                                  const RecordDecl *RD,<br class="">
                                  const LangOptions &LangOpts) {<br class="">
   // Does the type exist in an imported clang module?<br class="">
-  if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition())<br class="">
-      return true;<br class="">
+  if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition() &&<br class="">
+      RD->isExternallyVisible())<br class=""></blockquote><div class=""><br class=""></div><div class="">Not sure if this is the right check. There might be named things that are static (so not externally visible) in headers?<br class=""></div></div></div></div></div></blockquote><div><br class=""></div><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><br class=""></div><div>-- adrian</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    return true;<br class="">
<br class="">
   if (DebugKind > CodeGenOptions::LimitedDebugInfo)<br class="">
     return false;<br class="">
<br class="">
Modified: cfe/trunk/test/Modules/ExtDebugInfo.cpp<br class="">
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" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/Modules/ExtDebugInfo.cpp (original)<br class="">
+++ cfe/trunk/test/Modules/ExtDebugInfo.cpp Tue Jan 19 17:42:53 2016<br class="">
@@ -84,4 +84,13 @@ void foo() {<br class="">
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, scope: ![[NS]],<br class="">
 // CHECK-SAME:             line: 16<br class="">
<br class="">
+// CHECK: !DIGlobalVariable(name: "GlobalUnion",<br class="">
+// CHECK-SAME:              type: ![[GLOBAL_UNION:[0-9]+]]<br class="">
+// CHECK: ![[GLOBAL_UNION]] = !DICompositeType(tag: DW_TAG_union_type,<br class="">
+// CHECK-SAME:                elements: !{{[0-9]+}})<br class="">
+// CHECK: !DIGlobalVariable(name: "GlobalStruct",<br class="">
+// CHECK-SAME:              type: ![[GLOBAL_STRUCT:[0-9]+]]<br class="">
+// CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,<br class="">
+// CHECK-SAME:                elements: !{{[0-9]+}})<br class="">
+<br class="">
 // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !"_ZTSN8DebugCXX6StructE", line: 24)<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
cfe-commits mailing list<br class="">
<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>