1; RUN: rm -rf %t %t2 2; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t 3; RUN: llvm-dwarfdump -name=vla_expr %t > %t2 4; RUN: llvm-dwarfdump -verbose %t >> %t2 5; RUN: cat %t2 | FileCheck %s 6 7; Repeat the test with experimental debuginfo iterators. 8; RUN: rm -rf %t %t2 9; RUN: %llc_dwarf --try-experimental-debuginfo-iterators -O0 -filetype=obj < %s > %t 10; RUN: llvm-dwarfdump -name=vla_expr %t > %t2 11; RUN: llvm-dwarfdump -verbose %t >> %t2 12; RUN: cat %t2 | FileCheck %s 13 14; This test runs llvm-dwarfdump twice: 15; - First to get the debug entry for 'vla_expr'. 16; - Second to check that this is the entry referenced in DW_AT_count. 17; This way the test does not depend on the order in which DW_TAG_variables 18; are emitted. 19 20; CHECK: [[NODE:[0-9a-zA-Zx]+]]: DW_TAG_variable [4] 21; CHECK-NEXT: DW_AT_name {{.*}}"vla_expr" 22; CHECK: DW_AT_count [DW_FORM_ref4] (cu + {{.*}} => {[[NODE]]}) 23 24define void @foo(i32 %n) !dbg !7 { 25entry: 26 call void @llvm.dbg.value(metadata i32 %n, i64 0, metadata !12, metadata !19), !dbg !20 27 ret void, !dbg !21 28} 29 30declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 31 32!llvm.dbg.cu = !{!0} 33!llvm.module.flags = !{!3, !4, !5} 34!llvm.ident = !{!6} 35 36!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.1", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 37!1 = !DIFile(filename: "vla.c", directory: "/path/to") 38!2 = !{} 39!3 = !{i32 2, !"Dwarf Version", i32 4} 40!4 = !{i32 2, !"Debug Info Version", i32 3} 41!5 = !{i32 1, !"wchar_size", i32 4} 42!6 = !{!"clang version 5.0.1"} 43!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 20, type: !8, isLocal: false, isDefinition: true, scopeLine: 20, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11) 44!8 = !DISubroutineType(types: !9) 45!9 = !{null, !10} 46!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 47!11 = !{!12, !13, !15} 48!12 = !DILocalVariable(name: "n", arg: 1, scope: !7, file: !1, line: 20, type: !10) 49!13 = !DILocalVariable(name: "vla_expr", scope: !7, file: !1, line: 21, type: !14) 50!14 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned) 51!15 = !DILocalVariable(name: "vla", scope: !7, file: !1, line: 21, type: !16) 52!16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, align: 32, elements: !17) 53!17 = !{!18, !18} 54!18 = !DISubrange(count: !13) 55!19 = !DIExpression() 56!20 = !DILocation(line: 20, column: 14, scope: !7) 57!21 = !DILocation(line: 22, column: 1, scope: !7) 58