[llvm] r248512 - dsymutil: Fix the condition to distinguish module imports form definitions.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 09:10:14 PDT 2015


Author: adrian
Date: Thu Sep 24 11:10:14 2015
New Revision: 248512

URL: http://llvm.org/viewvc/llvm-project?rev=248512&view=rev
Log:
dsymutil: Fix the condition to distinguish module imports form definitions.

Added:
    llvm/trunk/test/tools/dsymutil/Inputs/submodules/
    llvm/trunk/test/tools/dsymutil/Inputs/submodules/1.o
    llvm/trunk/test/tools/dsymutil/Inputs/submodules/Parent.pcm
    llvm/trunk/test/tools/dsymutil/X86/submodules.m
Modified:
    llvm/trunk/tools/dsymutil/DwarfLinker.cpp

Added: llvm/trunk/test/tools/dsymutil/Inputs/submodules/1.o
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/submodules/1.o?rev=248512&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/submodules/1.o (added) and llvm/trunk/test/tools/dsymutil/Inputs/submodules/1.o Thu Sep 24 11:10:14 2015 differ

Added: llvm/trunk/test/tools/dsymutil/Inputs/submodules/Parent.pcm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/submodules/Parent.pcm?rev=248512&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/submodules/Parent.pcm (added) and llvm/trunk/test/tools/dsymutil/Inputs/submodules/Parent.pcm Thu Sep 24 11:10:14 2015 differ

Added: llvm/trunk/test/tools/dsymutil/X86/submodules.m
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/submodules.m?rev=248512&view=auto
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/submodules.m (added)
+++ llvm/trunk/test/tools/dsymutil/X86/submodules.m Thu Sep 24 11:10:14 2015
@@ -0,0 +1,40 @@
+/* Compile with:
+   cat >modules.modulemap <<EOF
+   module Parent {
+     module Child {
+       header "Child.h"
+     }
+   }
+EOF
+   clang -D CHILD_H -E -o Child.h submodules.m
+   clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \
+     -fmodule-format=obj -g -dwarf-ext-refs -fmodules-cache-path=. \
+     -fdisable-module-hash submodules.m -o 1.o
+*/
+
+// RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs/submodules \
+// RUN:   -y %p/dummy-debug-map.map -o - \
+// RUN:     | llvm-dwarfdump --debug-dump=info - | FileCheck %s
+
+// ---------------------------------------------------------------------
+#ifdef CHILD_H
+// ---------------------------------------------------------------------
+// CHECK:            DW_TAG_compile_unit
+// CHECK-NOT:        DW_TAG
+// CHECK:              DW_TAG_module
+// CHECK-NEXT:           DW_AT_name{{.*}}"Parent"
+// CHECK:                DW_TAG_module
+// CHECK-NEXT:             DW_AT_name{{.*}}"Child"
+// CHECK:                  DW_TAG_structure_type
+// CHECK-NOT:                DW_TAG
+// CHECK:                    DW_AT_name {{.*}}"PruneMeNot"
+
+struct PruneMeNot;
+
+// ---------------------------------------------------------------------
+#else
+// ---------------------------------------------------------------------
+
+ at import Parent.Child;
+int main(int argc, char **argv) { return 0; }
+#endif

Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=248512&r1=248511&r2=248512&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Thu Sep 24 11:10:14 2015
@@ -1780,7 +1780,7 @@ static bool analyzeContextInfo(const DWA
   //   definitions match)."
   //
   // We treat non-C++ modules like namespaces for this reason.
-  if (DIE->getTag() == dwarf::DW_TAG_module &&
+  if (DIE->getTag() == dwarf::DW_TAG_module && ParentIdx == 0 &&
       DIE->getAttributeValueAsString(&CU.getOrigUnit(), dwarf::DW_AT_name,
                                      "") != CU.getClangModuleName()) {
     InImportedModule = true;




More information about the llvm-commits mailing list