1 ; REQUIRES: object-emission
3 ; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
4 ; RUN: llvm-dwarfdump %t | FileCheck %s
6 ; IR generated from the following code compiled with clang -g:
7 ; enum e1 { I, J = 0xffffffffU, K = 0xf000000000000000ULL } a;
13 ; These values were previously being truncated to -1 and 0 respectively.
15 ; CHECK: debug_info contents
16 ; CHECK: DW_TAG_enumeration_type
17 ; CHECK-NEXT: DW_AT_name{{.*}} = "e1"
19 ; CHECK: DW_TAG_enumerator
21 ; CHECK: DW_TAG_enumerator
22 ; CHECK-NEXT: DW_AT_name{{.*}} = "J"
23 ; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (4294967295)
25 ; CHECK: DW_TAG_enumerator
26 ; CHECK-NEXT: DW_AT_name{{.*}} = "K"
27 ; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (-1152921504606846976)
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"
33 ; CHECK: DW_TAG_enumerator
34 ; CHECK-NEXT: DW_AT_name{{.*}} = "X"
36 @a = global i64 0, align 8
38 ; Function Attrs: nounwind uwtable
39 define void @_Z4funcv() #0 {
41 %b = alloca i32, align 4
42 call void @llvm.dbg.declare(metadata !{i32* %b}, metadata !20), !dbg !22
43 store i32 0, i32* %b, align 4, !dbg !22
47 ; Function Attrs: nounwind readnone
48 declare void @llvm.dbg.declare(metadata, metadata) #1
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" }
51 attributes #1 = { nounwind readnone }
54 !llvm.module.flags = !{!19, !24}
56 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !11, metadata !12, metadata !17, metadata !11, metadata !""} ; [ DW_TAG_compile_unit ] [/tmp/enum.cpp] [DW_LANG_C_plus_plus]
57 !1 = metadata !{metadata !"enum.cpp", metadata !"/tmp"}
58 !2 = metadata !{metadata !3, metadata !8}
59 !3 = metadata !{i32 786436, metadata !1, null, metadata !"e1", i32 1, i64 64, i64 64, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_enumeration_type ] [e1] [line 1, size 64, align 64, offset 0] [def] [from ]
60 !4 = metadata !{metadata !5, metadata !6, metadata !7}
61 !5 = metadata !{i32 786472, metadata !"I", i64 0} ; [ DW_TAG_enumerator ] [I :: 0]
62 !6 = metadata !{i32 786472, metadata !"J", i64 4294967295} ; [ DW_TAG_enumerator ] [J :: 4294967295]
63 !7 = metadata !{i32 786472, metadata !"K", i64 -1152921504606846976} ; [ DW_TAG_enumerator ] [K :: 17293822569102704640]
64 !8 = metadata !{i32 786436, metadata !1, null, metadata !"e2", i32 2, i64 32, i64 32, i32 0, i32 0, null, metadata !9, i32 0, null, null, null} ; [ DW_TAG_enumeration_type ] [e2] [line 2, size 32, align 32, offset 0] [def] [from ]
65 !9 = metadata !{metadata !10}
66 !10 = metadata !{i32 786472, metadata !"X", i64 0} ; [ DW_TAG_enumerator ] [X :: 0]
68 !12 = metadata !{metadata !13}
69 !13 = metadata !{i32 786478, metadata !1, metadata !14, metadata !"func", metadata !"func", metadata !"_Z4funcv", i32 3, metadata !15, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z4funcv, null, null, metadata !11, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [func]
70 !14 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/tmp/enum.cpp]
71 !15 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !16, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
72 !16 = metadata !{null}
73 !17 = metadata !{metadata !18}
74 !18 = metadata !{i32 786484, i32 0, null, metadata !"a", metadata !"a", metadata !"", metadata !14, i32 1, metadata !3, i32 0, i32 1, i64* @a, null} ; [ DW_TAG_variable ] [a] [line 1] [def]
75 !19 = metadata !{i32 2, metadata !"Dwarf Version", i32 3}
76 !20 = metadata !{i32 786688, metadata !13, metadata !"b", metadata !14, i32 4, metadata !21, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [b] [line 4]
77 !21 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
78 !22 = metadata !{i32 4, i32 0, metadata !13, null}
79 !23 = metadata !{i32 5, i32 0, metadata !13, null}
80 !24 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}