<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 21, 2015 at 12:25 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 Sep 21, 2015, at 11:25 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><div><br><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Mon, Sep 21, 2015 at 11:18 AM, Adrian Prantl<span> </span><span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span><span> </span>wrote:<br><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"><br><div><span><blockquote type="cite"><div>On Sep 21, 2015, at 10:59 AM, 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 Mon, Sep 21, 2015 at 10:48 AM, Adrian Prantl via cfe-commits<span> </span><span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span><span> </span>wrote:<br><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>Date: Mon Sep 21 12:48:37 2015<br>New Revision: 248184<br><br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project?rev=248184&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=248184&view=rev</a><br>Log:<br>Debug Info: When building a module, emit skeleton CUs for imported modules.<br></blockquote><div><br></div><div>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><br></div></span><div>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><br></div><div>Why is the graph particularly helpful to dsymutil?</div></div></div></blockquote><div><br></div></span><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></div></div></blockquote><div><br></div><div>Ah, rightio, thanks for the explanation.<br></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 class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div> </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"><div><div>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><br></div><div>Depends how many modules you have, I guess... <br></div></div></div></blockquote><div><br></div></span>Sure :-)<div><div class="h5"><br><blockquote type="cite"><div><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><br>- Dave</div><div> </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"><div><span><font color="#888888"><div><br></div><div>-- adrian</div></font></span><div><div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </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>Added:<br>   <span> </span>cfe/trunk/test/Modules/DebugInfoTransitiveImport.m<br>Modified:<br>   <span> </span>cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>   <span> </span>cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br><br>Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>URL:<span> </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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015<br>@@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI<br><br> llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {<br>   ExternalASTSource::ASTSourceDescriptor Info;<br>-  if (ClangModuleMap) {<br>+  if (DebugTypeExtRefs && D->isFromASTFile()) {<br>+    // Record a reference to an imported clang module or precompiled header.<br>+    auto *Reader = CGM.getContext().getExternalSource();<br>+    auto Idx = D->getOwningModuleID();<br>+    auto Info = Reader->getSourceDescriptor(Idx);<br>+    if (Info)<br>+      return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);<br>+  } else if (ClangModuleMap) {<br>     // We are building a clang module or a precompiled header.<br>     //<br>     // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies<br>@@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo<br>     }<br>   }<br><br>-  if (DebugTypeExtRefs && D->isFromASTFile()) {<br>-    // Record a reference to an imported clang module or precompiled header.<br>-    auto *Reader = CGM.getContext().getExternalSource();<br>-    auto Idx = D->getOwningModuleID();<br>-    auto Info = Reader->getSourceDescriptor(Idx);<br>-    if (Info)<br>-      return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);<br>-  }<br>   return nullptr;<br> }<br><br><br>Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br>URL:<span> </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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)<br>+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep 21 12:48:37 2015<br>@@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST<br>       return !Ty->isDependentType() && !Ty->isUndeducedType();<br>     }<br><br>+    bool VisitImportDecl(ImportDecl *D) {<br>+      auto *Import = cast<ImportDecl>(D);<br>+      if (!Import->getImportedOwningModule())<br>+        DI.EmitImportDecl(*Import);<br>+      return true;<br>+    }<br>+<br>     bool VisitTypeDecl(TypeDecl *D) {<br>       QualType QualTy = Ctx.getTypeDeclType(D);<br>       if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))<br><br>Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto</a><br>==============================================================================<br>--- cfe/trunk/test/Modules/DebugInfoTransitiveImport.m (added)<br>+++ cfe/trunk/test/Modules/DebugInfoTransitiveImport.m Mon Sep 21 12:48:37 2015<br>@@ -0,0 +1,15 @@<br>+// RUN: rm -rf %t<br>+// RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \<br>+// RUN:     -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \<br>+// RUN:     %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s<br>+// REQUIRES: asserts<br>+<br>+@import diamond_left;<br>+<br>+// CHECK: ![[TOP_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_top<br>+// CHECK: ![[LEFT_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_left<br>+// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,<br>+// CHECK-SAME:              entity: ![[MODULE:.*]], line: 3)<br>+// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top"<br>+// CHECK: ![[TOP_SKEL_CU:.*]] = distinct !DICompileUnit({{.*}}diamond_top{{.*}}dwoId:<br>+<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></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></blockquote></div></div></div><br></div></blockquote></div><br></div></div>