Momchil Velikov | 08dc66e | 2018-02-12 16:10:09 +0000 | [diff] [blame] | 1 | ; Round-trip test for the following program: |
| 2 | ; ``` |
| 3 | ; enum E0 { A0 = -2147483648, B0 = 2147483647 } x0; |
| 4 | ; enum E1 : signed int { A1 = -2147483648, B1 = 2147483647 } x1; |
| 5 | ; enum E2 : signed long long { A2 = -9223372036854775807LL - 1, |
| 6 | ; B2 = 9223372036854775807LL } x2; |
| 7 | ; enum E3 : unsigned long long { A3 = 0x8000000000000000ULL } x3; |
| 8 | ; ``` |
| 9 | ; Test FixedEnum flag presence/absence, the underlying integer type and |
| 10 | ; enumerator values (signed and unsigned, and extreme cases) all survive through |
| 11 | ; the round-trip. |
| 12 | |
| 13 | ; RUN: llvm-as %s -o - | llvm-dis | llvm-as | llvm-dis | FileCheck %s |
| 14 | |
| 15 | @x0 = global i32 0, align 4, !dbg !0 |
| 16 | @x1 = global i32 0, align 4, !dbg !24 |
| 17 | @x2 = global i64 0, align 8, !dbg !26 |
| 18 | @x3 = global i64 0, align 8, !dbg !28 |
| 19 | |
| 20 | !llvm.dbg.cu = !{!2} |
| 21 | !llvm.module.flags = !{!30, !31, !32} |
| 22 | !llvm.ident = !{!33} |
| 23 | |
| 24 | !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 25 | !1 = distinct !DIGlobalVariable(name: "x0", scope: !2, file: !3, line: 1, type: !5, isLocal: false, isDefinition: true) |
| 26 | !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 (/data/src/llvm/tools/clang 697b0cb4c2e712a28767c2f7fe50c90bae7255f5) (/data/src/llvm 5ba8dcca7470b5da405bc92b9681b1f36e5d6772)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !23) |
| 27 | !3 = !DIFile(filename: "e.cc", directory: "/work/build/clang-dev") |
| 28 | !4 = !{!5, !10, !14, !19} |
| 29 | |
| 30 | |
| 31 | !5 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E0", file: !3, line: 1, baseType: !6, size: 32, elements: !7, identifier: "_ZTS2E0") |
| 32 | ; CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E0"{{.*}}, baseType: ![[INT:[0-9]+]] |
| 33 | ; CHECK-NOT: FixedEnum |
| 34 | !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 35 | ; CHECK: ![[INT]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 36 | !7 = !{!8, !9} |
| 37 | !8 = !DIEnumerator(name: "A0", value: -2147483648) |
| 38 | !9 = !DIEnumerator(name: "B0", value: 2147483647) |
| 39 | ; CHECK: !DIEnumerator(name: "A0", value: -2147483648) |
| 40 | ; CHECK: !DIEnumerator(name: "B0", value: 2147483647) |
| 41 | |
| 42 | |
Paul Robinson | 7402fd9 | 2019-01-08 17:52:29 +0000 | [diff] [blame] | 43 | !10 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E1", file: !3, line: 3, baseType: !6, size: 32, flags: DIFlagEnumClass, elements: !11, identifier: "_ZTS2E1") |
Momchil Velikov | 08dc66e | 2018-02-12 16:10:09 +0000 | [diff] [blame] | 44 | ; CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E1"{{.*}}, baseType: ![[INT]] |
Paul Robinson | 7402fd9 | 2019-01-08 17:52:29 +0000 | [diff] [blame] | 45 | ; CHECK-SAME: DIFlagEnumClass |
Momchil Velikov | 08dc66e | 2018-02-12 16:10:09 +0000 | [diff] [blame] | 46 | !11 = !{!12, !13} |
| 47 | !12 = !DIEnumerator(name: "A1", value: -2147483648) |
| 48 | !13 = !DIEnumerator(name: "B1", value: 2147483647) |
| 49 | ; CHECK: !DIEnumerator(name: "A1", value: -2147483648) |
| 50 | ; CHECK: !DIEnumerator(name: "B1", value: 2147483647) |
| 51 | |
| 52 | |
Paul Robinson | 7402fd9 | 2019-01-08 17:52:29 +0000 | [diff] [blame] | 53 | !14 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E2", file: !3, line: 5, baseType: !15, size: 64, flags: DIFlagEnumClass, elements: !16, identifier: "_ZTS2E2") |
Momchil Velikov | 08dc66e | 2018-02-12 16:10:09 +0000 | [diff] [blame] | 54 | ; CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E2"{{.*}}, baseType: ![[LONG:[0-9]+]] |
Paul Robinson | 7402fd9 | 2019-01-08 17:52:29 +0000 | [diff] [blame] | 55 | ; CHECK-SAME: DIFlagEnumClass |
Momchil Velikov | 08dc66e | 2018-02-12 16:10:09 +0000 | [diff] [blame] | 56 | !15 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed) |
| 57 | ; CHECK: ![[LONG]] = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed) |
| 58 | !16 = !{!17, !18} |
| 59 | !17 = !DIEnumerator(name: "A2", value: -9223372036854775808) |
| 60 | !18 = !DIEnumerator(name: "B2", value: 9223372036854775807) |
| 61 | ; CHECK: !DIEnumerator(name: "A2", value: -9223372036854775808) |
| 62 | ; CHECK: !DIEnumerator(name: "B2", value: 9223372036854775807) |
| 63 | |
| 64 | |
Paul Robinson | 7402fd9 | 2019-01-08 17:52:29 +0000 | [diff] [blame] | 65 | !19 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E3", file: !3, line: 7, baseType: !20, size: 64, flags: DIFlagEnumClass, elements: !21, identifier: "_ZTS2E3") |
Momchil Velikov | 08dc66e | 2018-02-12 16:10:09 +0000 | [diff] [blame] | 66 | ; CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E3"{{.*}}, baseType: ![[ULONG:[0-9]+]] |
Paul Robinson | 7402fd9 | 2019-01-08 17:52:29 +0000 | [diff] [blame] | 67 | ; CHECK-SAME: DIFlagEnumClass |
Momchil Velikov | 08dc66e | 2018-02-12 16:10:09 +0000 | [diff] [blame] | 68 | !20 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) |
| 69 | ; CHECK: ![[ULONG]] = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) |
| 70 | !21 = !{!22} |
| 71 | !22 = !DIEnumerator(name: "A3", value: 9223372036854775808, isUnsigned: true) |
| 72 | ; CHECK: !DIEnumerator(name: "A3", value: 9223372036854775808, isUnsigned: true) |
| 73 | |
| 74 | |
| 75 | !23 = !{!0, !24, !26, !28} |
| 76 | !24 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression()) |
| 77 | !25 = distinct !DIGlobalVariable(name: "x1", scope: !2, file: !3, line: 3, type: !10, isLocal: false, isDefinition: true) |
| 78 | !26 = !DIGlobalVariableExpression(var: !27, expr: !DIExpression()) |
| 79 | !27 = distinct !DIGlobalVariable(name: "x2", scope: !2, file: !3, line: 5, type: !14, isLocal: false, isDefinition: true) |
| 80 | !28 = !DIGlobalVariableExpression(var: !29, expr: !DIExpression()) |
| 81 | !29 = distinct !DIGlobalVariable(name: "x3", scope: !2, file: !3, line: 7, type: !19, isLocal: false, isDefinition: true) |
| 82 | !30 = !{i32 2, !"Dwarf Version", i32 4} |
| 83 | !31 = !{i32 2, !"Debug Info Version", i32 3} |
| 84 | !32 = !{i32 1, !"wchar_size", i32 4} |
| 85 | !33 = !{!"clang version 7.0.0 (/data/src/llvm/tools/clang 697b0cb4c2e712a28767c2f7fe50c90bae7255f5) (/data/src/llvm 5ba8dcca7470b5da405bc92b9681b1f36e5d6772)"} |