1f4a2713aSLionel Sambuc; RUN: llc -O0 -mtriple=x86_64-linux-gnu %s -o %t -filetype=obj
2f4a2713aSLionel Sambuc; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
3f4a2713aSLionel Sambuc
4f4a2713aSLionel Sambuc; Verify that we've emitted template arguments for the union
5f4a2713aSLionel Sambuc; CHECK: DW_TAG_union_type
6f4a2713aSLionel Sambuc; CHECK-NEXT: "Value<float>"
7f4a2713aSLionel Sambuc; CHECK: DW_TAG_template_type_parameter
8f4a2713aSLionel Sambuc; CHECK: "T"
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambuc%"union.PR15637::Value" = type { i32 }
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc@_ZN7PR156371fE = global %"union.PR15637::Value" zeroinitializer, align 4
13f4a2713aSLionel Sambuc
14f4a2713aSLionel Sambucdefine void @_ZN7PR156371gEf(float %value) #0 {
15f4a2713aSLionel Sambucentry:
16f4a2713aSLionel Sambuc  %value.addr = alloca float, align 4
17f4a2713aSLionel Sambuc  %tempValue = alloca %"union.PR15637::Value", align 4
18f4a2713aSLionel Sambuc  store float %value, float* %value.addr, align 4
19*0a6a1f1dSLionel Sambuc  call void @llvm.dbg.declare(metadata float* %value.addr, metadata !23, metadata !{!"0x102"}), !dbg !24
20*0a6a1f1dSLionel Sambuc  call void @llvm.dbg.declare(metadata %"union.PR15637::Value"* %tempValue, metadata !25, metadata !{!"0x102"}), !dbg !26
21f4a2713aSLionel Sambuc  ret void, !dbg !27
22f4a2713aSLionel Sambuc}
23f4a2713aSLionel Sambuc
24*0a6a1f1dSLionel Sambucdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1
25f4a2713aSLionel Sambuc
26f4a2713aSLionel Sambucattributes #0 = { nounwind }
27f4a2713aSLionel Sambucattributes #1 = { nounwind readnone }
28f4a2713aSLionel Sambuc
29f4a2713aSLionel Sambuc!llvm.dbg.cu = !{!0}
30*0a6a1f1dSLionel Sambuc!llvm.module.flags = !{!28}
31f4a2713aSLionel Sambuc
32*0a6a1f1dSLionel Sambuc!0 = !{!"0x11\004\00clang version 3.3 (trunk 178499) (llvm/trunk 178472)\000\00\000\00\000", !1, !2, !2, !3, !9,  !2} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/foo.cc] [DW_LANG_C_plus_plus]
33*0a6a1f1dSLionel Sambuc!1 = !{!"foo.cc", !"/usr/local/google/home/echristo/tmp"}
34*0a6a1f1dSLionel Sambuc!2 = !{}
35*0a6a1f1dSLionel Sambuc!3 = !{!4}
36*0a6a1f1dSLionel Sambuc!4 = !{!"0x2e\00g\00g\00_ZN7PR156371gEf\003\000\001\000\006\00256\000\003", !1, !5, !6, null, void (float)* @_ZN7PR156371gEf, null, null, !2} ; [ DW_TAG_subprogram ] [line 3] [def] [g]
37*0a6a1f1dSLionel Sambuc!5 = !{!"0x39\00PR15637\001", !1, null} ; [ DW_TAG_namespace ] [PR15637] [line 1]
38*0a6a1f1dSLionel Sambuc!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
39*0a6a1f1dSLionel Sambuc!7 = !{null, !8}
40*0a6a1f1dSLionel Sambuc!8 = !{!"0x24\00float\000\0032\0032\000\000\004", null, null} ; [ DW_TAG_base_type ] [float] [line 0, size 32, align 32, offset 0, enc DW_ATE_float]
41*0a6a1f1dSLionel Sambuc!9 = !{!10}
42*0a6a1f1dSLionel Sambuc!10 = !{!"0x34\00f\00f\00_ZN7PR156371fE\006\000\001", !5, !11, !12, %"union.PR15637::Value"* @_ZN7PR156371fE, null} ; [ DW_TAG_variable ] [f] [line 6] [def]
43*0a6a1f1dSLionel Sambuc!11 = !{!"0x29", !1}         ; [ DW_TAG_file_type ] [/usr/local/google/home/echristo/tmp/foo.cc]
44*0a6a1f1dSLionel Sambuc!12 = !{!"0x17\00Value<float>\002\0032\0032\000\000\000", !1, !5, null, !13, null, !21, null} ; [ DW_TAG_union_type ] [Value<float>] [line 2, size 32, align 32, offset 0] [def] [from ]
45*0a6a1f1dSLionel Sambuc!13 = !{!14, !16}
46*0a6a1f1dSLionel Sambuc!14 = !{!"0xd\00a\002\0032\0032\000\000", !1, !12, !15} ; [ DW_TAG_member ] [a] [line 2, size 32, align 32, offset 0] [from int]
47*0a6a1f1dSLionel Sambuc!15 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
48*0a6a1f1dSLionel Sambuc!16 = !{!"0x2e\00Value\00Value\00\002\000\000\000\006\00320\000\002", !1, !12, !17, null, null, null, i32 0, !20} ; [ DW_TAG_subprogram ] [line 2] [Value]
49*0a6a1f1dSLionel Sambuc!17 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !18, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
50*0a6a1f1dSLionel Sambuc!18 = !{null, !19}
51*0a6a1f1dSLionel Sambuc!19 = !{!"0xf\00\000\0064\0064\000\001088", i32 0, null, !12} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from Value<float>]
52*0a6a1f1dSLionel Sambuc!20 = !{i32 786468}
53*0a6a1f1dSLionel Sambuc!21 = !{!22}
54*0a6a1f1dSLionel Sambuc!22 = !{!"0x2f\00T\000\000", null, !8, null} ; [ DW_TAG_template_type_parameter ]
55*0a6a1f1dSLionel Sambuc!23 = !{!"0x101\00value\0016777219\000", !4, !11, !8} ; [ DW_TAG_arg_variable ] [value] [line 3]
56*0a6a1f1dSLionel Sambuc!24 = !MDLocation(line: 3, scope: !4)
57*0a6a1f1dSLionel Sambuc!25 = !{!"0x100\00tempValue\004\000", !4, !11, !12} ; [ DW_TAG_auto_variable ] [tempValue] [line 4]
58*0a6a1f1dSLionel Sambuc!26 = !MDLocation(line: 4, scope: !4)
59*0a6a1f1dSLionel Sambuc!27 = !MDLocation(line: 5, scope: !4)
60*0a6a1f1dSLionel Sambuc!28 = !{i32 1, !"Debug Info Version", i32 2}
61