xref: /llvm-project/llvm/test/DebugInfo/Generic/artificial-static-member.ll (revision 2e0a3c281b31eeffb1c12b53360f22760e246af2)
1; REQUIRES: target={{x86_64-.*-linux.*}}
2; RUN: llc -O0 -filetype=obj < %s |   \
3; RUN: llvm-dwarfdump --debug-info - | FileCheck %s
4
5; LLVM IR generated from:
6
7; struct S {
8;   static int Member;   <-- Manually marked as artificial
9; };
10; int S::Member = 1;
11
12source_filename = "artificial-static-member.cpp"
13target triple = "x86_64-pc-linux-gnu"
14
15@_ZN1S6MemberE = dso_local global i32 1, align 4, !dbg !0
16
17!llvm.dbg.cu = !{!2}
18!llvm.module.flags = !{!9, !10}
19
20!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
21!1 = distinct !DIGlobalVariable(name: "Member", linkageName: "_ZN1S6MemberE", scope: !2, type: !5, isLocal: false, isDefinition: true, declaration: !6)
22!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, emissionKind: FullDebug, globals: !4)
23!3 = !DIFile(filename: "artificial-static-member.cpp", directory: "")
24!4 = !{!0}
25!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
26!6 = !DIDerivedType(tag: DW_TAG_variable, name: "Member", scope: !7, baseType: !5, flags: DIFlagArtificial | DIFlagStaticMember)
27!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", size: 8, flags: DIFlagTypePassByValue, elements: !8, identifier: "_ZTS1S")
28!8 = !{!6}
29!9 = !{i32 7, !"Dwarf Version", i32 5}
30!10 = !{i32 2, !"Debug Info Version", i32 3}
31
32; CHECK: {{.*}}DW_TAG_structure_type
33; CHECK-NEXT: DW_AT_calling_convention
34; CHECK-NEXT: DW_AT_name	("S")
35; CHECK-NEXT: DW_AT_byte_size
36
37; CHECK: {{.*}}DW_TAG_variable
38; CHECK-NEXT: DW_AT_name	("Member")
39; CHECK-NEXT: DW_AT_type
40; CHECK-NEXT: DW_AT_external	(true)
41; CHECK-NEXT: DW_AT_declaration	(true)
42; CHECK-NEXT: DW_AT_artificial	(true)
43