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 | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 42 | call void @llvm.dbg.declare(metadata i32* %b, metadata !20, metadata !{!"0x102"}), !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 | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 56 | !0 = !{!"0x11\004\00clang version 3.4 \000\00\000\00\000", !1, !2, !11, !12, !17, !11} ; [ DW_TAG_compile_unit ] [/tmp/enum.cpp] [DW_LANG_C_plus_plus] |
| 57 | !1 = !{!"enum.cpp", !"/tmp"} |
| 58 | !2 = !{!3, !8} |
| 59 | !3 = !{!"0x4\00e1\001\0064\0064\000\000\000", !1, null, null, !4, null, null, null} ; [ DW_TAG_enumeration_type ] [e1] [line 1, size 64, align 64, offset 0] [def] [from ] |
| 60 | !4 = !{!5, !6, !7} |
| 61 | !5 = !{!"0x28\00I\000"} ; [ DW_TAG_enumerator ] [I :: 0] |
| 62 | !6 = !{!"0x28\00J\004294967295"} ; [ DW_TAG_enumerator ] [J :: 4294967295] |
| 63 | !7 = !{!"0x28\00K\00-1152921504606846976"} ; [ DW_TAG_enumerator ] [K :: 17293822569102704640] |
| 64 | !8 = !{!"0x4\00e2\002\0032\0032\000\000\000", !1, null, null, !9, null, null, null} ; [ DW_TAG_enumeration_type ] [e2] [line 2, size 32, align 32, offset 0] [def] [from ] |
| 65 | !9 = !{!10} |
| 66 | !10 = !{!"0x28\00X\000"} ; [ DW_TAG_enumerator ] [X :: 0] |
| 67 | !11 = !{} |
| 68 | !12 = !{!13} |
| 69 | !13 = !{!"0x2e\00func\00func\00_Z4funcv\003\000\001\000\006\00256\000\003", !1, !14, !15, null, void ()* @_Z4funcv, null, null, !11} ; [ DW_TAG_subprogram ] [line 3] [def] [func] |
| 70 | !14 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [/tmp/enum.cpp] |
| 71 | !15 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !16, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 72 | !16 = !{null} |
| 73 | !17 = !{!18} |
| 74 | !18 = !{!"0x34\00a\00a\00\001\000\001", null, !14, !3, i64* @a, null} ; [ DW_TAG_variable ] [a] [line 1] [def] |
| 75 | !19 = !{i32 2, !"Dwarf Version", i32 3} |
| 76 | !20 = !{!"0x100\00b\004\000", !13, !14, !21} ; [ DW_TAG_auto_variable ] [b] [line 4] |
| 77 | !21 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] |
| 78 | !22 = !{i32 4, i32 0, !13, null} |
| 79 | !23 = !{i32 5, i32 0, !13, null} |
| 80 | !24 = !{i32 1, !"Debug Info Version", i32 2} |