1 ; Test to ensure DICompositeType are imported as type declarations
4 ; RUN: opt -module-summary %s -o %t1.bc
5 ; RUN: opt -module-summary %p/Inputs/debuginfo-compositetype-import.ll -o %t2.bc
6 ; RUN: llvm-lto -thinlto-action=thinlink -o %t.index.bc %t1.bc %t2.bc
8 ; By default, composite types are imported as type declarations
9 ; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - | llvm-dis -o - | FileCheck %s
10 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.out -save-temps \
11 ; RUN: -r %t2.bc,main,plx \
12 ; RUN: -r %t2.bc,foo,l \
13 ; RUN: -r %t1.bc,foo,pl
14 ; RUN: llvm-dis < %t.out.2.3.import.bc | FileCheck %s
16 ; CHECK: distinct !DICompositeType(tag: DW_TAG_enumeration_type, name: "enum", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 50, size: 32, flags: DIFlagFwdDecl, identifier: "enum")
17 ; CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, name: "class", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 728, size: 448, flags: DIFlagFwdDecl, identifier: "class")
18 ; CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, size: 128, flags: DIFlagFwdDecl, identifier: "list")
19 ; CHECK: distinct !DICompositeType(tag: DW_TAG_union_type, file: !{{[0-9]+}}, line: 115, size: 384, flags: DIFlagFwdDecl, identifier: "union")
21 ; Ensure that full type definitions of composite types are imported if requested
22 ; RUN: llvm-lto -import-full-type-definitions -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=FULL
23 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.out -save-temps \
24 ; RUN: -import-full-type-definitions \
25 ; RUN: -r %t2.bc,main,plx \
26 ; RUN: -r %t2.bc,foo,l \
27 ; RUN: -r %t1.bc,foo,pl
28 ; RUN: llvm-dis < %t.out.2.3.import.bc | FileCheck %s --check-prefix=FULL
30 ; FULL: distinct !DICompositeType(tag: DW_TAG_enumeration_type, name: "enum", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 50, size: 32, elements: !{{[0-9]+}}, identifier: "enum")
31 ; FULL: distinct !DICompositeType(tag: DW_TAG_class_type, name: "class", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 728, size: 448, elements: !{{[0-9]+}}, identifier: "class")
32 ; FULL: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, baseType: !{{[0-9]+}}, size: 128, offset: 64, elements: !{{[0-9]+}}, vtableHolder: !{{[0-9]+}}, templateParams: !{{[0-9]+}}, identifier: "list")
33 ; FULL: distinct !DICompositeType(tag: DW_TAG_union_type, file: !{{[0-9]+}}, line: 115, size: 384, elements: !{{[0-9]+}}, identifier: "union")
35 ; ModuleID = 'debuginfo-compositetype-import.c'
36 source_filename = "debuginfo-compositetype-import.c"
37 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
38 target triple = "x86_64-unknown-linux-gnu"
40 ; Function Attrs: nounwind uwtable
41 define void @foo() #0 !dbg !6 {
47 !llvm.module.flags = !{!2, !3}
50 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0 (trunk 286863) (llvm/trunk 286875)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
51 !1 = !DIFile(filename: "debuginfo-compositetype-import.c", directory: "")
52 !2 = !{i32 2, !"Dwarf Version", i32 4}
53 !3 = !{i32 2, !"Debug Info Version", i32 3}
54 !4 = !{!"clang version 4.0.0 (trunk 286863) (llvm/trunk 286875)"}
56 !6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !5)
57 !7 = !DISubroutineType(types: !8)
58 !8 = !{!9, !10, !11, !12}
59 !9 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "enum", scope: !1, file: !1, line: 50, size: 32, elements: !5, identifier: "enum")
60 !10 = !DICompositeType(tag: DW_TAG_class_type, name: "class", scope: !1, file: !1, line: 728, size: 448, elements: !5, identifier: "class")
61 !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct", scope: !1, file: !1, line: 309, baseType: !10, size: 128, offset: 64, elements: !5, vtableHolder: !10, templateParams: !5, identifier: "list")
62 !12 = distinct !DICompositeType(tag: DW_TAG_union_type, file: !1, line: 115, size: 384, elements: !5, identifier: "union")