<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 10:59 AM, 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 Mon, Sep 21, 2015 at 10:48 AM, 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: Mon Sep 21 12:48:37 2015<br class="">
New Revision: 248184<br class="">
<br class="">
URL: <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><br class=""></div><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. 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><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">
<br class="">
Added:<br class="">
    cfe/trunk/test/Modules/DebugInfoTransitiveImport.m<br class="">
Modified:<br class="">
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
    cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.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=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: <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: <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" 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>