<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 Sep 21, 2015, at 11:25 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Mon, Sep 21, 2015 at 11:18 AM, Adrian Prantl<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Sep 21, 2015, at 10:59 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Sep 21, 2015 at 10:48 AM, Adrian Prantl via cfe-commits<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Author: adrian<br class="">Date: Mon Sep 21 12:48:37 2015<br class="">New Revision: 248184<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=248184&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=248184&view=rev</a><br class="">Log:<br class="">Debug Info: When building a module, emit skeleton CUs for imported modules.<br class=""></blockquote><div class=""><br class=""></div><div class="">This seems like it might add a reasonable amount more debug info - is it necessary? Or could the debugger use the list of modules from the referencing/original compilation unit as the dependency set to search?</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">The advantage of having this info in the modules is that it makes llvm-dsymutil’s life much easier because the dependency graph is explicit.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Why is the graph particularly helpful to dsymutil?</div></div></div></blockquote><div><br class=""></div><div>dsymutil does a single pass over the debug info. To support module debugging (I’ll post a patch implementing this for review very soon), we can hijack the existing ODR type-uniquing code to resolve references to module type forward declarations to point to the type's definition in the module, but only if we visited the module where the type is defined before.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><div class="">The size of a skeleton CU is 11 bytes + the length of the name + 8 bytes of dwo_id, (the producer string is shared with the main CU) so I’m not sure if the savings are worth the extra complexity.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Depends how many modules you have, I guess... <br class=""></div></div></div></blockquote><div><br class=""></div>Sure :-)<br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class="">- Dave</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- adrian</div></font></span><div class=""><div class="h5"><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: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><br class="">Added:<br class="">   <span class="Apple-converted-space"> </span>cfe/trunk/test/Modules/DebugInfoTransitiveImport.m<br class="">Modified:<br class="">   <span class="Apple-converted-space"> </span>cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">   <span class="Apple-converted-space"> </span>cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br class=""><br class="">Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br class="">+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015<br class="">@@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI<br class=""><br class=""> llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {<br class="">   ExternalASTSource::ASTSourceDescriptor Info;<br class="">-  if (ClangModuleMap) {<br class="">+  if (DebugTypeExtRefs && D->isFromASTFile()) {<br class="">+    // Record a reference to an imported clang module or precompiled header.<br class="">+    auto *Reader = CGM.getContext().getExternalSource();<br class="">+    auto Idx = D->getOwningModuleID();<br class="">+    auto Info = Reader->getSourceDescriptor(Idx);<br class="">+    if (Info)<br class="">+      return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);<br class="">+  } else if (ClangModuleMap) {<br class="">     // We are building a clang module or a precompiled header.<br class="">     //<br class="">     // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies<br class="">@@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo<br class="">     }<br class="">   }<br class=""><br class="">-  if (DebugTypeExtRefs && D->isFromASTFile()) {<br class="">-    // Record a reference to an imported clang module or precompiled header.<br class="">-    auto *Reader = CGM.getContext().getExternalSource();<br class="">-    auto Idx = D->getOwningModuleID();<br class="">-    auto Info = Reader->getSourceDescriptor(Idx);<br class="">-    if (Info)<br class="">-      return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);<br class="">-  }<br class="">   return nullptr;<br class=""> }<br class=""><br class=""><br class="">Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)<br class="">+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep 21 12:48:37 2015<br class="">@@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST<br class="">       return !Ty->isDependentType() && !Ty->isUndeducedType();<br class="">     }<br class=""><br class="">+    bool VisitImportDecl(ImportDecl *D) {<br class="">+      auto *Import = cast<ImportDecl>(D);<br class="">+      if (!Import->getImportedOwningModule())<br class="">+        DI.EmitImportDecl(*Import);<br class="">+      return true;<br class="">+    }<br class="">+<br class="">     bool VisitTypeDecl(TypeDecl *D) {<br class="">       QualType QualTy = Ctx.getTypeDeclType(D);<br class="">       if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))<br class=""><br class="">Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto</a><br class="">==============================================================================<br class="">--- cfe/trunk/test/Modules/DebugInfoTransitiveImport.m (added)<br class="">+++ cfe/trunk/test/Modules/DebugInfoTransitiveImport.m Mon Sep 21 12:48:37 2015<br class="">@@ -0,0 +1,15 @@<br class="">+// RUN: rm -rf %t<br class="">+// RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \<br class="">+// RUN:     -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \<br class="">+// RUN:     %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s<br class="">+// REQUIRES: asserts<br class="">+<br class="">+@import diamond_left;<br class="">+<br class="">+// CHECK: ![[TOP_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_top<br class="">+// CHECK: ![[LEFT_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_left<br class="">+// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,<br class="">+// CHECK-SAME:              entity: ![[MODULE:.*]], line: 3)<br class="">+// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top"<br class="">+// CHECK: ![[TOP_SKEL_CU:.*]] = distinct !DICompileUnit({{.*}}diamond_top{{.*}}dwoId:<br class="">+<br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" target="_blank" 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></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></blockquote></div><br class=""></body></html>