1 ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
2 ; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
4 ; Test the DW_AT_accessibility DWARF attribute.
8 ; clang++ -g tools/clang/test/CodeGenCXX/debug-info-access.cpp -S -emit-llvm -o -
12 ; static int pub_default_static;
15 ; class B : public A {
18 ; static int public_static;
22 ; void priv_default();
26 ; void union_pub_default();
37 ; CHECK: DW_TAG_member
38 ; CHECK: DW_AT_name {{.*}}"pub_default_static")
39 ; CHECK-NOT: DW_AT_accessibility
42 ; CHECK: DW_TAG_subprogram
43 ; CHECK: DW_AT_name {{.*}}"pub_default")
44 ; CHECK-NOT: DW_AT_accessibility
47 ; CHECK: DW_TAG_inheritance
49 ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public)
51 ; CHECK: DW_TAG_member
52 ; CHECK: DW_AT_name {{.*}}"public_static")
54 ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public)
56 ; CHECK: DW_TAG_subprogram
57 ; CHECK: DW_AT_name {{.*}}"pub")
59 ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public)
61 ; CHECK: DW_TAG_subprogram
62 ; CHECK: DW_AT_name {{.*}}"prot")
64 ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_protected)
66 ; CHECK: DW_TAG_subprogram
67 ; CHECK: DW_AT_name {{.*}}"priv_default")
68 ; CHECK-NOT: DW_AT_accessibility
71 ; CHECK: DW_TAG_member
72 ; CHECK: DW_AT_name {{.*}}"union_priv")
74 ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_private)
76 ; CHECK: DW_TAG_subprogram
77 ; CHECK: DW_AT_name {{.*}}"union_pub_default")
78 ; CHECK-NOT: DW_AT_accessibility
81 ; CHECK: DW_TAG_subprogram
82 ; CHECK: DW_AT_name {{.*}}"free")
83 ; CHECK-NOT: DW_AT_accessibility
86 ; ModuleID = '/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp'
87 source_filename = "test/DebugInfo/X86/debug-info-access.ll"
88 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
89 target triple = "x86_64-apple-macosx10.10.0"
91 %struct.A = type { i8 }
92 %class.B = type { i8 }
93 %union.U = type { i32 }
95 @a = global %struct.A zeroinitializer, align 1, !dbg !0
96 @b = global %class.B zeroinitializer, align 1, !dbg !11
97 @u = global %union.U zeroinitializer, align 4, !dbg !23
99 ; Function Attrs: nounwind ssp uwtable
100 define void @_Z4freev() #0 !dbg !39 {
104 attributes #0 = { nounwind ssp uwtable }
106 !llvm.dbg.cu = !{!32}
107 !llvm.module.flags = !{!36, !37}
110 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
111 !1 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 37, type: !3, isLocal: false, isDefinition: true)
112 !2 = !DIFile(filename: "/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp", directory: "")
113 !3 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !2, line: 3, size: 8, align: 8, elements: !4, identifier: "_ZTS1A")
115 !5 = !DIDerivedType(tag: DW_TAG_member, name: "pub_default_static", scope: !3, file: !2, line: 7, baseType: !6, flags: DIFlagStaticMember)
116 !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
117 !7 = !DISubprogram(name: "pub_default", linkageName: "_ZN1A11pub_defaultEv", scope: !3, file: !2, line: 5, type: !8, isLocal: false, isDefinition: false, scopeLine: 5, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false)
118 !8 = !DISubroutineType(types: !9)
120 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
121 !11 = !DIGlobalVariableExpression(var: !12, expr: !DIExpression())
122 !12 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 38, type: !13, isLocal: false, isDefinition: true)
123 !13 = !DICompositeType(tag: DW_TAG_class_type, name: "B", file: !2, line: 11, size: 8, align: 8, elements: !14, identifier: "_ZTS1B")
124 !14 = !{!15, !16, !17, !21, !22}
125 !15 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !13, baseType: !3, flags: DIFlagPublic)
126 !16 = !DIDerivedType(tag: DW_TAG_member, name: "public_static", scope: !13, file: !2, line: 16, baseType: !6, flags: DIFlagPublic | DIFlagStaticMember)
127 !17 = !DISubprogram(name: "pub", linkageName: "_ZN1B3pubEv", scope: !13, file: !2, line: 14, type: !18, isLocal: false, isDefinition: false, scopeLine: 14, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false)
128 !18 = !DISubroutineType(types: !19)
130 !20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
131 !21 = !DISubprogram(name: "prot", linkageName: "_ZN1B4protEv", scope: !13, file: !2, line: 19, type: !18, isLocal: false, isDefinition: false, scopeLine: 19, virtualIndex: 6, flags: DIFlagProtected | DIFlagPrototyped, isOptimized: false)
132 !22 = !DISubprogram(name: "priv_default", linkageName: "_ZN1B12priv_defaultEv", scope: !13, file: !2, line: 22, type: !18, isLocal: false, isDefinition: false, scopeLine: 22, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false)
133 !23 = !DIGlobalVariableExpression(var: !24, expr: !DIExpression())
134 !24 = !DIGlobalVariable(name: "u", scope: null, file: !2, line: 39, type: !25, isLocal: false, isDefinition: true)
135 !25 = !DICompositeType(tag: DW_TAG_union_type, name: "U", file: !2, line: 25, size: 32, align: 32, elements: !26, identifier: "_ZTS1U")
137 !27 = !DIDerivedType(tag: DW_TAG_member, name: "union_priv", scope: !25, file: !2, line: 30, baseType: !6, size: 32, align: 32, flags: DIFlagPrivate)
138 !28 = !DISubprogram(name: "union_pub_default", linkageName: "_ZN1U17union_pub_defaultEv", scope: !25, file: !2, line: 27, type: !29, isLocal: false, isDefinition: false, scopeLine: 27, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false)
139 !29 = !DISubroutineType(types: !30)
141 !31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !25, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
142 !32 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 3.6.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !33, retainedTypes: !34, globals: !35, imports: !33)
144 !34 = !{!3, !13, !25}
145 !35 = !{!0, !11, !23}
146 !36 = !{i32 2, !"Dwarf Version", i32 2}
147 !37 = !{i32 2, !"Debug Info Version", i32 3}
148 !38 = !{!"clang version 3.6.0 "}
149 !39 = distinct !DISubprogram(name: "free", linkageName: "_Z4freev", scope: !2, file: !2, line: 35, type: !40, isLocal: false, isDefinition: true, scopeLine: 35, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !32, retainedNodes: !33)
150 !40 = !DISubroutineType(types: !41)
152 !42 = !DILocation(line: 35, column: 14, scope: !39)