]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - test/DebugInfo/X86/debug-info-block-captured-self.ll
IR: Move MDLocation into place
[opencl/llvm.git] / test / DebugInfo / X86 / debug-info-block-captured-self.ll
1 ; RUN: llc -mtriple x86_64-apple-darwin -filetype=obj -o %t.o < %s
2 ; RUN: llvm-dwarfdump %t.o | FileCheck %s
3 ;
4 ; Test that DW_AT_location is generated for a captured "self" inside a
5 ; block.
6 ;
7 ; This test is split into two parts, the frontend part can be found at
8 ; llvm/tools/clang/test/CodeGenObjC/debug-info-block-captured-self.m
9 ;
10 ; CHECK: {{.*}}DW_AT_name{{.*}}_block_invoke{{.*}}
11 ; CHECK: DW_TAG_variable
12 ; CHECK-NOT:  DW_TAG
13 ; CHECK:   DW_AT_location
14 ; CHECK-NOT: DW_TAG
15 ; CHECK:   DW_AT_name{{.*}}"self"{{.*}}
16 ;
17 ; CHECK: {{.*}}DW_AT_name{{.*}}_block_invoke{{.*}}
18 ; CHECK: DW_TAG_variable
19 ; CHECK-NOT:  DW_TAG
20 ; CHECK:   DW_AT_location
21 ; CHECK-NOT: DW_TAG
22 ; CHECK:   DW_AT_name{{.*}}"self"{{.*}}
23 ;
24 ; Generated (and then reduced) from
25 ; ----------------------------------------------------------------------
26 ;
27 ; @class T;
28 ; @interface S
29 ; @end
30 ; @interface Mode
31 ; -(int) count;
32 ; @end
33 ; @interface Context
34 ; @end
35 ; @interface ViewController
36 ; @property (nonatomic, readwrite, strong) Context *context;
37 ; @end
38 ; typedef enum {
39 ;     Unknown = 0,
40 ; } State;
41 ; @interface Main : ViewController
42 ; {
43 ;     T * t1;
44 ;     T * t2;
45 ; }
46 ; @property(readwrite, nonatomic) State state;
47 ; @end
48 ; @implementation Main
49 ; - (id) initWithContext:(Context *) context
50 ; {
51 ;     t1 = [self.context withBlock:^(id obj){
52 ;         id *mode1;
53 ;       t2 = [mode1 withBlock:^(id object){
54 ;           Mode *mode2 = object;
55 ;           if ([mode2 count] != 0) {
56 ;             self.state = 0;
57 ;           }
58 ;         }];
59 ;       }];
60 ; }
61 ; @end
62 ; ----------------------------------------------------------------------
63 ; ModuleID = 'llvm/tools/clang/test/CodeGenObjC/debug-info-block-captured-self.m'
64 %0 = type opaque
65 %struct.__block_descriptor = type { i64, i64 }
66 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
67 define internal void @"__24-[Main initWithContext:]_block_invoke"(i8* %.block_descriptor, i8* %obj) #0 {
68   %block = bitcast i8* %.block_descriptor to <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>*, !dbg !84
69   %block.captured-self = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i32 0, i32 5, !dbg !84
70   call void @llvm.dbg.declare(metadata <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, metadata !86, metadata !110), !dbg !87
71   ret void, !dbg !87
72 }
74 define internal void @"__24-[Main initWithContext:]_block_invoke_2"(i8* %.block_descriptor, i8* %object) #0 {
75   %block = bitcast i8* %.block_descriptor to <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>*, !dbg !103
76   %block.captured-self = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, i32 0, i32 5, !dbg !103
77   call void @llvm.dbg.declare(metadata <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %block, metadata !105, metadata !109), !dbg !106
78   ret void, !dbg !106
79 }
81 !llvm.dbg.cu = !{!0}
82 !llvm.module.flags = !{!108}
83 !0 = !{!"0x11\0016\00clang version 3.3 \000\00\002\00\000", !107, !2, !4, !23, !15,  !15} ; [ DW_TAG_compile_unit ] [llvm/tools/clang/test/CodeGenObjC/debug-info-block-captured-self.m] [DW_LANG_ObjC]
84 !1 = !{!"0x29", !107} ; [ DW_TAG_file_type ]
85 !2 = !{!3}
86 !3 = !{!"0x4\00\0020\0032\0032\000\000\000", !107, null, null, !4, null, null, null} ; [ DW_TAG_enumeration_type ] [line 20, size 32, align 32, offset 0] [def] [from ]
87 !4 = !{}
88 !15 = !{}
89 !23 = !{!38, !42}
90 !27 = !{!"0x16\00id\0031\000\000\000\000", !107, null, !28} ; [ DW_TAG_typedef ] [id] [line 31, size 0, align 0, offset 0] [from ]
91 !28 = !{!"0xf\00\000\0064\0064\000\000", null, null, !29} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from objc_object]
92 !29 = !{!"0x13\00objc_object\000\000\000\000\000\000", !107, null, null, !30, null, null, null} ; [ DW_TAG_structure_type ] [objc_object] [line 0, size 0, align 0, offset 0] [def] [from ]
93 !30 = !{!31}
94 !31 = !{!"0xd\00isa\000\0064\000\000\000", !107, !29, !32} ; [ DW_TAG_member ] [isa] [line 0, size 64, align 0, offset 0] [from ]
95 !32 = !{!"0xf\00\000\0064\000\000\000", null, null, !33} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 0, offset 0] [from objc_class]
96 !33 = !{!"0x13\00objc_class\000\000\000\000\004\000", !107, null, null, null, null, null, null} ; [ DW_TAG_structure_type ] [objc_class] [line 0, size 0, align 0, offset 0] [decl] [from ]
97 !34 = !{!"0x13\00Main\0023\000\000\000\001092\0016", !107, null, null, i32 0, null, null, null} ; [ DW_TAG_structure_type ] [Main] [line 23, size 0, align 0, offset 0] [artificial] [decl] [from ]
98 !38 = !{!"0x2e\00__24-[Main initWithContext:]_block_invoke\00__24-[Main initWithContext:]_block_invoke\00\0033\001\001\000\006\00256\000\0033", !1, !1, !39, null, void (i8*, i8*)* @"__24-[Main initWithContext:]_block_invoke", null, null, !15} ; [ DW_TAG_subprogram ] [line 33] [local] [def] [__24-[Main initWithContext:]_block_invoke]
99 !39 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !40, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
100 !40 = !{null, !41, !27}
101 !41 = !{!"0xf\00\000\0064\0064\000\000", null, null, null} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
102 !42 = !{!"0x2e\00__24-[Main initWithContext:]_block_invoke_2\00__24-[Main initWithContext:]_block_invoke_2\00\0035\001\001\000\006\00256\000\0035", !1, !1, !39, null, void (i8*, i8*)* @"__24-[Main initWithContext:]_block_invoke_2", null, null, !15} ; [ DW_TAG_subprogram ] [line 35] [local] [def] [__24-[Main initWithContext:]_block_invoke_2]
103 !84 = !MDLocation(line: 33, scope: !38)
104 !86 = !{!"0x100\00self\0041\000", !38, !1, !34} ; [ DW_TAG_auto_variable ] [self] [line 41]
105 !87 = !MDLocation(line: 41, scope: !38)
106 !103 = !MDLocation(line: 35, scope: !42)
107 !105 = !{!"0x100\00self\0040\000", !42, !1, !34} ; [ DW_TAG_auto_variable ] [self] [line 40]
108 !106 = !MDLocation(line: 40, scope: !42)
109 !107 = !{!"llvm/tools/clang/test/CodeGenObjC/debug-info-block-captured-self.m", !""}
110 !108 = !{i32 1, !"Debug Info Version", i32 2}
111 !109 = !{!"0x102\0034\0032"} ; [ DW_TAG_expression ] [DW_OP_plus 32]
112 !110 = !{!"0x102\0034\0032"} ; [ DW_TAG_expression ] [DW_OP_plus 32]