IR: Move MDLocation into place
[oota-llvm.git] / test / DebugInfo / X86 / debug-info-access.ll
1 ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
2 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
3 ;
4 ; Test the DW_AT_accessibility DWARF attribute.
5 ;
6 ;
7 ; Regenerate me:
8 ; clang++ -g tools/clang/test/CodeGenCXX/debug-info-access.cpp -S -emit-llvm -o -
9 ;
10 ;   struct A {
11 ;     void pub_default();
12 ;     static int pub_default_static;
13 ;   };
14 ;
15 ;   class B : public A {
16 ;   public:
17 ;     void pub();
18 ;     static int public_static;
19 ;   protected:
20 ;     void prot();
21 ;   private:
22 ;     void priv_default();
23 ;   };
24 ;
25 ;   union U {
26 ;     void union_pub_default();
27 ;   private:
28 ;     int union_priv;
29 ;   };
30 ;
31 ;   void free() {}
32 ;
33 ;   A a;
34 ;   B b;
35 ;   U u;
36
37 ; CHECK: DW_TAG_member
38 ; CHECK:     DW_AT_name {{.*}}"pub_default_static")
39 ; CHECK-NOT: DW_AT_accessibility
40 ; CHECK-NOT: DW_TAG
41 ;
42 ; CHECK: DW_TAG_subprogram
43 ; CHECK:     DW_AT_name {{.*}}"pub_default")
44 ; CHECK-NOT: DW_AT_accessibility
45 ; CHECK: DW_TAG
46 ;
47 ; CHECK: DW_TAG_inheritance
48 ; CHECK-NOT: DW_TAG
49 ; CHECK:     DW_AT_accessibility {{.*}}(DW_ACCESS_public)
50 ;
51 ; CHECK: DW_TAG_member
52 ; CHECK:     DW_AT_name {{.*}}"public_static")
53 ; CHECK-NOT: DW_TAG
54 ; CHECK:     DW_AT_accessibility {{.*}}(DW_ACCESS_public)
55 ;
56 ; CHECK: DW_TAG_subprogram
57 ; CHECK:     DW_AT_name {{.*}}"pub")
58 ; CHECK-NOT: DW_TAG
59 ; CHECK:     DW_AT_accessibility {{.*}}(DW_ACCESS_public)
60 ;
61 ; CHECK: DW_TAG_subprogram
62 ; CHECK:     DW_AT_name {{.*}}"prot")
63 ; CHECK-NOT: DW_TAG
64 ; CHECK:     DW_AT_accessibility {{.*}}(DW_ACCESS_protected)
65 ;
66 ; CHECK: DW_TAG_subprogram
67 ; CHECK:     DW_AT_name {{.*}}"priv_default")
68 ; CHECK-NOT: DW_AT_accessibility
69 ; CHECK: DW_TAG
70 ;
71 ; CHECK: DW_TAG_member
72 ; CHECK:     DW_AT_name {{.*}}"union_priv")
73 ; CHECK-NOT: DW_TAG
74 ; CHECK:     DW_AT_accessibility {{.*}}(DW_ACCESS_private)
75 ;
76 ; CHECK: DW_TAG_subprogram
77 ; CHECK:     DW_AT_name {{.*}}"union_pub_default")
78 ; CHECK-NOT: DW_AT_accessibility
79 ; CHECK: DW_TAG
80 ;
81 ; CHECK: DW_TAG_subprogram
82 ; CHECK:     DW_AT_name {{.*}}"free")
83 ; CHECK-NOT: DW_AT_accessibility
84 ; CHECK-NOT: DW_TAG
85 ;
86 ; ModuleID = '/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp'
87 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
88 target triple = "x86_64-apple-macosx10.10.0"
89
90 %struct.A = type { i8 }
91 %class.B = type { i8 }
92 %union.U = type { i32 }
93
94 @a = global %struct.A zeroinitializer, align 1
95 @b = global %class.B zeroinitializer, align 1
96 @u = global %union.U zeroinitializer, align 4
97
98 ; Function Attrs: nounwind ssp uwtable
99 define void @_Z4freev() #0 {
100   ret void, !dbg !41
101 }
102
103 attributes #0 = { nounwind ssp uwtable }
104
105 !llvm.dbg.cu = !{!0}
106 !llvm.module.flags = !{!38, !39}
107 !llvm.ident = !{!40}
108
109 !0 = !{!"0x11\004\00clang version 3.6.0 \000\00\000\00\001", !1, !2, !3, !29, !34, !2} ; [ DW_TAG_compile_unit ] [/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp] [DW_LANG_C_plus_plus]
110 !1 = !{!"/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp", !""}
111 !2 = !{}
112 !3 = !{!4, !12, !22}
113 !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 ]
114 !5 = !{!6, !8}
115 !6 = !{!"0xd\00pub_default_static\007\000\000\000\004096", !1, !"_ZTS1A", !7, null} ; [ DW_TAG_member ] [pub_default_static] [line 7, size 0, align 0, offset 0] [static] [from int]
116 !7 = !{!"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]
117 !8 = !{!"0x2e\00pub_default\00pub_default\00_ZN1A11pub_defaultEv\005\000\000\000\006\00256\000\005", !1, !"_ZTS1A", !9, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ] [line 5] [pub_default]
118 !9 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !10, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
119 !10 = !{null, !11}
120 !11 = !{!"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]
121 !12 = !{!"0x2\00B\0011\008\008\000\000\000", !1, null, null, !13, null, null, !"_ZTS1B"} ; [ DW_TAG_class_type ] [B] [line 11, size 8, align 8, offset 0] [def] [from ]
122 !13 = !{!14, !15, !16, !20, !21}
123 !14 = !{!"0x1c\00\000\000\000\000\003", null, !"_ZTS1B", !"_ZTS1A"} ; [ DW_TAG_inheritance ] [line 0, size 0, align 0, offset 0] [public] [from _ZTS1A]
124 !15 = !{!"0xd\00public_static\0016\000\000\000\004099", !1, !"_ZTS1B", !7, null} ; [ DW_TAG_member ] [public_static] [line 16, size 0, align 0, offset 0] [public] [static] [from int]
125 !16 = !{!"0x2e\00pub\00pub\00_ZN1B3pubEv\0014\000\000\000\006\00259\000\0014", !1, !"_ZTS1B", !17, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ] [line 14] [public] [pub]
126 !17 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !18, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
127 !18 = !{null, !19}
128 !19 = !{!"0xf\00\000\0064\0064\000\001088", null, null, !"_ZTS1B"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1B]
129 !20 = !{!"0x2e\00prot\00prot\00_ZN1B4protEv\0019\000\000\000\006\00258\000\0019", !1, !"_ZTS1B", !17, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ] [line 19] [protected] [prot]
130 !21 = !{!"0x2e\00priv_default\00priv_default\00_ZN1B12priv_defaultEv\0022\000\000\000\006\00256\000\0022", !1, !"_ZTS1B", !17, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ] [line 22] [priv_default]
131 !22 = !{!"0x17\00U\0025\0032\0032\000\000\000", !1, null, null, !23, null, null, !"_ZTS1U"} ; [ DW_TAG_union_type ] [U] [line 25, size 32, align 32, offset 0] [def] [from ]
132 !23 = !{!24, !25}
133 !24 = !{!"0xd\00union_priv\0030\0032\0032\000\001", !1, !"_ZTS1U", !7} ; [ DW_TAG_member ] [union_priv] [line 30, size 32, align 32, offset 0] [private] [from int]
134 !25 = !{!"0x2e\00union_pub_default\00union_pub_default\00_ZN1U17union_pub_defaultEv\0027\000\000\000\006\00256\000\0027", !1, !"_ZTS1U", !26, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ] [line 27] [union_pub_default]
135 !26 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !27, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
136 !27 = !{null, !28}
137 !28 = !{!"0xf\00\000\0064\0064\000\001088", null, null, !"_ZTS1U"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1U]
138 !29 = !{!30}
139 !30 = !{!"0x2e\00free\00free\00_Z4freev\0035\000\001\000\006\00256\000\0035", !1, !31, !32, null, void ()* @_Z4freev, null, null, !2} ; [ DW_TAG_subprogram ] [line 35] [def] [free]
140 !31 = !{!"0x29", !1}         ; [ DW_TAG_file_type ] [/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp]
141 !32 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !33, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
142 !33 = !{null}
143 !34 = !{!35, !36, !37}
144 !35 = !{!"0x34\00a\00a\00\0037\000\001", null, !31, !"_ZTS1A", %struct.A* @a, null} ; [ DW_TAG_variable ] [a] [line 37] [def]
145 !36 = !{!"0x34\00b\00b\00\0038\000\001", null, !31, !"_ZTS1B", %class.B* @b, null} ; [ DW_TAG_variable ] [b] [line 38] [def]
146 !37 = !{!"0x34\00u\00u\00\0039\000\001", null, !31, !"_ZTS1U", %union.U* @u, null} ; [ DW_TAG_variable ] [u] [line 39] [def]
147 !38 = !{i32 2, !"Dwarf Version", i32 2}
148 !39 = !{i32 2, !"Debug Info Version", i32 2}
149 !40 = !{!"clang version 3.6.0 "}
150 !41 = !MDLocation(line: 35, column: 14, scope: !30)