<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 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: Mon Sep 21 12:48:37 2015<br>
New Revision: 248184<br>
<br>
URL: <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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Added:<br>
    cfe/trunk/test/Modules/DebugInfoTransitiveImport.m<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
    cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.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=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: <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: <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">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>