<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 23, 2015, at 1:53 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 Wed, Sep 23, 2015 at 1:44 PM, Adrian Prantl via llvm-commits <span dir="ltr" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-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 Sep 23 15:44:37 2015<br class="">
New Revision: 248428<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=248428&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=248428&view=rev</a><br class="">
Log:<br class="">
dsymutil: Don't prune forward declarations inside a module definition.<br class=""></blockquote><div class=""><br class=""></div><div class="">Does dsymutil pull in the definitions from modules? (if so, why are there DW_TAG_modules left in the DWARF at all?)</div></div></div></div></div></blockquote><div><br class=""></div>It pulls in the entire* module and converts all references to module type fwddecls in other CUs into DW_FORM_ref_addr forms pointing to the definition in the module. (* fwddecls for types imported from a third module are pruned). The DW_TAG_modules stay in so a consumer can choose to imported types directly from the AST using the extra DW_AT_llvm attributes in the TAG_module to import the module.</div><div><br class=""></div><div>— adrian <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="">
llvm/trunk/test/tools/dsymutil/Inputs/modules/1.o<br class="">
llvm/trunk/test/tools/dsymutil/Inputs/modules/Bar.pcm<br class="">
llvm/trunk/test/tools/dsymutil/Inputs/modules/Foo.pcm<br class="">
llvm/trunk/test/tools/dsymutil/X86/modules.m<br class="">
llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br class="">
<br class="">
Modified: llvm/trunk/test/tools/dsymutil/Inputs/modules/1.o<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/modules/1.o?rev=248428&r1=248427&r2=248428&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/modules/1.o?rev=248428&r1=248427&r2=248428&view=diff</a><br class="">
==============================================================================<br class="">
Binary files llvm/trunk/test/tools/dsymutil/Inputs/modules/1.o (original) and llvm/trunk/test/tools/dsymutil/Inputs/modules/1.o Wed Sep 23 15:44:37 2015 differ<br class="">
<br class="">
Modified: llvm/trunk/test/tools/dsymutil/Inputs/modules/Bar.pcm<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/modules/Bar.pcm?rev=248428&r1=248427&r2=248428&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/modules/Bar.pcm?rev=248428&r1=248427&r2=248428&view=diff</a><br class="">
==============================================================================<br class="">
Binary files llvm/trunk/test/tools/dsymutil/Inputs/modules/Bar.pcm (original) and llvm/trunk/test/tools/dsymutil/Inputs/modules/Bar.pcm Wed Sep 23 15:44:37 2015 differ<br class="">
<br class="">
Modified: llvm/trunk/test/tools/dsymutil/Inputs/modules/Foo.pcm<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/modules/Foo.pcm?rev=248428&r1=248427&r2=248428&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/modules/Foo.pcm?rev=248428&r1=248427&r2=248428&view=diff</a><br class="">
==============================================================================<br class="">
Binary files llvm/trunk/test/tools/dsymutil/Inputs/modules/Foo.pcm (original) and llvm/trunk/test/tools/dsymutil/Inputs/modules/Foo.pcm Wed Sep 23 15:44:37 2015 differ<br class="">
<br class="">
Modified: llvm/trunk/test/tools/dsymutil/X86/modules.m<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/modules.m?rev=248428&r1=248427&r2=248428&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/modules.m?rev=248428&r1=248427&r2=248428&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/test/tools/dsymutil/X86/modules.m (original)<br class="">
+++ llvm/trunk/test/tools/dsymutil/X86/modules.m Wed Sep 23 15:44:37 2015<br class="">
@@ -9,8 +9,8 @@<br class="">
export *<br class="">
}<br class="">
EOF<br class="">
- clang -D BAR_H -E -o Bar.h<br class="">
- clang -D FOO_H -E -o Foo.h<br class="">
+ clang -D BAR_H -E -o Bar.h modules.m<br class="">
+ clang -D FOO_H -E -o Foo.h modules.m<br class="">
clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \<br class="">
-fmodule-format=obj -g -dwarf-ext-refs -fmodules-cache-path=. \<br class="">
-fdisable-module-hash modules.m -o 1.o<br class="">
@@ -32,17 +32,22 @@<br class="">
// CHECK-NOT: DW_TAG<br class="">
// CHECK: DW_TAG_module<br class="">
// CHECK-NEXT: DW_AT_name{{.*}}"Bar"<br class="">
-// CHECK-NOT: DW_TAG<br class="">
// CHECK: 0x0[[BAR:.*]]: DW_TAG_structure_type<br class="">
+// CHECK-NOT: DW_TAG<br class="">
// CHECK: DW_AT_name {{.*}}"Bar"<br class="">
// CHECK-NOT: DW_TAG<br class="">
// CHECK: DW_TAG_member<br class="">
// CHECK: DW_AT_name {{.*}}"value"<br class="">
+// CHECK: DW_TAG_structure_type<br class="">
+// CHECK-NOT: DW_TAG<br class="">
+// CHECK: DW_AT_name {{.*}}"PruneMeNot"<br class="">
<br class="">
struct Bar {<br class="">
int value;<br class="">
};<br class="">
<br class="">
+struct PruneMeNot;<br class="">
+<br class="">
#else<br class="">
// ---------------------------------------------------------------------<br class="">
#ifdef FOO_H<br class="">
<br class="">
Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=248428&r1=248427&r2=248428&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=248428&r1=248427&r2=248428&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)<br class="">
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Wed Sep 23 15:44:37 2015<br class="">
@@ -1764,7 +1764,7 @@ static bool analyzeContextInfo(const DWA<br class="">
DeclContext *CurrentDeclContext,<br class="">
NonRelocatableStringpool &StringPool,<br class="">
DeclContextTree &Contexts,<br class="">
- bool InTagModule = false) {<br class="">
+ bool InImportedModule = false) {<br class="">
unsigned MyIdx = CU.getOrigUnit().getDIEIndex(DIE);<br class="">
CompileUnit::DIEInfo &Info = CU.getInfo(MyIdx);<br class="">
<br class="">
@@ -1780,11 +1780,14 @@ static bool analyzeContextInfo(const DWA<br class="">
// definitions match)."<br class="">
//<br class="">
// We treat non-C++ modules like namespaces for this reason.<br class="">
- if (DIE->getTag() == dwarf::DW_TAG_module)<br class="">
- InTagModule = true;<br class="">
+ if (DIE->getTag() == dwarf::DW_TAG_module &&<br class="">
+ DIE->getAttributeValueAsString(&CU.getOrigUnit(), dwarf::DW_AT_name,<br class="">
+ "") != CU.getClangModuleName()) {<br class="">
+ InImportedModule = true;<br class="">
+ }<br class="">
<br class="">
Info.ParentIdx = ParentIdx;<br class="">
- if (CU.hasODR() || CU.isClangModule() || InTagModule) {<br class="">
+ if (CU.hasODR() || CU.isClangModule() || InImportedModule) {<br class="">
if (CurrentDeclContext) {<br class="">
auto PtrInvalidPair = Contexts.getChildDeclContext(*CurrentDeclContext,<br class="">
DIE, CU, StringPool);<br class="">
@@ -1795,12 +1798,12 @@ static bool analyzeContextInfo(const DWA<br class="">
Info.Ctxt = CurrentDeclContext = nullptr;<br class="">
}<br class="">
<br class="">
- Info.Prune = InTagModule;<br class="">
+ Info.Prune = InImportedModule;<br class="">
if (DIE->hasChildren())<br class="">
for (auto *Child = DIE->getFirstChild(); Child && !Child->isNULL();<br class="">
Child = Child->getSibling())<br class="">
Info.Prune &= analyzeContextInfo(Child, MyIdx, CU, CurrentDeclContext,<br class="">
- StringPool, Contexts, InTagModule);<br class="">
+ StringPool, Contexts, InImportedModule);<br class="">
<br class="">
// Prune this DIE if it is either a forward declaration inside a<br class="">
// DW_TAG_module or a DW_TAG_module that contains nothing but<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
llvm-commits mailing list<br class="">
<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>