Adrian Prantl | daedfda | 2014-08-29 22:44:07 +0000 | [diff] [blame] | 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 |
Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 49 | ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) |
Adrian Prantl | daedfda | 2014-08-29 22:44:07 +0000 | [diff] [blame] | 50 | ; |
| 51 | ; CHECK: DW_TAG_member |
| 52 | ; CHECK: DW_AT_name {{.*}}"public_static") |
| 53 | ; CHECK-NOT: DW_TAG |
Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 54 | ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) |
Adrian Prantl | daedfda | 2014-08-29 22:44:07 +0000 | [diff] [blame] | 55 | ; |
| 56 | ; CHECK: DW_TAG_subprogram |
| 57 | ; CHECK: DW_AT_name {{.*}}"pub") |
| 58 | ; CHECK-NOT: DW_TAG |
Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 59 | ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) |
Adrian Prantl | daedfda | 2014-08-29 22:44:07 +0000 | [diff] [blame] | 60 | ; |
| 61 | ; CHECK: DW_TAG_subprogram |
| 62 | ; CHECK: DW_AT_name {{.*}}"prot") |
| 63 | ; CHECK-NOT: DW_TAG |
Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 64 | ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_protected) |
Adrian Prantl | daedfda | 2014-08-29 22:44:07 +0000 | [diff] [blame] | 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 |
Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 74 | ; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_private) |
Adrian Prantl | daedfda | 2014-08-29 22:44:07 +0000 | [diff] [blame] | 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 |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 99 | define void @_Z4freev() #0 !dbg !30 { |
Adrian Prantl | daedfda | 2014-08-29 22:44:07 +0000 | [diff] [blame] | 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 | |
Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 109 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !29, globals: !34, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 110 | !1 = !DIFile(filename: "/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp", directory: "") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 111 | !2 = !{} |
| 112 | !3 = !{!4, !12, !22} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 113 | !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 3, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1A") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 114 | !5 = !{!6, !8} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 115 | !6 = !DIDerivedType(tag: DW_TAG_member, name: "pub_default_static", line: 7, flags: DIFlagStaticMember, file: !1, scope: !"_ZTS1A", baseType: !7) |
| 116 | !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 117 | !8 = !DISubprogram(name: "pub_default", linkageName: "_ZN1A11pub_defaultEv", line: 5, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !1, scope: !"_ZTS1A", type: !9) |
| 118 | !9 = !DISubroutineType(types: !10) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 119 | !10 = !{null, !11} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 120 | !11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A") |
| 121 | !12 = !DICompositeType(tag: DW_TAG_class_type, name: "B", line: 11, size: 8, align: 8, file: !1, elements: !13, identifier: "_ZTS1B") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 122 | !13 = !{!14, !15, !16, !20, !21} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 123 | !14 = !DIDerivedType(tag: DW_TAG_inheritance, flags: DIFlagPublic, scope: !"_ZTS1B", baseType: !"_ZTS1A") |
| 124 | !15 = !DIDerivedType(tag: DW_TAG_member, name: "public_static", line: 16, flags: DIFlagPublic | DIFlagStaticMember, file: !1, scope: !"_ZTS1B", baseType: !7) |
| 125 | !16 = !DISubprogram(name: "pub", linkageName: "_ZN1B3pubEv", line: 14, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 14, file: !1, scope: !"_ZTS1B", type: !17) |
| 126 | !17 = !DISubroutineType(types: !18) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 127 | !18 = !{null, !19} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 128 | !19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1B") |
| 129 | !20 = !DISubprogram(name: "prot", linkageName: "_ZN1B4protEv", line: 19, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagProtected | DIFlagPrototyped, isOptimized: false, scopeLine: 19, file: !1, scope: !"_ZTS1B", type: !17) |
| 130 | !21 = !DISubprogram(name: "priv_default", linkageName: "_ZN1B12priv_defaultEv", line: 22, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 22, file: !1, scope: !"_ZTS1B", type: !17) |
| 131 | !22 = !DICompositeType(tag: DW_TAG_union_type, name: "U", line: 25, size: 32, align: 32, file: !1, elements: !23, identifier: "_ZTS1U") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 132 | !23 = !{!24, !25} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 133 | !24 = !DIDerivedType(tag: DW_TAG_member, name: "union_priv", line: 30, size: 32, align: 32, flags: DIFlagPrivate, file: !1, scope: !"_ZTS1U", baseType: !7) |
| 134 | !25 = !DISubprogram(name: "union_pub_default", linkageName: "_ZN1U17union_pub_defaultEv", line: 27, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 27, file: !1, scope: !"_ZTS1U", type: !26) |
| 135 | !26 = !DISubroutineType(types: !27) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 136 | !27 = !{null, !28} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 137 | !28 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1U") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 138 | !29 = !{!30} |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 139 | !30 = distinct !DISubprogram(name: "free", linkageName: "_Z4freev", line: 35, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 35, file: !1, scope: !31, type: !32, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 140 | !31 = !DIFile(filename: "/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp", directory: "") |
| 141 | !32 = !DISubroutineType(types: !33) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 142 | !33 = !{null} |
| 143 | !34 = !{!35, !36, !37} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 144 | !35 = !DIGlobalVariable(name: "a", line: 37, isLocal: false, isDefinition: true, scope: null, file: !31, type: !"_ZTS1A", variable: %struct.A* @a) |
| 145 | !36 = !DIGlobalVariable(name: "b", line: 38, isLocal: false, isDefinition: true, scope: null, file: !31, type: !"_ZTS1B", variable: %class.B* @b) |
| 146 | !37 = !DIGlobalVariable(name: "u", line: 39, isLocal: false, isDefinition: true, scope: null, file: !31, type: !"_ZTS1U", variable: %union.U* @u) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 147 | !38 = !{i32 2, !"Dwarf Version", i32 2} |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 148 | !39 = !{i32 2, !"Debug Info Version", i32 3} |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 149 | !40 = !{!"clang version 3.6.0 "} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 150 | !41 = !DILocation(line: 35, column: 14, scope: !30) |