default-subrange-array.ll 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ; RUN: llc -mtriple=x86_64-apple-darwin -O0 -filetype=obj -dwarf-version 4 \
  2. ; RUN: -o - < %s | llvm-dwarfdump -v - --debug-info \
  3. ; RUN: | FileCheck %s -check-prefixes=CHECK,DWARF4
  4. ; RUN: llc -mtriple=x86_64-apple-darwin -O0 -filetype=obj -dwarf-version 5 \
  5. ; RUN: -o - < %s | llvm-dwarfdump -v - --debug-info \
  6. ; RUN: | FileCheck %s -check-prefixes=CHECK,DWARF5
  7. ; Check that we can omit default array lower-bounds.
  8. ; DW_LANG_C_plus_plus_11 is new in DWARF v5, so if we use that with
  9. ; DWARF v4, we should get the DW_AT_lower_bound attribute.
  10. source_filename = "test/DebugInfo/X86/default-subrange-array.ll"
  11. %class.A = type { [42 x i32] }
  12. @a = global %class.A zeroinitializer, align 4, !dbg !0
  13. ; CHECK: DW_TAG_class_type
  14. ; CHECK: DW_TAG_member
  15. ; CHECK-NEXT: DW_AT_name {{.*}} "x"
  16. ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}} => {[[ARRAY:0x[0-9a-f]+]]})
  17. ; CHECK: [[ARRAY]]: DW_TAG_array_type
  18. ; CHECK-NEXT: DW_AT_type
  19. ; CHECK: DW_TAG_subrange_type
  20. ; CHECK-NEXT: DW_AT_type
  21. ; DWARF4-NEXT: DW_AT_lower_bound [DW_FORM_data1] (0x00)
  22. ; CHECK-NEXT: DW_AT_count [DW_FORM_data1] (0x2a)
  23. ; DWARF5-NOT: DW_AT_lower_bound
  24. !llvm.dbg.cu = !{!14}
  25. !llvm.module.flags = !{!17}
  26. !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
  27. !1 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true)
  28. !2 = !DIFile(filename: "t.cpp", directory: "/Volumes/Sandbox/llvm")
  29. !3 = !DICompositeType(tag: DW_TAG_class_type, name: "A", file: !2, line: 1, align: 32, elements: !4)
  30. !4 = !{!5, !10}
  31. !5 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !3, file: !2, line: 1, baseType: !6, flags: DIFlagPrivate)
  32. !6 = !DICompositeType(tag: DW_TAG_array_type, baseType: !7, align: 32, elements: !8)
  33. !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  34. !8 = !{!9}
  35. !9 = !DISubrange(count: 42, lowerBound: 0)
  36. !10 = !DISubprogram(name: "A", scope: !3, file: !2, line: 1, type: !11, isLocal: false, isDefinition: false, scopeLine: 1, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false)
  37. !11 = !DISubroutineType(types: !12)
  38. !12 = !{null, !13}
  39. !13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
  40. !14 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_11, file: !2, producer: "clang version 3.3 (trunk 169136)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !15, retainedTypes: !15, globals: !16, imports: !15)
  41. !15 = !{}
  42. !16 = !{!0}
  43. !17 = !{i32 1, !"Debug Info Version", i32 3}