xref: /llvm-project/llvm/test/DebugInfo/X86/template-alias.ll (revision 8d6a9c05f6d676c93c84ebf06cf6263657e74c00)
1; RUN: llc %s -o - --filetype=obj | llvm-dwarfdump - --name A --show-children | FileCheck %s --check-prefix=TREE
2
3;; -ggnu-pubnames (nameTableKind: GNU).
4; RUN: llc %s -o - --filetype=obj \
5; RUN: | llvm-dwarfdump - --debug-gnu-pubtypes \
6; RUN: | FileCheck %s --check-prefix=GNU-TYPES
7
8;; -gpubnames (remove nameTableKind field from DICompileUnit).
9; RUN: sed 's/, nameTableKind: GNU//g' < %s \
10; RUN: | llc - -o - --filetype=obj \
11; RUN: | llvm-dwarfdump - --debug-pubtypes \
12; RUN: | FileCheck %s --check-prefix=PUB-TYPES
13
14;; C++ source from clang/test/CodeGenCXX/template-alias.cpp, compiled with -gsce:
15;; template<typename Y, int Z>
16;; struct X {
17;;   Y m1 = Z;
18;; };
19;;
20;; template<typename B, int C>
21;; using A = X<B, C>;
22;;
23;; A<int, 5> a;
24
25;; Test emission of DIDerivedType with tag: DW_TAG_template_alias.
26
27; TREE: DW_TAG_template_alias
28; TREE: DW_AT_type (0x{{[0-9a-f]+}} "X<int, 5>")
29; TREE: DW_AT_name ("A")
30; TREE:   DW_TAG_template_type_parameter
31; TREE:     DW_AT_type        (0x{{[0-9a-f]+}} "int")
32; TREE:     DW_AT_name        ("B")
33; TREE:   DW_TAG_template_value_parameter
34; TREE:     DW_AT_type        (0x{{[0-9a-f]+}} "int")
35; TREE:     DW_AT_name        ("C")
36; TREE:     DW_AT_const_value (5)
37; TREE:   NULL
38
39; GNU-TYPES: STATIC   TYPE     "A"
40; PUB-TYPES: "A"
41
42target triple = "x86_64-unknown-unkown"
43
44%struct.X = type { i32 }
45
46@a = global %struct.X { i32 5 }, align 4, !dbg !0
47
48!llvm.dbg.cu = !{!2}
49!llvm.module.flags = !{!17, !18}
50!llvm.ident = !{!19}
51
52!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
53!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !5, line: 14, type: !6, isLocal: false, isDefinition: true)
54!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 19.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: GNU)
55!3 = !DIFile(filename: "<stdin>", directory: "/")
56!4 = !{!0}
57!5 = !DIFile(filename: "clang/test/CodeGenCXX/template-alias.cpp", directory: "/")
58!6 = !DIDerivedType(tag: DW_TAG_template_alias, name: "A", file: !5, line: 12, baseType: !7, extraData: !14)
59!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "X<int, 5>", file: !5, line: 7, size: 32, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !8, templateParams: !11, identifier: "_ZTS1XIiLi5EE")
60!8 = !{!9}
61!9 = !DIDerivedType(tag: DW_TAG_member, name: "m1", scope: !7, file: !5, line: 8, baseType: !10, size: 32)
62!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
63!11 = !{!12, !13}
64!12 = !DITemplateTypeParameter(name: "Y", type: !10)
65!13 = !DITemplateValueParameter(name: "Z", type: !10, value: i32 5)
66!14 = !{!15, !16}
67!15 = !DITemplateTypeParameter(name: "B", type: !10)
68!16 = !DITemplateValueParameter(name: "C", type: !10, value: i32 5)
69!17 = !{i32 2, !"Debug Info Version", i32 3}
70!18 = !{i32 1, !"wchar_size", i32 4}
71!19 = !{!"clang version 19.0.0git"}
72