<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 8, 2016, at 1:59 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 Fri, Jan 8, 2016 at 1:34 PM, Adrian Prantl <span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Jan 8, 2016, at 1:31 PM, 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 Wed, Jan 6, 2016 at 11:22 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: Wed Jan  6 13:22:19 2016<br class="">
New Revision: 256962<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=256962&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=256962&view=rev</a><br class="">
Log:<br class="">
Module debugging: Defer emitting tag types until their definition<br class="">
was visited and all decls have been merged.<br class="">
<br class="">
We only get a single chance to emit the types for virtual classes because<br class="">
CGDebugInfo::completeRequiredType() categorically doesn't complete them.<br class=""></blockquote><div class=""><br class=""></div><div class="">Not sure I'm following this comment. Could you explain this in other words/detail?<br class=""><br class="">If we visit a declaration we shouldn't do anything, right? (no point putting declarations in the modules debug info, unless it's needed for something else?) & then when we see the definition we'd build the debug info for it?</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Yes. Your statement pretty much summarizes this commit :-)</div></div></div></blockquote><div class=""><br class=""></div><div class="">Then I'm still confused - were we emitting type declarations in modules prior to this change?<br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>Yes. Dsymutil used to expect every forward declaration in a skeleton CU to have a corresponding declaration in the module dwo. I just verified that dsymutil does no longer prune forward declarations from skeleton CUs that don’t have a definition in the DWO, so everything should be fine now.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Perhaps a test case for a lone declaration (with no follow up definition) would be in order, then?</div></div></div></div></div></blockquote><div><br class=""></div><div>Yes, that would make sense. I’ll add one.</div><div> </div><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="">
Modified:<br class="">
    cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br class="">
    cfe/trunk/test/Modules/Inputs/DebugCXX.h<br class="">
    cfe/trunk/test/Modules/ModuleDebugInfo.cpp<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=256962&r1=256961&r2=256962&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=256962&r1=256961&r2=256962&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Wed Jan  6 13:22:19 2016<br class="">
@@ -59,8 +59,10 @@ class PCHContainerGenerator : public AST<br class="">
   struct DebugTypeVisitor : public RecursiveASTVisitor<DebugTypeVisitor> {<br class="">
     clang::CodeGen::CGDebugInfo &DI;<br class="">
     ASTContext &Ctx;<br class="">
-    DebugTypeVisitor(clang::CodeGen::CGDebugInfo &DI, ASTContext &Ctx)<br class="">
-        : DI(DI), Ctx(Ctx) {}<br class="">
+    bool SkipTagDecls;<br class="">
+    DebugTypeVisitor(clang::CodeGen::CGDebugInfo &DI, ASTContext &Ctx,<br class="">
+                     bool SkipTagDecls)<br class="">
+        : DI(DI), Ctx(Ctx), SkipTagDecls(SkipTagDecls) {}<br class="">
<br class="">
     /// Determine whether this type can be represented in DWARF.<br class="">
     static bool CanRepresent(const Type *Ty) {<br class="">
@@ -75,6 +77,12 @@ class PCHContainerGenerator : public AST<br class="">
     }<br class="">
<br class="">
     bool VisitTypeDecl(TypeDecl *D) {<br class="">
+      // TagDecls may be deferred until after all decls have been merged and we<br class="">
+      // know the complete type. Pure forward declarations will be skipped, but<br class="">
+      // they don't need to be emitted into the module anyway.<br class="">
+      if (SkipTagDecls && isa<TagDecl>(D))<br class="">
+          return true;<br class="">
+<br class="">
       QualType QualTy = Ctx.getTypeDeclType(D);<br class="">
       if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))<br class="">
         DI.getOrCreateStandaloneType(QualTy, D->getLocation());<br class="">
@@ -165,7 +173,7 @@ public:<br class="">
     // Collect debug info for all decls in this group.<br class="">
     for (auto *I : D)<br class="">
       if (!I->isFromASTFile()) {<br class="">
-        DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);<br class="">
+        DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx, true);<br class="">
         DTV.TraverseDecl(I);<br class="">
       }<br class="">
     return true;<br class="">
@@ -179,6 +187,11 @@ public:<br class="">
     if (Diags.hasErrorOccurred())<br class="">
       return;<br class="">
<br class="">
+    if (D->isFromASTFile())<br class="">
+      return;<br class="">
+<br class="">
+    DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx, false);<br class="">
+    DTV.TraverseDecl(D);<br class="">
     Builder->UpdateCompletedType(D);<br class="">
   }<br class="">
<br class="">
<br class="">
Modified: cfe/trunk/test/Modules/Inputs/DebugCXX.h<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=256962&r1=256961&r2=256962&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=256962&r1=256961&r2=256962&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/Modules/Inputs/DebugCXX.h (original)<br class="">
+++ cfe/trunk/test/Modules/Inputs/DebugCXX.h Wed Jan  6 13:22:19 2016<br class="">
@@ -50,3 +50,9 @@ namespace DebugCXX {<br class="">
   typedef A<void> B;<br class="">
   void foo(B) {}<br class="">
 }<br class="">
+<br class="">
+// Virtual class with a forward declaration.<br class="">
+class FwdVirtual;<br class="">
+class FwdVirtual {<br class="">
+  virtual ~FwdVirtual() {}<br class="">
+};<br class="">
<br class="">
Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=256962&r1=256961&r2=256962&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=256962&r1=256961&r2=256962&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)<br class="">
+++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Wed Jan  6 13:22:19 2016<br class="">
@@ -7,13 +7,11 @@<br class="">
 // RUN: rm -rf %t<br class="">
 // RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll<br class="">
 // RUN: cat %t-mod.ll | FileCheck %s<br class="">
-// RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s<br class="">
 // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-DWO %s<br class="">
<br class="">
 // PCH:<br class="">
 // RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll<br class="">
 // RUN: cat %t-pch.ll | FileCheck %s<br class="">
-// RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-NEG %s<br class="">
<br class="">
 #ifdef MODULES<br class="">
 @import DebugCXX;<br class="">
@@ -23,22 +21,32 @@<br class="">
 // CHECK-SAME:                    isOptimized: false,<br class="">
 // CHECK-SAME-NOT:                splitDebugFilename:<br class="">
 // CHECK-DWO:                     dwoId:<br class="">
+<br class="">
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum"<br class="">
 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX4EnumE")<br class="">
 // CHECK: !DINamespace(name: "DebugCXX"<br class="">
+<br class="">
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct"<br class="">
 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX6StructE")<br class="">
+<br class="">
 // CHECK: !DICompositeType(tag: DW_TAG_class_type,<br class="">
 // CHECK-SAME:             name: "Template<int, DebugCXX::traits<int> >"<br class="">
 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE")<br class="">
+<br class="">
+// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A<void>"<br class="">
+// CHECK-SAME:             identifier: "_ZTSN8DebugCXX1AIJvEEE")<br class="">
+<br class="">
 // CHECK: !DICompositeType(tag: DW_TAG_class_type,<br class="">
 // CHECK-SAME:             name: "Template<float, DebugCXX::traits<float> >"<br class="">
 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE")<br class="">
-// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A<void>"<br class="">
-// CHECK-SAME:             identifier: "_ZTSN8DebugCXX1AIJvEEE")<br class="">
+<br class="">
+// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdVirtual"<br class="">
+// CHECK-SAME:             elements:<br class="">
+// CHECK-SAME:             identifier: "_ZTS10FwdVirtual")<br class="">
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_vptr$FwdVirtual"<br class="">
+<br class="">
 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation"<br class="">
 // no mangled name here yet.<br class="">
+<br class="">
 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",<br class="">
 // no mangled name here yet.<br class="">
-<br class="">
-// CHECK-NEG-NOT: "_ZTSN8DebugCXX8TemplateIlNS_6traitsIlEEEE"<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><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div></div></div><br class=""></div></blockquote></div><br class=""></div></div>
</blockquote></div><br class=""></body></html>