1; AIX doesn't support the debug_addr section 2; UNSUPPORTED: target={{.*}}-aix{{.*}} 3 4; RUN: %llc_dwarf -filetype=obj -o %t.o < %s 5; RUN: llvm-dwarfdump -v -debug-info %t.o | FileCheck %s -check-prefix=CHECK 6 7; LLVM IR generated using: clang -emit-llvm -S -g -gdwarf-5 8; 9; struct C 10; { 11; static int a; 12; const static bool b = true; 13; static constexpr int c = 15; 14; }; 15; 16; int C::a = 10; 17; 18; int main() 19; { 20; C instance_C; 21; return C::a + (int)C::b + C::c; 22; } 23 24source_filename = "llvm/test/DebugInfo/X86/dwarf5-debug-info-static-member.ll" 25 26%struct.C = type { i8 } 27 28@_ZN1C1aE = global i32 10, align 4, !dbg !0 29 30; Function Attrs: mustprogress noinline norecurse nounwind optnone ssp uwtable(sync) 31define noundef i32 @main() #0 !dbg !26 { 32entry: 33 %retval = alloca i32, align 4 34 %instance_C = alloca %struct.C, align 1 35 store i32 0, ptr %retval, align 4 36 call void @llvm.dbg.declare(metadata ptr %instance_C, metadata !30, metadata !DIExpression()), !dbg !31 37 %0 = load i32, ptr @_ZN1C1aE, align 4, !dbg !32 38 %add = add nsw i32 %0, 1, !dbg !33 39 %add1 = add nsw i32 %add, 15, !dbg !34 40 ret i32 %add1, !dbg !35 41} 42 43; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 44declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 45 46attributes #0 = { nounwind uwtable } 47attributes #1 = { nounwind readnone } 48 49!llvm.dbg.cu = !{!2} 50!llvm.module.flags = !{!19, !20, !21, !22, !23, !24} 51!llvm.ident = !{!25} 52 53!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 54!1 = distinct !DIGlobalVariable(name: "a", linkageName: "_ZN1C1aE", scope: !2, file: !3, line: 8, type: !5, isLocal: false, isDefinition: true, declaration: !8) 55!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 18.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !4, globals: !14, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") 56!3 = !DIFile(filename: "main.cpp", directory: "/tmp", checksumkind: CSK_MD5, checksum: "b2547f7df8f54777c012dbfbd626f155") 57!4 = !{!5, !6} 58!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 59!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !7, identifier: "_ZTS1C") 60!7 = !{!8, !9, !12} 61!8 = !DIDerivedType(tag: DW_TAG_variable, name: "a", scope: !6, file: !3, line: 3, baseType: !5, flags: DIFlagStaticMember) 62!9 = !DIDerivedType(tag: DW_TAG_variable, name: "b", scope: !6, file: !3, line: 4, baseType: !10, flags: DIFlagStaticMember) 63!10 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !11) 64!11 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) 65!12 = !DIDerivedType(tag: DW_TAG_variable, name: "c", scope: !6, file: !3, line: 5, baseType: !13, flags: DIFlagStaticMember) 66!13 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !5) 67!14 = !{!0, !15, !17} 68!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression(DW_OP_constu, 1, DW_OP_stack_value)) 69!16 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 4, type: !10, isLocal: true, isDefinition: true, declaration: !9) 70!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression(DW_OP_constu, 15, DW_OP_stack_value)) 71!18 = distinct !DIGlobalVariable(name: "c", scope: !2, file: !3, line: 5, type: !13, isLocal: true, isDefinition: true, declaration: !12) 72!19 = !{i32 7, !"Dwarf Version", i32 5} 73!20 = !{i32 2, !"Debug Info Version", i32 3} 74!21 = !{i32 1, !"wchar_size", i32 4} 75!22 = !{i32 8, !"PIC Level", i32 2} 76!23 = !{i32 7, !"uwtable", i32 1} 77!24 = !{i32 7, !"frame-pointer", i32 1} 78!25 = !{!"clang version 18.0.0"} 79!26 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 10, type: !27, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !29) 80!27 = !DISubroutineType(types: !28) 81!28 = !{!5} 82!29 = !{} 83!30 = !DILocalVariable(name: "instance_C", scope: !26, file: !3, line: 12, type: !6) 84!31 = !DILocation(line: 12, column: 5, scope: !26) 85!32 = !DILocation(line: 13, column: 10, scope: !26) 86!33 = !DILocation(line: 13, column: 15, scope: !26) 87!34 = !DILocation(line: 13, column: 27, scope: !26) 88!35 = !DILocation(line: 13, column: 3, scope: !26) 89 90; CHECK: .debug_info contents: 91; CHECK: DW_TAG_variable 92; CHECK-NEXT: DW_AT_specification {{.*}} "a" 93; CHECK: DW_TAG_structure_type 94; CHECK: DW_AT_name {{.*}} "C" 95; CHECK: DW_TAG_variable 96; CHECK-NEXT: DW_AT_name {{.*}} "a" 97; CHECK: DW_AT_external 98; CHECK: DW_AT_declaration 99; CHECK: DW_TAG_variable 100; CHECK-NEXT: DW_AT_name {{.*}} "b" 101; CHECK: DW_AT_external 102; CHECK: DW_AT_declaration 103; CHECK: DW_TAG_variable 104; CHECK-NEXT: DW_AT_name {{.*}} "c" 105; CHECK: DW_AT_external 106; CHECK: DW_AT_declaration 107; CHECK: NULL 108; CHECK: DW_TAG_variable 109; CHECK-NEXT: DW_AT_specification {{.*}} "b" 110; CHECK-NEXT: DW_AT_const_value 111; CHECK: DW_TAG_variable 112; CHECK-NEXT: DW_AT_specification {{.*}} "c" 113