112 lines · plain
1; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump -v - | FileCheck %s2 3; C++ source to regenerate:4 5;template <typename T = char, int i = 3, float f = 1.0f, double d = 2.0>6;class foo {7;};8;9;int main() {10; foo<int, 6, 1.9f, 1.9> f1;11; foo<> f2;12; return 0;13;}14 15; $ clang++ -O0 -gdwarf-5 -S -gdwarf-5 test.cpp 16 17; CHECK: .debug_abbrev contents:18; CHECK: DW_AT_default_value DW_FORM_flag_present19 20; CHECK: debug_info contents:21 22; CHECK: DW_AT_name {{.*}} "foo<int, 6, 1.900000e+00, 1.900000e+00>"23; CHECK: DW_AT_type {{.*}} "int"24; CHECK-NEXT: DW_AT_name {{.*}} "T"25; CHECK-NOT: DW_AT_default_value26; CHECK: DW_AT_type {{.*}} "int"27; CHECK-NEXT: DW_AT_name {{.*}} "i"28; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (6)29; CHECK-NOT: DW_AT_default_value30; CHECK: DW_AT_type {{.*}} "float"31; CHECK-NEXT: DW_AT_name {{.*}} "f"32; CHECK-NEXT: DW_AT_const_value [DW_FORM_udata] (1072902963)33; CHECK-NOT: DW_AT_default_value34; CHECK: DW_AT_type {{.*}} "double"35; CHECK-NEXT: DW_AT_name {{.*}} "d"36; CHECK-NEXT: DW_AT_const_value [DW_FORM_udata] (4611235658464650854)37; CHECK-NOT: DW_AT_default_value38 39; CHECK: DW_AT_name {{.*}} "foo<char, 3, 1.000000e+00, 2.000000e+00>"40; CHECK: DW_AT_type {{.*}} "char"41; CHECK-NEXT: DW_AT_name {{.*}} "T"42; CHECK-NEXT: DW_AT_default_value {{.*}} (true)43; CHECK: DW_AT_type {{.*}} "int"44; CHECK-NEXT: DW_AT_name {{.*}} "i"45; CHECK-NEXT: DW_AT_default_value {{.*}} (true)46; CHECK: DW_AT_type {{.*}} "float"47; CHECK-NEXT: DW_AT_name {{.*}} "f"48; CHECK-NEXT: DW_AT_default_value {{.*}} (true)49; CHECK: DW_AT_type {{.*}} "double"50; CHECK-NEXT: DW_AT_name {{.*}} "d"51; CHECK-NEXT: DW_AT_default_value {{.*}} (true)52 53; ModuleID = '/dir/test.cpp'54source_filename = "test.cpp"55target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"56target triple = "x86_64-unknown-linux-gnu"57 58%class.foo = type { i8 }59%class.foo.0 = type { i8 }60; Function Attrs: noinline norecurse nounwind optnone uwtable61define dso_local i32 @main() #0 !dbg !7 {62entry:63 %retval = alloca i32, align 464 %f1 = alloca %class.foo, align 165 %f2 = alloca %class.foo.0, align 166 store i32 0, ptr %retval, align 467 call void @llvm.dbg.declare(metadata ptr %f1, metadata !11, metadata !DIExpression()), !dbg !1668 call void @llvm.dbg.declare(metadata ptr %f2, metadata !17, metadata !DIExpression()), !dbg !2369 ret i32 0, !dbg !2470}71; Function Attrs: nounwind readnone speculatable willreturn72declare void @llvm.dbg.declare(metadata, metadata, metadata) #173 74attributes #0 = { noinline norecurse nounwind optnone uwtable }75attributes #1 = { nounwind readnone speculatable willreturn }76 77!llvm.dbg.cu = !{!0}78!llvm.module.flags = !{!3, !4, !5}79!llvm.ident = !{!6}80 81!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)82!1 = !DIFile(filename: "test.cpp", directory: "/dir/", checksumkind: CSK_MD5, checksum: "863d08522c2300490dea873efc4b2369")83!2 = !{}84!3 = !{i32 7, !"Dwarf Version", i32 5}85!4 = !{i32 2, !"Debug Info Version", i32 3}86!5 = !{i32 1, !"wchar_size", i32 4}87!6 = !{!"clang version 11.0.0"}88!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 29, type: !8, scopeLine: 29, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)89!8 = !DISubroutineType(types: !9)90!9 = !{!10}91!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)92!11 = !DILocalVariable(name: "f1", scope: !7, file: !1, line: 30, type: !12)93!12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<int, 6, 1.900000e+00, 1.900000e+00>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !13, identifier: "_ZTS3fooIiLi6ELf3ff33333ELd3ffe666666666666EE")94!13 = !{!14, !15, !25, !27}95!14 = !DITemplateTypeParameter(name: "T", type: !10)96!15 = !DITemplateValueParameter(name: "i", type: !10, value: i32 6)97!16 = !DILocation(line: 30, column: 14, scope: !7)98!17 = !DILocalVariable(name: "f2", scope: !7, file: !1, line: 31, type: !18)99!18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<char, 3, 1.000000e+00, 2.000000e+00>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !19, identifier: "_ZTS3fooIcLi3ELf3f800000ELd4000000000000000EE")100!19 = !{!20, !22, !29, !30}101!20 = !DITemplateTypeParameter(name: "T", type: !21, defaulted: true)102!21 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)103!22 = !DITemplateValueParameter(name: "i", type: !10, defaulted: true, value: i32 3)104!23 = !DILocation(line: 31, column: 9, scope: !7)105!24 = !DILocation(line: 32, column: 3, scope: !7)106!25 = !DITemplateValueParameter(name: "f", type: !26, value: float 0x3FFE666660000000)107!26 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)108!27 = !DITemplateValueParameter(name: "d", type: !28, value: double 1.900000e+00)109!28 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)110!29 = !DITemplateValueParameter(name: "f", type: !26, defaulted: true, value: float 1.000000e+00)111!30 = !DITemplateValueParameter(name: "d", type: !28, defaulted: true, value: double 2.000000e+00)112