[llvm] r308708 - Debug Info: Don't strip clang module skeleton CUs.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 18:24:06 PDT 2017


Author: adrian
Date: Thu Jul 20 18:24:05 2017
New Revision: 308708

URL: http://llvm.org/viewvc/llvm-project?rev=308708&view=rev
Log:
Debug Info: Don't strip clang module skeleton CUs.

This corrects a (hopefully :-) accidental side-effect of r304020.

rdar://problem/33442618

Added:
    llvm/trunk/test/DebugInfo/X86/clang-module.ll
Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=308708&r1=308707&r2=308708&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Jul 20 18:24:05 2017
@@ -548,7 +548,8 @@ void DwarfDebug::beginModule() {
   for (DICompileUnit *CUNode : M->debug_compile_units()) {
     if (CUNode->getEnumTypes().empty() && CUNode->getRetainedTypes().empty() &&
         CUNode->getGlobalVariables().empty() &&
-        CUNode->getImportedEntities().empty() && CUNode->getMacros().empty())
+        CUNode->getImportedEntities().empty() && CUNode->getMacros().empty() &&
+        !CUNode->getDWOId())
       continue;
 
     DwarfCompileUnit &CU = getOrCreateDwarfCompileUnit(CUNode);

Added: llvm/trunk/test/DebugInfo/X86/clang-module.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/clang-module.ll?rev=308708&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/clang-module.ll (added)
+++ llvm/trunk/test/DebugInfo/X86/clang-module.ll Thu Jul 20 18:24:05 2017
@@ -0,0 +1,31 @@
+; RUN: llc -mtriple=x86_64-apple-darwin %s -o - -filetype=obj \
+; RUN:   | llvm-dwarfdump -debug-dump=info - | FileCheck %s
+
+; Clang modules leave Skeleton CUs as breadcrumbs to point from the object files
+; to the pcm containing the module's debug info.
+
+; CHECK: Compile Unit:
+; CHECK: DW_TAG_compile_unit
+; CHECK:   DW_TAG_imported_declaration
+; CHECK: Compile Unit:
+; CHECK: DW_TAG_compile_unit
+; CHECK: DW_AT_name {{.*}}Foo
+; CHECK: DW_AT_{{.*}}dwo_id {{.*}}04d2
+; CHECK: DW_AT_{{.*}}dwo_name {{.*}}"/Foo.pcm"
+source_filename = "modules.m"
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.12.0"
+
+!llvm.dbg.cu = !{!0, !6}
+!llvm.module.flags = !{!15, !16}
+!llvm.linker.options = !{}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !1, producer: "clang version 5.0.0 (trunk 308357) (llvm/trunk 308379)", emissionKind: FullDebug, imports: !3)
+!1 = !DIFile(filename: "modules.m", directory: "/")
+!3 = !{!4}
+!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !5, line: 122)
+!5 = !DIModule(scope: null, name: "Foo", includePath: ".", isysroot: "/")
+!6 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !7, producer: "clang version 5.0.0 (trunk 308357) (llvm/trunk 308379)", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "/Foo.pcm", emissionKind: FullDebug, dwoId: 1234)
+!7 = !DIFile(filename: "Foo", directory: ".")
+!15 = !{i32 2, !"Dwarf Version", i32 4}
+!16 = !{i32 2, !"Debug Info Version", i32 3}




More information about the llvm-commits mailing list