1 ; REQUIRES: object-emission
3 ; RUN: llc -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
4 ; RUN: | llvm-dwarfdump -debug-info -debug-types - | FileCheck %s
9 ; CHECK: DW_TAG_structure
10 ; CHECK-NOT: {{DW_TAG|NULL}}
11 ; CHECK: DW_AT_name ("foo")
12 ; CHECK-NOT: {{DW_TAG|NULL}}
13 ; CHECK: DW_TAG_member
14 ; CHECK-NEXT: DW_AT_name ("x")
15 ; CHECK-NEXT: DW_AT_type ({{.*}} "int[1]"
17 ; But make sure we still use a type unit for an anonymous type that still has a
18 ; name for linkage purposes (due to being defined in a typedef).
21 ; CHECK: DW_TAG_structure
22 ; CHECK-NEXT: DW_AT_calling_convention
23 ; CHECK-NEXT: DW_AT_byte_size
24 ; CHECK-NEXT: DW_AT_decl_file
25 ; CHECK-NEXT: DW_AT_decl_line
29 %struct.foo = type { [1 x i32] }
30 %struct.bar = type { i8 }
32 ; Function Attrs: noinline nounwind optnone uwtable
33 define dso_local void @_Z1f3foo3bar(i32 %.coerce) #0 !dbg !7 {
35 %0 = alloca %struct.foo, align 4
36 %1 = alloca %struct.bar, align 1
37 %coerce.dive = getelementptr inbounds %struct.foo, %struct.foo* %0, i32 0, i32 0
38 %2 = bitcast [1 x i32]* %coerce.dive to i32*
39 store i32 %.coerce, i32* %2, align 4
40 call void @llvm.dbg.declare(metadata %struct.foo* %0, metadata !19, metadata !DIExpression()), !dbg !20
41 call void @llvm.dbg.declare(metadata %struct.bar* %1, metadata !21, metadata !DIExpression()), !dbg !22
45 ; Function Attrs: nounwind readnone speculatable
46 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
48 attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
49 attributes #1 = { nounwind readnone speculatable }
52 !llvm.module.flags = !{!3, !4, !5}
55 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 9.0.0 (trunk 360374) (llvm/trunk 360380)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
56 !1 = !DIFile(filename: "named_types.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
58 !3 = !{i32 2, !"Dwarf Version", i32 4}
59 !4 = !{i32 2, !"Debug Info Version", i32 3}
60 !5 = !{i32 1, !"wchar_size", i32 4}
61 !6 = !{!"clang version 9.0.0 (trunk 360374) (llvm/trunk 360380)"}
62 !7 = distinct !DISubprogram(name: "f", linkageName: "_Z1f3foo3bar", scope: !1, file: !1, line: 6, type: !8, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
63 !8 = !DISubroutineType(types: !9)
64 !9 = !{null, !10, !17}
65 !10 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !1, line: 1, size: 32, flags: DIFlagTypePassByValue, elements: !11, identifier: "_ZTS3foo")
67 !12 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !10, file: !1, line: 2, baseType: !13, size: 32)
68 !13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, size: 32, elements: !15)
69 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
71 !16 = !DISubrange(count: 1)
72 !17 = !DIDerivedType(tag: DW_TAG_typedef, name: "bar", file: !1, line: 5, baseType: !18)
73 !18 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 4, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: "_ZTS3bar")
74 !19 = !DILocalVariable(arg: 1, scope: !7, file: !1, line: 6, type: !10)
75 !20 = !DILocation(line: 6, column: 11, scope: !7)
76 !21 = !DILocalVariable(arg: 2, scope: !7, file: !1, line: 6, type: !17)
77 !22 = !DILocation(line: 6, column: 16, scope: !7)
78 !23 = !DILocation(line: 7, column: 1, scope: !7)