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' 87target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 88target 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 99define void @_Z4freev() #0 !dbg !30 { 100 ret void, !dbg !41 101} 102 103attributes #0 = { nounwind ssp uwtable } 104 105!llvm.dbg.cu = !{!0} 106!llvm.module.flags = !{!38, !39} 107!llvm.ident = !{!40} 108 109!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !34, imports: !2) 110!1 = !DIFile(filename: "/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp", directory: "") 111!2 = !{} 112!3 = !{!4, !12, !22} 113!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 3, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1A") 114!5 = !{!6, !8} 115!6 = !DIDerivedType(tag: DW_TAG_member, name: "pub_default_static", line: 7, flags: DIFlagStaticMember, file: !1, scope: !4, 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: !4, type: !9) 118!9 = !DISubroutineType(types: !10) 119!10 = !{null, !11} 120!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4) 121!12 = !DICompositeType(tag: DW_TAG_class_type, name: "B", line: 11, size: 8, align: 8, file: !1, elements: !13, identifier: "_ZTS1B") 122!13 = !{!14, !15, !16, !20, !21} 123!14 = !DIDerivedType(tag: DW_TAG_inheritance, flags: DIFlagPublic, scope: !12, baseType: !4) 124!15 = !DIDerivedType(tag: DW_TAG_member, name: "public_static", line: 16, flags: DIFlagPublic | DIFlagStaticMember, file: !1, scope: !12, 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: !12, type: !17) 126!17 = !DISubroutineType(types: !18) 127!18 = !{null, !19} 128!19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !12) 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: !12, 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: !12, type: !17) 131!22 = !DICompositeType(tag: DW_TAG_union_type, name: "U", line: 25, size: 32, align: 32, file: !1, elements: !23, identifier: "_ZTS1U") 132!23 = !{!24, !25} 133!24 = !DIDerivedType(tag: DW_TAG_member, name: "union_priv", line: 30, size: 32, align: 32, flags: DIFlagPrivate, file: !1, scope: !22, 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: !22, type: !26) 135!26 = !DISubroutineType(types: !27) 136!27 = !{null, !28} 137!28 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !22) 138!30 = distinct !DISubprogram(name: "free", linkageName: "_Z4freev", line: 35, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 35, file: !1, scope: !31, type: !32, variables: !2) 139!31 = !DIFile(filename: "/llvm/tools/clang/test/CodeGenCXX/debug-info-access.cpp", directory: "") 140!32 = !DISubroutineType(types: !33) 141!33 = !{null} 142!34 = !{!35, !36, !37} 143!35 = !DIGlobalVariable(name: "a", line: 37, isLocal: false, isDefinition: true, scope: null, file: !31, type: !4, variable: %struct.A* @a) 144!36 = !DIGlobalVariable(name: "b", line: 38, isLocal: false, isDefinition: true, scope: null, file: !31, type: !12, variable: %class.B* @b) 145!37 = !DIGlobalVariable(name: "u", line: 39, isLocal: false, isDefinition: true, scope: null, file: !31, type: !22, variable: %union.U* @u) 146!38 = !{i32 2, !"Dwarf Version", i32 2} 147!39 = !{i32 2, !"Debug Info Version", i32 3} 148!40 = !{!"clang version 3.6.0 "} 149!41 = !DILocation(line: 35, column: 14, scope: !30) 150