1; RUN: rm -rf %t %t2
2; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
3; RUN: llvm-dwarfdump -verbose -name=vla %t > %t2
4; RUN: llvm-dwarfdump -verbose %t >> %t2
5; RUN: cat %t2 | FileCheck %s
6
7; This test runs llvm-dwarfdump twice:
8; - First to get the debug entry for 'vla', to get the array type node.
9; - Second to check that the type entry does not contain a DW_AT_count.
10
11; CHECK:       DW_AT_type [DW_FORM_ref4]   (cu + {{.*}} => {[[NODE:0x[0-9a-z]+]]}
12; CHECK:       [[NODE]]: DW_TAG_array_type
13; CHECK:       DW_TAG_subrange_type
14; CHECK-NOT:   DW_AT_count
15; CHECK:       DW_TAG_subrange_type
16; CHECK-NOT:   DW_AT_count
17
18define void @foo(i32 %n) !dbg !7 {
19entry:
20  ret void, !dbg !21
21}
22
23!llvm.dbg.cu = !{!0}
24!llvm.module.flags = !{!3, !4, !5}
25!llvm.ident = !{!6}
26
27!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.1", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
28!1 = !DIFile(filename: "vla.c", directory: "/path/to")
29!2 = !{}
30!3 = !{i32 2, !"Dwarf Version", i32 4}
31!4 = !{i32 2, !"Debug Info Version", i32 3}
32!5 = !{i32 1, !"wchar_size", i32 4}
33!6 = !{!"clang version 5.0.1"}
34!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)
35!8 = !DISubroutineType(types: !9)
36!9 = !{null, !10}
37!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
38!11 = !{!12, !15}
39!12 = !DILocalVariable(name: "n", arg: 1, scope: !7, file: !1, line: 20, type: !10)
40!13 = !DILocalVariable(name: "vla_expr", scope: !7, file: !1, line: 21, type: !14)
41!14 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned)
42!15 = !DILocalVariable(name: "vla", scope: !7, file: !1, line: 21, type: !16)
43!16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, align: 32, elements: !17)
44!17 = !{!18, !18}
45!18 = !DISubrange(count: !13)
46!19 = !DIExpression()
47!20 = !DILocation(line: 20, column: 14, scope: !7)
48!21 = !DILocation(line: 22, column: 1, scope: !7)
49