1 ; RUN: llvm-c-test --test-dibuilder | FileCheck %s
3 ; CHECK: ; ModuleID = 'debuginfo.c'
4 ; CHECK-NEXT: source_filename = "debuginfo.c"
6 ; CHECK: define i64 @foo(i64 %0, i64 %1, <10 x i64> %2) !dbg !31 {
8 ; CHECK-NEXT: call void @llvm.dbg.declare(metadata i64 0, metadata !38, metadata !DIExpression()), !dbg !43
9 ; CHECK-NEXT: call void @llvm.dbg.declare(metadata i64 0, metadata !39, metadata !DIExpression()), !dbg !43
10 ; CHECK-NEXT: call void @llvm.dbg.declare(metadata i64 0, metadata !40, metadata !DIExpression()), !dbg !43
11 ; CHECK: vars: ; No predecessors!
12 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 0, metadata !41, metadata !DIExpression(DW_OP_constu, 0, DW_OP_stack_value)), !dbg !44
15 ; CHECK: ; Function Attrs: nounwind readnone speculatable
16 ; CHECK-NEXT: declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
18 ; CHECK: ; Function Attrs: nounwind readnone speculatable
19 ; CHECK-NEXT: declare void @llvm.dbg.value(metadata, metadata, metadata) #0
21 ; CHECK: attributes #0 = { nounwind readnone speculatable willreturn }
23 ; CHECK: !llvm.dbg.cu = !{!0}
24 ; CHECK-NEXT: !FooType = !{!28}
25 ; CHECK-NEXT: !EnumTest = !{!3}
27 ; CHECK: !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "llvm-c-test", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !11, imports: !19, macros: !23, splitDebugInlining: false)
28 ; CHECK-NEXT: !1 = !DIFile(filename: "debuginfo.c", directory: ".")
29 ; CHECK-NEXT: !2 = !{!3}
30 ; CHECK-NEXT: !3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "EnumTest", scope: !4, file: !1, baseType: !6, size: 64, elements: !7)
31 ; CHECK-NEXT: !4 = !DINamespace(name: "NameSpace", scope: !5)
32 ; CHECK-NEXT: !5 = !DIModule(scope: null, name: "llvm-c-test", includePath: "/test/include/llvm-c-test.h")
33 ; CHECK-NEXT: !6 = !DIBasicType(name: "Int64", size: 64)
34 ; CHECK-NEXT: !7 = !{!8, !9, !10}
35 ; CHECK-NEXT: !8 = !DIEnumerator(name: "Test_A", value: 0, isUnsigned: true)
36 ; CHECK-NEXT: !9 = !DIEnumerator(name: "Test_B", value: 1, isUnsigned: true)
37 ; CHECK-NEXT: !10 = !DIEnumerator(name: "Test_B", value: 2, isUnsigned: true)
38 ; CHECK-NEXT: !11 = !{!12, !16}
39 ; CHECK-NEXT: !12 = !DIGlobalVariableExpression(var: !13, expr: !DIExpression(DW_OP_constu, 0, DW_OP_stack_value))
40 ; CHECK-NEXT: !13 = distinct !DIGlobalVariable(name: "globalClass", scope: !5, file: !1, line: 1, type: !14, isLocal: true, isDefinition: true)
41 ; CHECK-NEXT: !14 = !DICompositeType(tag: DW_TAG_structure_type, name: "TestClass", scope: !1, file: !1, line: 42, size: 64, flags: DIFlagObjcClassComplete, elements: !15)
42 ; CHECK-NEXT: !15 = !{}
43 ; CHECK-NEXT: !16 = !DIGlobalVariableExpression(var: !17, expr: !DIExpression(DW_OP_constu, 0, DW_OP_stack_value))
44 ; CHECK-NEXT: !17 = distinct !DIGlobalVariable(name: "global", scope: !5, file: !1, line: 1, type: !18, isLocal: true, isDefinition: true)
45 ; CHECK-NEXT: !18 = !DIDerivedType(tag: DW_TAG_typedef, name: "int64_t", scope: !1, file: !1, line: 42, baseType: !6)
46 ; CHECK-NEXT: !19 = !{!20, !22}
47 ; CHECK-NEXT: !20 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !5, entity: !21, file: !1, line: 42)
48 ; CHECK-NEXT: !21 = !DIModule(scope: null, name: "llvm-c-test-import", includePath: "/test/include/llvm-c-test-import.h")
49 ; CHECK-NEXT: !22 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !5, entity: !20, file: !1, line: 42)
50 ; CHECK-NEXT: !23 = !{!24}
51 ; CHECK-NEXT: !24 = !DIMacroFile(file: !1, nodes: !25)
52 ; CHECK-NEXT: !25 = !{!26, !27}
53 ; CHECK-NEXT: !26 = !DIMacro(type: DW_MACINFO_define, name: "SIMPLE_DEFINE")
54 ; CHECK-NEXT: !27 = !DIMacro(type: DW_MACINFO_define, name: "VALUE_DEFINE", value: "1")
55 ; CHECK-NEXT: !28 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !29, size: 192, dwarfAddressSpace: 0)
56 ; CHECK-NEXT: !29 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyStruct", scope: !4, file: !1, size: 192, elements: !30, runtimeLang: DW_LANG_C89, identifier: "MyStruct")
57 ; CHECK-NEXT: !30 = !{!6, !6, !6}
58 ; CHECK-NEXT: !31 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !1, file: !1, line: 42, type: !32, scopeLine: 42, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !37)
59 ; CHECK-NEXT: !32 = !DISubroutineType(types: !33)
60 ; CHECK-NEXT: !33 = !{!6, !6, !34}
61 ; CHECK-NEXT: !34 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 640, flags: DIFlagVector, elements: !35)
62 ; CHECK-NEXT: !35 = !{!36}
63 ; CHECK-NEXT: !36 = !DISubrange(count: 10)
64 ; CHECK-NEXT: !37 = !{!38, !39, !40, !41}
65 ; CHECK-NEXT: !38 = !DILocalVariable(name: "a", arg: 1, scope: !31, file: !1, line: 42, type: !6)
66 ; CHECK-NEXT: !39 = !DILocalVariable(name: "b", arg: 2, scope: !31, file: !1, line: 42, type: !6)
67 ; CHECK-NEXT: !40 = !DILocalVariable(name: "c", arg: 3, scope: !31, file: !1, line: 42, type: !34)
68 ; CHECK-NEXT: !41 = !DILocalVariable(name: "d", scope: !42, file: !1, line: 43, type: !6)
69 ; CHECK-NEXT: !42 = distinct !DILexicalBlock(scope: !31, file: !1, line: 42)
70 ; CHECK-NEXT: !43 = !DILocation(line: 42, scope: !31)
71 ; CHECK-NEXT: !44 = !DILocation(line: 43, scope: !31)