]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - test/DebugInfo/varargs.ll
Reapply: Teach SROA how to update debug info for fragmented variables.
[opencl/llvm.git] / test / DebugInfo / varargs.ll
1 ; RUN: %llc_dwarf -O0 -filetype=obj -o %t.o %s
2 ; RUN: llvm-dwarfdump -debug-dump=info %t.o | FileCheck %s
3 ; REQUIRES: object-emission
4 ;
5 ; Test debug info for variadic function arguments.
6 ; Created from tools/clang/tests/CodeGenCXX/debug-info-varargs.cpp
7 ;
8 ; The ... parameter of variadic should be emitted as
9 ; DW_TAG_unspecified_parameters.
10 ;
11 ; Normal variadic function.
12 ; void b(int c, ...);
13 ;
14 ; CHECK: DW_TAG_subprogram
15 ; CHECK-NOT: DW_TAG
16 ; CHECK: DW_AT_name {{.*}} "a"
17 ; CHECK-NOT: DW_TAG
18 ; CHECK: DW_TAG_formal_parameter
19 ; CHECK-NOT: DW_TAG
20 ; CHECK: DW_TAG_formal_parameter
21 ; CHECK-NOT: DW_TAG
22 ; CHECK: DW_TAG_unspecified_parameters
23 ;
24 ; CHECK: DW_TAG_subprogram
25 ; CHECK-NOT: DW_TAG
26 ; CHECK: DW_AT_name {{.*}} "b"
27 ; CHECK-NOT: DW_TAG
28 ; CHECK: DW_TAG_formal_parameter
29 ; CHECK-NOT: DW_TAG
30 ; CHECK: DW_TAG_variable
31 ; CHECK-NOT: DW_TAG
32 ; CHECK: DW_TAG_variable
33 ; CHECK-NOT: DW_TAG
34 ; CHECK: DW_TAG_unspecified_parameters
35 ;
36 ; Variadic C++ member function.
37 ; struct A { void a(int c, ...); }
38 ;
39 ; Variadic function pointer.
40 ; void (*fptr)(int, ...);
41 ;
42 ; CHECK: DW_TAG_subroutine_type
43 ; CHECK-NOT: DW_TAG
44 ; CHECK: DW_TAG_formal_parameter
45 ; CHECK-NOT: DW_TAG
46 ; CHECK: DW_TAG_unspecified_parameters
47 ;
48 ; ModuleID = 'llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp'
50 %struct.A = type { i8 }
52 ; Function Attrs: nounwind ssp uwtable
53 define void @_Z1biz(i32 %c, ...) #0 {
54   %1 = alloca i32, align 4
55   %a = alloca %struct.A, align 1
56   %fptr = alloca void (i32, ...)*, align 8
57   store i32 %c, i32* %1, align 4
58   call void @llvm.dbg.declare(metadata i32* %1, metadata !21, metadata !{!"0x102"}), !dbg !22
59   call void @llvm.dbg.declare(metadata %struct.A* %a, metadata !23, metadata !{!"0x102"}), !dbg !24
60   call void @llvm.dbg.declare(metadata void (i32, ...)** %fptr, metadata !25, metadata !{!"0x102"}), !dbg !27
61   store void (i32, ...)* @_Z1biz, void (i32, ...)** %fptr, align 8, !dbg !27
62   ret void, !dbg !28
63 }
65 ; Function Attrs: nounwind readnone
66 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
68 attributes #0 = { nounwind ssp uwtable }
69 attributes #1 = { nounwind readnone }
71 !llvm.dbg.cu = !{!0}
72 !llvm.module.flags = !{!18, !19}
73 !llvm.ident = !{!20}
75 !0 = !{!"0x11\004\00clang version 3.5 \000\00\000\00\000", !1, !2, !3, !13, !2, !2} ; [ DW_TAG_compile_unit ] [llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp] [DW_LANG_C_plus_plus]
76 !1 = !{!"llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp", !"radar/13690847"}
77 !2 = !{}
78 !3 = !{!4}
79 !4 = !{!"0x13\00A\003\008\008\000\000\000", !1, null, null, !5, null, null, !"_ZTS1A"} ; [ DW_TAG_structure_type ] [A] [line 3, size 8, align 8, offset 0] [def] [from ]
80 !5 = !{!6}
81 !6 = !{!"0x2e\00a\00a\00_ZN1A1aEiz\006\000\000\000\006\00256\000\006", !1, !"_ZTS1A", !7, null, null, null, i32 0, !12} ; [ DW_TAG_subprogram ] [line 6] [a]
82 !7 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
83 !8 = !{null, !9, !10, null}
84 !9 = !{!"0xf\00\000\0064\0064\000\001088", null, null, !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1A]
85 !10 = !{!"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]
86 !12 = !{i32 786468}
87 !13 = !{!14}
88 !14 = !{!"0x2e\00b\00b\00_Z1biz\0013\000\001\000\006\00256\000\0013", !1, !15, !16, null, void (i32, ...)* @_Z1biz, null, null, !2} ; [ DW_TAG_subprogram ] [line 13] [def] [b]
89 !15 = !{!"0x29", !1}         ; [ DW_TAG_file_type ] [llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp]
90 !16 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !17, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
91 !17 = !{null, !10, null}
92 !18 = !{i32 2, !"Dwarf Version", i32 2}
93 !19 = !{i32 1, !"Debug Info Version", i32 2}
94 !20 = !{!"clang version 3.5 "}
95 !21 = !{!"0x101\00c\0016777229\000", !14, !15, !10} ; [ DW_TAG_arg_variable ] [c] [line 13]
96 !22 = !{i32 13, i32 0, !14, null}
97 !23 = !{!"0x100\00a\0016\000", !14, !15, !4} ; [ DW_TAG_auto_variable ] [a] [line 16]
98 !24 = !{i32 16, i32 0, !14, null}
99 !25 = !{!"0x100\00fptr\0018\000", !14, !15, !26} ; [ DW_TAG_auto_variable ] [fptr] [line 18]
100 !26 = !{!"0xf\00\000\0064\0064\000\000", null, null, !16} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
101 !27 = !{i32 18, i32 0, !14, null}
102 !28 = !{i32 22, i32 0, !14, null}