xref: /llvm-project/llvm/test/Bitcode/DITemplateParameter-5.0.ll (revision 7a42babeb83e3927e89e72a0e7e45be9d41b6c23)
1; RUN: llvm-dis -o - %s.bc | FileCheck %s
2
3; ModuleID = '/dir/test.cpp'
4source_filename = "test.cpp"
5target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-unknown-linux-gnu"
7
8%class.foo = type { i8 }
9%class.foo.0 = type { i8 }
10; Function Attrs: noinline norecurse nounwind optnone uwtable
11define dso_local i32 @main() #0 !dbg !7 {
12entry:
13  %retval = alloca i32, align 4
14  %f1 = alloca %class.foo, align 1
15  %f2 = alloca %class.foo.0, align 1
16  store i32 0, i32* %retval, align 4
17  call void @llvm.dbg.declare(metadata %class.foo* %f1, metadata !11, metadata !DIExpression()), !dbg !16
18  call void @llvm.dbg.declare(metadata %class.foo.0* %f2, metadata !17, metadata !DIExpression()), !dbg !23
19  ret i32 0, !dbg !24
20}
21; Function Attrs: nounwind readnone speculatable willreturn
22declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
23
24attributes #0 = { noinline norecurse nounwind optnone uwtable }
25attributes #1 = { nounwind readnone speculatable willreturn }
26
27!llvm.dbg.cu = !{!0}
28!llvm.module.flags = !{!3, !4, !5}
29!llvm.ident = !{!6}
30
31!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)
32!1 = !DIFile(filename: "test.cpp", directory: "/dir/", checksumkind: CSK_MD5, checksum: "863d08522c2300490dea873efc4b2369")
33!2 = !{}
34!3 = !{i32 7, !"Dwarf Version", i32 5}
35!4 = !{i32 2, !"Debug Info Version", i32 3}
36!5 = !{i32 1, !"wchar_size", i32 4}
37!6 = !{!"clang version 11.0.0"}
38!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 29, type: !8, scopeLine: 29, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
39!8 = !DISubroutineType(types: !9)
40!9 = !{!10}
41!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
42!11 = !DILocalVariable(name: "f1", scope: !7, file: !1, line: 30, type: !12)
43!12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<int, 6>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !13, identifier: "_ZTS3fooIiLi6EE")
44!13 = !{!14, !15}
45
46; Old-style DITemplateTypeParameter and DITemplateValueParameter should be
47; upgraded to include defaulted flag.
48
49; CHECK: !DITemplateTypeParameter({{.*}}
50!14 = !DITemplateTypeParameter(name: "T", type: !10)
51
52; CHECK: !DITemplateValueParameter({{.*}}
53!15 = !DITemplateValueParameter(name: "i", type: !10, value: i32 6)
54
55!16 = !DILocation(line: 30, column: 14, scope: !7)
56!17 = !DILocalVariable(name: "f2", scope: !7, file: !1, line: 31, type: !18)
57!18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<char, 3>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !19, identifier: "_ZTS3fooIcLi3EE")
58!19 = !{!20, !22}
59
60; CHECK: !DITemplateTypeParameter({{.*}} defaulted: true
61!20 = !DITemplateTypeParameter(name: "T", type: !21, defaulted: true)
62
63!21 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
64
65; CHECK: !DITemplateValueParameter({{.*}} defaulted: true
66!22 = !DITemplateValueParameter(name: "i", type: !10, defaulted: true, value: i32 3)
67
68!23 = !DILocation(line: 31, column: 9, scope: !7)
69!24 = !DILocation(line: 32, column: 3, scope: !7)
70