David Blaikie | 3656123 | 2013-06-24 06:47:22 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | |
Timur Iskhodzhanov | f166f6c | 2014-01-30 01:39:17 +0000 | [diff] [blame] | 3 | ; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t |
David Blaikie | 3656123 | 2013-06-24 06:47:22 +0000 | [diff] [blame] | 4 | ; RUN: llvm-dwarfdump %t | FileCheck %s |
| 5 | |
| 6 | ; IR generated from the following code compiled with clang -g: |
| 7 | ; enum e1 { I, J = 0xffffffffU, K = 0xf000000000000000ULL } a; |
| 8 | ; enum e2 { X }; |
| 9 | ; void func() { |
| 10 | ; int b = X; |
| 11 | ; } |
| 12 | |
| 13 | ; These values were previously being truncated to -1 and 0 respectively. |
| 14 | |
| 15 | ; CHECK: debug_info contents |
| 16 | ; CHECK: DW_TAG_enumeration_type |
| 17 | ; CHECK-NEXT: DW_AT_name{{.*}} = "e1" |
| 18 | ; CHECK-NOT: NULL |
| 19 | ; CHECK: DW_TAG_enumerator |
| 20 | ; CHECK-NOT: NULL |
| 21 | ; CHECK: DW_TAG_enumerator |
| 22 | ; CHECK-NEXT: DW_AT_name{{.*}} = "J" |
| 23 | ; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (4294967295) |
| 24 | ; CHECK-NOT: NULL |
| 25 | ; CHECK: DW_TAG_enumerator |
| 26 | ; CHECK-NEXT: DW_AT_name{{.*}} = "K" |
| 27 | ; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (-1152921504606846976) |
| 28 | |
| 29 | ; Check that we retain enums that aren't referenced by any variables, etc |
| 30 | ; CHECK: DW_TAG_enumeration_type |
| 31 | ; CHECK-NEXT: DW_AT_name{{.*}} = "e2" |
| 32 | ; CHECK-NOT: NULL |
| 33 | ; CHECK: DW_TAG_enumerator |
| 34 | ; CHECK-NEXT: DW_AT_name{{.*}} = "X" |
| 35 | |
| 36 | @a = global i64 0, align 8 |
| 37 | |
| 38 | ; Function Attrs: nounwind uwtable |
| 39 | define void @_Z4funcv() #0 { |
| 40 | entry: |
| 41 | %b = alloca i32, align 4 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 42 | call void @llvm.dbg.declare(metadata i32* %b, metadata !20, metadata !DIExpression()), !dbg !22 |
David Blaikie | 3656123 | 2013-06-24 06:47:22 +0000 | [diff] [blame] | 43 | store i32 0, i32* %b, align 4, !dbg !22 |
| 44 | ret void, !dbg !23 |
| 45 | } |
| 46 | |
| 47 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 48 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
David Blaikie | 3656123 | 2013-06-24 06:47:22 +0000 | [diff] [blame] | 49 | |
Bill Wendling | 187d3dd | 2013-08-22 21:28:54 +0000 | [diff] [blame] | 50 | attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } |
David Blaikie | 3656123 | 2013-06-24 06:47:22 +0000 | [diff] [blame] | 51 | attributes #1 = { nounwind readnone } |
| 52 | |
| 53 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 54 | !llvm.module.flags = !{!19, !24} |
David Blaikie | 3656123 | 2013-06-24 06:47:22 +0000 | [diff] [blame] | 55 | |
Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 56 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !11, subprograms: !12, globals: !17, imports: !11) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 57 | !1 = !DIFile(filename: "enum.cpp", directory: "/tmp") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 58 | !2 = !{!3, !8} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 59 | !3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "e1", line: 1, size: 64, align: 64, file: !1, elements: !4) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 60 | !4 = !{!5, !6, !7} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 61 | !5 = !DIEnumerator(name: "I", value: 0) ; [ DW_TAG_enumerator ] [I :: 0] |
| 62 | !6 = !DIEnumerator(name: "J", value: 4294967295) ; [ DW_TAG_enumerator ] [J :: 4294967295] |
| 63 | !7 = !DIEnumerator(name: "K", value: -1152921504606846976) ; [ DW_TAG_enumerator ] [K :: 17293822569102704640] |
| 64 | !8 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "e2", line: 2, size: 32, align: 32, file: !1, elements: !9) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 65 | !9 = !{!10} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 66 | !10 = !DIEnumerator(name: "X", value: 0) ; [ DW_TAG_enumerator ] [X :: 0] |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 67 | !11 = !{} |
| 68 | !12 = !{!13} |
Duncan P. N. Exon Smith | 814b8e9 | 2015-08-28 20:26:49 +0000 | [diff] [blame] | 69 | !13 = distinct !DISubprogram(name: "func", linkageName: "_Z4funcv", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !14, type: !15, function: void ()* @_Z4funcv, variables: !11) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 70 | !14 = !DIFile(filename: "enum.cpp", directory: "/tmp") |
| 71 | !15 = !DISubroutineType(types: !16) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 72 | !16 = !{null} |
| 73 | !17 = !{!18} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 74 | !18 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !3, variable: i64* @a) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 75 | !19 = !{i32 2, !"Dwarf Version", i32 3} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 76 | !20 = !DILocalVariable(name: "b", line: 4, scope: !13, file: !14, type: !21) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 77 | !21 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 78 | !22 = !DILocation(line: 4, scope: !13) |
| 79 | !23 = !DILocation(line: 5, scope: !13) |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 80 | !24 = !{i32 1, !"Debug Info Version", i32 3} |