David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 3 | ; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 4 | |
| 5 | ; IR generated with `clang++ -g -emit-llvm -S` from the following code: |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 6 | ; template<int x, int*, template<typename> class y, decltype(nullptr) n, int ...z> int func() { return 3; } |
David Blaikie | a1ae0e6 | 2013-08-01 20:30:22 +0000 | [diff] [blame] | 7 | ; template<typename> struct y_impl { struct nested { }; }; |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 8 | ; int glbl = func<3, &glbl, y_impl, nullptr, 1, 2>(); |
David Blaikie | a1ae0e6 | 2013-08-01 20:30:22 +0000 | [diff] [blame] | 9 | ; y_impl<int>::nested n; |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 10 | |
| 11 | ; CHECK: [[INT:0x[0-9a-f]*]]:{{ *}}DW_TAG_base_type |
| 12 | ; CHECK-NEXT: DW_AT_name{{.*}} = "int" |
| 13 | |
David Blaikie | a1ae0e6 | 2013-08-01 20:30:22 +0000 | [diff] [blame] | 14 | ; CHECK: DW_TAG_structure_type |
| 15 | ; CHECK-NEXT: DW_AT_name{{.*}}"y_impl<int>" |
| 16 | ; CHECK-NOT: NULL |
| 17 | ; CHECK: DW_TAG_template_type_parameter |
| 18 | |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 19 | ; CHECK: DW_AT_name{{.*}}"func<3, &glbl, y_impl, nullptr, 1, 2>" |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 20 | ; CHECK-NOT: NULL |
| 21 | ; CHECK: DW_TAG_template_value_parameter |
| 22 | ; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]} |
| 23 | ; CHECK-NEXT: DW_AT_name{{.*}}= "x" |
Eric Christopher | 9d1daa8 | 2013-08-27 23:49:04 +0000 | [diff] [blame] | 24 | ; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(3) |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 25 | |
| 26 | ; CHECK: DW_TAG_template_value_parameter |
Manman Ren | 73d697c | 2013-10-29 00:58:04 +0000 | [diff] [blame] | 27 | ; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INTPTR:0x[0-9a-f]*]]} |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 28 | |
| 29 | ; The address of the global 'glbl', followed by DW_OP_stack_value (9f), to use |
| 30 | ; the value immediately, rather than indirecting through the address. |
| 31 | |
Eric Christopher | 4a74104 | 2014-02-16 08:46:55 +0000 | [diff] [blame] | 32 | ; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]{{ *}}(<0xa> 03 00 00 00 00 00 00 00 00 9f ) |
David Blaikie | 2b38023 | 2013-06-22 18:59:11 +0000 | [diff] [blame] | 33 | ; CHECK-NOT: NULL |
| 34 | |
| 35 | ; CHECK: DW_TAG_GNU_template_template_param |
| 36 | ; CHECK-NEXT: DW_AT_name{{.*}}= "y" |
| 37 | ; CHECK-NEXT: DW_AT_GNU_template_name{{.*}}= "y_impl" |
| 38 | ; CHECK-NOT: NULL |
| 39 | |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 40 | ; CHECK: DW_TAG_template_value_parameter |
| 41 | ; CHECK-NEXT: DW_AT_type{{.*}}=> {[[NULLPTR:0x[0-9a-f]*]]} |
| 42 | ; CHECK-NEXT: DW_AT_name{{.*}}= "n" |
| 43 | ; CHECK-NEXT: DW_AT_const_value [DW_FORM_udata]{{.*}}(0) |
| 44 | |
David Blaikie | 2b38023 | 2013-06-22 18:59:11 +0000 | [diff] [blame] | 45 | ; CHECK: DW_TAG_GNU_template_parameter_pack |
| 46 | ; CHECK-NOT: NULL |
| 47 | ; CHECK: DW_TAG_template_value_parameter |
| 48 | ; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]} |
Eric Christopher | 9d1daa8 | 2013-08-27 23:49:04 +0000 | [diff] [blame] | 49 | ; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(1) |
David Blaikie | 2b38023 | 2013-06-22 18:59:11 +0000 | [diff] [blame] | 50 | ; CHECK-NOT: NULL |
| 51 | ; CHECK: DW_TAG_template_value_parameter |
| 52 | ; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]} |
Eric Christopher | 9d1daa8 | 2013-08-27 23:49:04 +0000 | [diff] [blame] | 53 | ; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(2) |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 54 | |
Manman Ren | 73d697c | 2013-10-29 00:58:04 +0000 | [diff] [blame] | 55 | ; CHECK: [[INTPTR]]:{{ *}}DW_TAG_pointer_type |
| 56 | ; CHECK-NEXT: DW_AT_type{{.*}} => {[[INT]]} |
| 57 | |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 58 | ; CHECK: [[NULLPTR]]:{{ *}}DW_TAG_unspecified_type |
| 59 | ; CHECK-NEXT: DW_AT_name{{.*}}= "decltype(nullptr)" |
| 60 | |
David Blaikie | a1ae0e6 | 2013-08-01 20:30:22 +0000 | [diff] [blame] | 61 | %"struct.y_impl<int>::nested" = type { i8 } |
David Blaikie | 2b38023 | 2013-06-22 18:59:11 +0000 | [diff] [blame] | 62 | |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 63 | @glbl = global i32 0, align 4 |
David Blaikie | a1ae0e6 | 2013-08-01 20:30:22 +0000 | [diff] [blame] | 64 | @n = global %"struct.y_impl<int>::nested" zeroinitializer, align 1 |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 65 | @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_template.cpp, i8* null }] |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 66 | |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 67 | define internal void @__cxx_global_var_init() section ".text.startup" !dbg !10 { |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 68 | entry: |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 69 | %call = call i32 @_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv(), !dbg !36 |
| 70 | store i32 %call, i32* @glbl, align 4, !dbg !36 |
| 71 | ret void, !dbg !36 |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | ; Function Attrs: nounwind uwtable |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 75 | define linkonce_odr i32 @_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv() #0 !dbg !14 { |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 76 | entry: |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 77 | ret i32 3, !dbg !37 |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 78 | } |
| 79 | |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 80 | define internal void @_GLOBAL__sub_I_template.cpp() section ".text.startup" { |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 81 | entry: |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 82 | call void @__cxx_global_var_init(), !dbg !38 |
| 83 | ret void |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 84 | } |
| 85 | |
Eric Christopher | 96eff3f | 2013-10-17 01:31:12 +0000 | [diff] [blame] | 86 | attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 87 | |
| 88 | !llvm.dbg.cu = !{!0} |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 89 | !llvm.module.flags = !{!33, !34} |
| 90 | !llvm.ident = !{!35} |
David Blaikie | a1e813d | 2013-05-10 21:52:07 +0000 | [diff] [blame] | 91 | |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame^] | 92 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 224394) (llvm/trunk 224384)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !30, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 93 | !1 = !DIFile(filename: "template.cpp", directory: "/tmp/dbginfo") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 94 | !2 = !{} |
| 95 | !3 = !{!4, !8} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 96 | !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "y_impl<int>", line: 2, size: 8, align: 8, file: !1, elements: !2, templateParams: !5, identifier: "_ZTS6y_implIiE") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 97 | !5 = !{!6} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 98 | !6 = !DITemplateTypeParameter(type: !7) |
| 99 | !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 100 | !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "nested", line: 2, size: 8, align: 8, file: !1, scope: !"_ZTS6y_implIiE", elements: !2, identifier: "_ZTSN6y_implIiE6nestedE") |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame^] | 101 | !10 = distinct !DISubprogram(name: "__cxx_global_var_init", line: 3, isLocal: true, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !11, type: !12, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 102 | !11 = !DIFile(filename: "template.cpp", directory: "/tmp/dbginfo") |
| 103 | !12 = !DISubroutineType(types: !13) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 104 | !13 = !{null} |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame^] | 105 | !14 = distinct !DISubprogram(name: "func<3, &glbl, y_impl, nullptr, 1, 2>", linkageName: "_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv", line: 1, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !11, type: !15, templateParams: !17, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 106 | !15 = !DISubroutineType(types: !16) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 107 | !16 = !{!7} |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 108 | !17 = !{!18, !19, !21, !22, !24} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 109 | !18 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "x", type: !7, value: i32 3) |
| 110 | !19 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, type: !20, value: i32* @glbl) |
| 111 | !20 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !7) |
| 112 | !21 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_template_param, name: "y", type: null, value: !"y_impl") |
| 113 | !22 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "n", type: !23, value: i8 0) |
| 114 | !23 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)") |
| 115 | !24 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "z", type: null, value: !25) |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 116 | !25 = !{!26, !27} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 117 | !26 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, type: !7, value: i32 1) |
| 118 | !27 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, type: !7, value: i32 2) |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame^] | 119 | !28 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__sub_I_template.cpp", isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !0, file: !1, scope: !11, type: !29, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 120 | !29 = !DISubroutineType(types: !2) |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 121 | !30 = !{!31, !32} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 122 | !31 = !DIGlobalVariable(name: "glbl", line: 3, isLocal: false, isDefinition: true, scope: null, file: !11, type: !7, variable: i32* @glbl) |
| 123 | !32 = !DIGlobalVariable(name: "n", line: 4, isLocal: false, isDefinition: true, scope: null, file: !11, type: !"_ZTSN6y_implIiE6nestedE", variable: %"struct.y_impl<int>::nested"* @n) |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 124 | !33 = !{i32 2, !"Dwarf Version", i32 4} |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 125 | !34 = !{i32 2, !"Debug Info Version", i32 3} |
David Blaikie | 8b979f0 | 2014-12-17 00:43:22 +0000 | [diff] [blame] | 126 | !35 = !{!"clang version 3.6.0 (trunk 224394) (llvm/trunk 224384)"} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 127 | !36 = !DILocation(line: 3, column: 12, scope: !10) |
| 128 | !37 = !DILocation(line: 1, column: 96, scope: !14) |
| 129 | !38 = !DILocation(line: 0, scope: !28) |