<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 23, 2015 at 1:44 PM, Adrian Prantl via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-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: Wed Sep 23 15:44:37 2015<br>
New Revision: 248428<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=248428&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=248428&view=rev</a><br>
Log:<br>
dsymutil: Don't prune forward declarations inside a module definition.<br></blockquote><div><br></div><div>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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
llvm/trunk/test/tools/dsymutil/Inputs/modules/1.o<br>
llvm/trunk/test/tools/dsymutil/Inputs/modules/Bar.pcm<br>
llvm/trunk/test/tools/dsymutil/Inputs/modules/Foo.pcm<br>
llvm/trunk/test/tools/dsymutil/X86/modules.m<br>
llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br>
<br>
Modified: llvm/trunk/test/tools/dsymutil/Inputs/modules/1.o<br>
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">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>
==============================================================================<br>
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>
<br>
Modified: llvm/trunk/test/tools/dsymutil/Inputs/modules/Bar.pcm<br>
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">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>
==============================================================================<br>
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>
<br>
Modified: llvm/trunk/test/tools/dsymutil/Inputs/modules/Foo.pcm<br>
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">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>
==============================================================================<br>
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>
<br>
Modified: llvm/trunk/test/tools/dsymutil/X86/modules.m<br>
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">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/modules.m?rev=248428&r1=248427&r2=248428&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/tools/dsymutil/X86/modules.m (original)<br>
+++ llvm/trunk/test/tools/dsymutil/X86/modules.m Wed Sep 23 15:44:37 2015<br>
@@ -9,8 +9,8 @@<br>
export *<br>
}<br>
EOF<br>
- clang -D BAR_H -E -o Bar.h<br>
- clang -D FOO_H -E -o Foo.h<br>
+ clang -D BAR_H -E -o Bar.h modules.m<br>
+ clang -D FOO_H -E -o Foo.h modules.m<br>
clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \<br>
-fmodule-format=obj -g -dwarf-ext-refs -fmodules-cache-path=. \<br>
-fdisable-module-hash modules.m -o 1.o<br>
@@ -32,17 +32,22 @@<br>
// CHECK-NOT: DW_TAG<br>
// CHECK: DW_TAG_module<br>
// CHECK-NEXT: DW_AT_name{{.*}}"Bar"<br>
-// CHECK-NOT: DW_TAG<br>
// CHECK: 0x0[[BAR:.*]]: DW_TAG_structure_type<br>
+// CHECK-NOT: DW_TAG<br>
// CHECK: DW_AT_name {{.*}}"Bar"<br>
// CHECK-NOT: DW_TAG<br>
// CHECK: DW_TAG_member<br>
// CHECK: DW_AT_name {{.*}}"value"<br>
+// CHECK: DW_TAG_structure_type<br>
+// CHECK-NOT: DW_TAG<br>
+// CHECK: DW_AT_name {{.*}}"PruneMeNot"<br>
<br>
struct Bar {<br>
int value;<br>
};<br>
<br>
+struct PruneMeNot;<br>
+<br>
#else<br>
// ---------------------------------------------------------------------<br>
#ifdef FOO_H<br>
<br>
Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br>
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">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=248428&r1=248427&r2=248428&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)<br>
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Wed Sep 23 15:44:37 2015<br>
@@ -1764,7 +1764,7 @@ static bool analyzeContextInfo(const DWA<br>
DeclContext *CurrentDeclContext,<br>
NonRelocatableStringpool &StringPool,<br>
DeclContextTree &Contexts,<br>
- bool InTagModule = false) {<br>
+ bool InImportedModule = false) {<br>
unsigned MyIdx = CU.getOrigUnit().getDIEIndex(DIE);<br>
CompileUnit::DIEInfo &Info = CU.getInfo(MyIdx);<br>
<br>
@@ -1780,11 +1780,14 @@ static bool analyzeContextInfo(const DWA<br>
// definitions match)."<br>
//<br>
// We treat non-C++ modules like namespaces for this reason.<br>
- if (DIE->getTag() == dwarf::DW_TAG_module)<br>
- InTagModule = true;<br>
+ if (DIE->getTag() == dwarf::DW_TAG_module &&<br>
+ DIE->getAttributeValueAsString(&CU.getOrigUnit(), dwarf::DW_AT_name,<br>
+ "") != CU.getClangModuleName()) {<br>
+ InImportedModule = true;<br>
+ }<br>
<br>
Info.ParentIdx = ParentIdx;<br>
- if (CU.hasODR() || CU.isClangModule() || InTagModule) {<br>
+ if (CU.hasODR() || CU.isClangModule() || InImportedModule) {<br>
if (CurrentDeclContext) {<br>
auto PtrInvalidPair = Contexts.getChildDeclContext(*CurrentDeclContext,<br>
DIE, CU, StringPool);<br>
@@ -1795,12 +1798,12 @@ static bool analyzeContextInfo(const DWA<br>
Info.Ctxt = CurrentDeclContext = nullptr;<br>
}<br>
<br>
- Info.Prune = InTagModule;<br>
+ Info.Prune = InImportedModule;<br>
if (DIE->hasChildren())<br>
for (auto *Child = DIE->getFirstChild(); Child && !Child->isNULL();<br>
Child = Child->getSibling())<br>
Info.Prune &= analyzeContextInfo(Child, MyIdx, CU, CurrentDeclContext,<br>
- StringPool, Contexts, InTagModule);<br>
+ StringPool, Contexts, InImportedModule);<br>
<br>
// Prune this DIE if it is either a forward declaration inside a<br>
// DW_TAG_module or a DW_TAG_module that contains nothing but<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>