• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | llvm-dwarfdump - | FileCheck %s
2; CHECK:  DW_TAG_subprogram
3; CHECK:    DW_AT_name	("h")
4; CHECK: 0x00000[[VLAEXPR:.*]]:     DW_TAG_variable
5; CHECK-NEXT:    DW_AT_name	("vla_expr")
6; CHECK:        DW_TAG_array_type
7; CHECK-NEXT:     DW_AT_type	{{.*}}"int"
8; CHECK-NOT: DW_TAG
9; CHECK:        DW_TAG_subrange_type
10; CHECK-NEXT:     DW_AT_type {{.*}}"__ARRAY_SIZE_TYPE__"
11; CHECK-NEXT:     DW_AT_count	(0x00000[[VLAEXPR]]
12;
13;
14; Generated from (and then modified):
15;
16; #define DECLARE_ARRAY(type, var_name, size) type var_name[size]
17;
18; void h(void);
19; void k(void *);
20;
21; void g() {
22;   h();
23; }
24;
25; void h() {
26;   int count = 2;
27;   DECLARE_ARRAY(int, array, count);
28;   k((void *)array);
29; }
30source_filename = "/tmp/test.c"
31target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
32target triple = "x86_64-apple-macosx10.13.0"
33
34; Function Attrs: nounwind ssp uwtable
35define void @g() local_unnamed_addr #0 !dbg !10 {
36entry:
37  %vla2.i = alloca [2 x i32], align 16, !dbg !13
38  call void @llvm.dbg.declare(metadata [2 x i32]* %vla2.i, metadata !20, metadata !DIExpression(DW_OP_stack_value)), !dbg !13
39  %0 = bitcast [2 x i32]* %vla2.i to i8*, !dbg !25
40  call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0), !dbg !25
41  call void @llvm.dbg.value(metadata i32 2, metadata !16, metadata !DIExpression()) #3, !dbg !25
42  call void @llvm.dbg.value(metadata i64 2, metadata !18, metadata !DIExpression()) #3, !dbg !13
43  call void @llvm.dbg.value(metadata i32 2, metadata !16, metadata !DIExpression()) #3, !dbg !25
44  call void @llvm.dbg.value(metadata i64 2, metadata !18, metadata !DIExpression()) #3, !dbg !13
45  call void @k(i8* nonnull %0) #3, !dbg !26
46  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0), !dbg !27
47  ret void, !dbg !28
48}
49
50; Function Attrs: nounwind readnone speculatable
51declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
52
53declare void @k(i8*) local_unnamed_addr
54
55; Function Attrs: nounwind readnone speculatable
56declare void @llvm.dbg.value(metadata, metadata, metadata) #1
57
58; Function Attrs: argmemonly nounwind
59declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2
60
61; Function Attrs: argmemonly nounwind
62declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2
63
64attributes #0 = { nounwind ssp uwtable }
65attributes #1 = { nounwind readnone speculatable }
66attributes #2 = { argmemonly nounwind }
67attributes #3 = { nounwind }
68
69!llvm.dbg.cu = !{!0}
70!llvm.module.flags = !{!5, !6, !7, !8}
71!llvm.ident = !{!9}
72
73!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0 (trunk 324259) (llvm/trunk 324261)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3)
74!1 = !DIFile(filename: "/tmp/test.c", directory: "/")
75!2 = !{}
76!3 = !{!4}
77!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
78!5 = !{i32 2, !"Dwarf Version", i32 4}
79!6 = !{i32 2, !"Debug Info Version", i32 3}
80!7 = !{i32 1, !"wchar_size", i32 4}
81!8 = !{i32 7, !"PIC Level", i32 2}
82!9 = !{!"clang version 7.0.0 (trunk 324259) (llvm/trunk 324261)"}
83!10 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 6, type: !11, isLocal: false, isDefinition: true, scopeLine: 6, isOptimized: true, unit: !0, retainedNodes: !2)
84!11 = !DISubroutineType(types: !12)
85!12 = !{null}
86!13 = !DILocation(line: 12, column: 3, scope: !14, inlinedAt: !24)
87!14 = distinct !DISubprogram(name: "h", scope: !1, file: !1, line: 10, type: !11, isLocal: false, isDefinition: true, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !15)
88!15 = !{!16, !18, !20}
89!16 = !DILocalVariable(name: "count", scope: !14, file: !1, line: 11, type: !17)
90!17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
91!18 = !DILocalVariable(name: "vla_expr", scope: !14, file: !1, line: 12, type: !19)
92!19 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned)
93!20 = !DILocalVariable(name: "array", scope: !14, file: !1, line: 12, type: !21)
94!21 = !DICompositeType(tag: DW_TAG_array_type, baseType: !17, elements: !22)
95!22 = !{!23}
96!23 = !DISubrange(count: !18)
97!24 = distinct !DILocation(line: 7, column: 3, scope: !10)
98!25 = !DILocation(line: 11, column: 7, scope: !14, inlinedAt: !24)
99!26 = !DILocation(line: 13, column: 3, scope: !14, inlinedAt: !24)
100!27 = !DILocation(line: 14, column: 1, scope: !14, inlinedAt: !24)
101!28 = !DILocation(line: 8, column: 1, scope: !10)
102