| 1 |
; RUN: llvm-as < %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 3 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll |
| 4 |
|
| 5 |
; RUN: llc -mtriple=x86_64-apple-darwin %t.ll -o %t -filetype=obj |
| 6 |
; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s |
| 7 |
; |
| 8 |
; Test the DW_AT_accessibility DWARF attribute. |
| 9 |
; |
| 10 |
; |
| 11 |
; Regenerate me: |
| 12 |
; clang++ -g tools/clang/test/CodeGenCXX/debug-info-access.cpp -S -emit-llvm -o - |
| 13 |
; |
| 14 |
; struct A { |
| 15 |
; void pub_default(); |
| 16 |
; static int pub_default_static; |
| 17 |
; }; |
| 18 |
; |
| 19 |
; class B : public A { |
| 20 |
; public: |
| 21 |
; void pub(); |
| 22 |
; static int public_static; |
| 23 |
; protected: |
| 24 |
; void prot(); |
| 25 |
; private: |
| 26 |
; void priv_default(); |
| 27 |
; }; |
| 28 |
; |
| 29 |
; union U { |
| 30 |
; void union_pub_default(); |
| 31 |
; private: |
| 32 |
; int union_priv; |
| 33 |
; }; |
| 34 |
; |
| 35 |
; void free() {} |
| 36 |
; |
| 37 |
; A a; |
| 38 |
; B b; |
| 39 |
; U u; |
| 40 |
|
| 41 |
; CHECK: DW_TAG_member |
| 42 |
; CHECK: DW_AT_name {{.*}}"pub_default_static") |
| 43 |
; CHECK: DW_AT_accessibility |
| 44 |
; CHECK-NOT: DW_TAG |
| 45 |
; |
| 46 |
; CHECK: DW_TAG_subprogram |
| 47 |
; CHECK: DW_AT_name {{.*}}"pub_default") |
| 48 |
; CHECK: DW_AT_accessibility |
| 49 |
; CHECK: DW_TAG |
| 50 |
; |
| 51 |
; CHECK: DW_TAG_inheritance |
| 52 |
; CHECK-NOT: DW_TAG |
| 53 |
; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) |
| 54 |
; |
| 55 |
; CHECK: DW_TAG_member |
| 56 |
; CHECK: DW_AT_name {{.*}}"public_static") |
| 57 |
; CHECK-NOT: DW_TAG |
| 58 |
; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) |
| 59 |
; |
| 60 |
; CHECK: DW_TAG_subprogram |
| 61 |
; CHECK: DW_AT_name {{.*}}"pub") |
| 62 |
; CHECK-NOT: DW_TAG |
| 63 |
; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) |
| 64 |
; |
| 65 |
; CHECK: DW_TAG_subprogram |
| 66 |
; CHECK: DW_AT_name {{.*}}"prot") |
| 67 |
; CHECK-NOT: DW_TAG |
| 68 |
; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_protected) |
| 69 |
; |
| 70 |
; CHECK: DW_TAG_subprogram |
| 71 |
; CHECK: DW_AT_name {{.*}}"priv_default") |
| 72 |
; CHECK: DW_AT_accessibility |
| 73 |
; CHECK: DW_TAG |
| 74 |
; |
| 75 |
; CHECK: DW_TAG_member |
| 76 |
; CHECK: DW_AT_name {{.*}}"union_priv") |
| 77 |
; CHECK-NOT: DW_TAG |
| 78 |
; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_private) |
| 79 |
; |
| 80 |
; CHECK: DW_TAG_subprogram |
| 81 |
; CHECK: DW_AT_name {{.*}}"union_pub_default") |
| 82 |
; CHECK: DW_AT_accessibility |
| 83 |
; CHECK: DW_TAG |
| 84 |
; |
| 85 |
; CHECK: DW_TAG_subprogram |
| 86 |
; CHECK: DW_AT_name {{.*}}"free") |
| 87 |
; CHECK-NOT: DW_AT_accessibility |
| 88 |
; CHECK-NOT: DW_TAG |
| 89 |
; |
| 90 |
; ModuleID = '/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp' |
| 91 |
source_filename = "test/DebugInfo/X86/debug-info-access.ll" |
| 92 |
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 93 |
target triple = "spir64-unknown-unknown" |
| 94 |
|
| 95 |
%struct.A = type { i8 } |
| 96 |
%class.B = type { i8 } |
| 97 |
%union.U = type { i32 } |
| 98 |
|
| 99 |
@a = global %struct.A zeroinitializer, align 1, !dbg !0 |
| 100 |
@b = global %class.B zeroinitializer, align 1, !dbg !11 |
| 101 |
@u = global %union.U zeroinitializer, align 4, !dbg !23 |
| 102 |
|
| 103 |
; Function Attrs: nounwind ssp uwtable |
| 104 |
define void @_Z4freev() #0 !dbg !39 { |
| 105 |
ret void, !dbg !42 |
| 106 |
} |
| 107 |
|
| 108 |
attributes #0 = { nounwind ssp uwtable } |
| 109 |
|
| 110 |
!llvm.dbg.cu = !{!32} |
| 111 |
!llvm.module.flags = !{!36, !37} |
| 112 |
!llvm.ident = !{!38} |
| 113 |
|
| 114 |
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 115 |
!1 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 37, type: !3, isLocal: false, isDefinition: true) |
| 116 |
!2 = !DIFile(filename: "/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp", directory: "") |
| 117 |
!3 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !2, line: 3, size: 8, align: 8, elements: !4, identifier: "_ZTS1A") |
| 118 |
!4 = !{!5, !7} |
| 119 |
!5 = !DIDerivedType(tag: DW_TAG_member, name: "pub_default_static", scope: !3, file: !2, line: 7, baseType: !6, flags: DIFlagStaticMember) |
| 120 |
!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 121 |
!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) |
| 122 |
!8 = !DISubroutineType(types: !9) |
| 123 |
!9 = !{null, !10} |
| 124 |
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) |
| 125 |
!11 = !DIGlobalVariableExpression(var: !12, expr: !DIExpression()) |
| 126 |
!12 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 38, type: !13, isLocal: false, isDefinition: true) |
| 127 |
!13 = !DICompositeType(tag: DW_TAG_class_type, name: "B", file: !2, line: 11, size: 8, align: 8, elements: !14, identifier: "_ZTS1B") |
| 128 |
!14 = !{!15, !16, !17, !21, !22} |
| 129 |
!15 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !13, baseType: !3, flags: DIFlagPublic) |
| 130 |
!16 = !DIDerivedType(tag: DW_TAG_member, name: "public_static", scope: !13, file: !2, line: 16, baseType: !6, flags: DIFlagPublic | DIFlagStaticMember) |
| 131 |
!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) |
| 132 |
!18 = !DISubroutineType(types: !19) |
| 133 |
!19 = !{null, !20} |
| 134 |
!20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) |
| 135 |
!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) |
| 136 |
!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) |
| 137 |
!23 = !DIGlobalVariableExpression(var: !24, expr: !DIExpression()) |
| 138 |
!24 = !DIGlobalVariable(name: "u", scope: null, file: !2, line: 39, type: !25, isLocal: false, isDefinition: true) |
| 139 |
!25 = !DICompositeType(tag: DW_TAG_union_type, name: "U", file: !2, line: 25, size: 32, align: 32, elements: !26, identifier: "_ZTS1U") |
| 140 |
!26 = !{!27, !28} |
| 141 |
!27 = !DIDerivedType(tag: DW_TAG_member, name: "union_priv", scope: !25, file: !2, line: 30, baseType: !6, size: 32, align: 32, flags: DIFlagPrivate) |
| 142 |
!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) |
| 143 |
!29 = !DISubroutineType(types: !30) |
| 144 |
!30 = !{null, !31} |
| 145 |
!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !25, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) |
| 146 |
!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) |
| 147 |
!33 = !{} |
| 148 |
!34 = !{!3, !13, !25} |
| 149 |
!35 = !{!0, !11, !23} |
| 150 |
!36 = !{i32 2, !"Dwarf Version", i32 2} |
| 151 |
!37 = !{i32 2, !"Debug Info Version", i32 3} |
| 152 |
!38 = !{!"clang version 3.6.0 "} |
| 153 |
!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) |
| 154 |
!40 = !DISubroutineType(types: !41) |
| 155 |
!41 = !{null} |
| 156 |
!42 = !DILocation(line: 35, column: 14, scope: !39) |
| 157 |
|