1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; Check that we keep namespace scopes around the same way MSVC does. 4*9880d681SAndroid Build Coastguard Worker; We do function scopes slightly differently, but everything should be alright. 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; C++ source to regenerate: 7*9880d681SAndroid Build Coastguard Worker; namespace foo { 8*9880d681SAndroid Build Coastguard Worker; namespace bar { 9*9880d681SAndroid Build Coastguard Worker; void baz() { 10*9880d681SAndroid Build Coastguard Worker; struct LocalRecord { 11*9880d681SAndroid Build Coastguard Worker; int x; 12*9880d681SAndroid Build Coastguard Worker; } l; 13*9880d681SAndroid Build Coastguard Worker; }; 14*9880d681SAndroid Build Coastguard Worker; struct GlobalRecord { 15*9880d681SAndroid Build Coastguard Worker; int x; 16*9880d681SAndroid Build Coastguard Worker; void method(); 17*9880d681SAndroid Build Coastguard Worker; } g; 18*9880d681SAndroid Build Coastguard Worker; void GlobalRecord::method() {} 19*9880d681SAndroid Build Coastguard Worker; } 20*9880d681SAndroid Build Coastguard Worker; } 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: FuncId ({{.*}}) { 23*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: TypeLeafKind: LF_FUNC_ID (0x1601) 24*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ParentScope: foo::bar ({{.*}}) 25*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: FunctionType: void () ({{.*}}) 26*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: Name: baz 27*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: } 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker; CHECK: Struct ({{.*}}) { 30*9880d681SAndroid Build Coastguard Worker; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505) 31*9880d681SAndroid Build Coastguard Worker; CHECK: MemberCount: 0 32*9880d681SAndroid Build Coastguard Worker; CHECK: Properties [ (0x180) 33*9880d681SAndroid Build Coastguard Worker; CHECK: ForwardReference (0x80) 34*9880d681SAndroid Build Coastguard Worker; CHECK: Scoped (0x100) 35*9880d681SAndroid Build Coastguard Worker; CHECK: ] 36*9880d681SAndroid Build Coastguard Worker; CHECK: FieldList: 0x0 37*9880d681SAndroid Build Coastguard Worker; CHECK: DerivedFrom: 0x0 38*9880d681SAndroid Build Coastguard Worker; CHECK: VShape: 0x0 39*9880d681SAndroid Build Coastguard Worker; CHECK: SizeOf: 0 40*9880d681SAndroid Build Coastguard Worker; CHECK: Name: foo::bar::baz::LocalRecord 41*9880d681SAndroid Build Coastguard Worker; CHECK: } 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker; CHECK: Struct ({{.*}}) { 44*9880d681SAndroid Build Coastguard Worker; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505) 45*9880d681SAndroid Build Coastguard Worker; CHECK: MemberCount: 1 46*9880d681SAndroid Build Coastguard Worker; CHECK: Properties [ (0x100) 47*9880d681SAndroid Build Coastguard Worker; CHECK: Scoped (0x100) 48*9880d681SAndroid Build Coastguard Worker; CHECK: ] 49*9880d681SAndroid Build Coastguard Worker; CHECK: Name: foo::bar::baz::LocalRecord 50*9880d681SAndroid Build Coastguard Worker; CHECK: } 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Worker; CHECK: Struct ({{.*}}) { 53*9880d681SAndroid Build Coastguard Worker; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505) 54*9880d681SAndroid Build Coastguard Worker; CHECK: MemberCount: 0 55*9880d681SAndroid Build Coastguard Worker; CHECK: Properties [ (0x280) 56*9880d681SAndroid Build Coastguard Worker; CHECK: ForwardReference (0x80) 57*9880d681SAndroid Build Coastguard Worker; CHECK: HasUniqueName (0x200) 58*9880d681SAndroid Build Coastguard Worker; CHECK: ] 59*9880d681SAndroid Build Coastguard Worker; CHECK: FieldList: 0x0 60*9880d681SAndroid Build Coastguard Worker; CHECK: DerivedFrom: 0x0 61*9880d681SAndroid Build Coastguard Worker; CHECK: VShape: 0x0 62*9880d681SAndroid Build Coastguard Worker; CHECK: SizeOf: 0 63*9880d681SAndroid Build Coastguard Worker; CHECK: Name: foo::bar::GlobalRecord 64*9880d681SAndroid Build Coastguard Worker; CHECK: } 65*9880d681SAndroid Build Coastguard Worker 66*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: MemberFuncId ({{.*}}) { 67*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: TypeLeafKind: LF_MFUNC_ID (0x1602) 68*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ClassType: foo::bar::GlobalRecord ({{.*}}) 69*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: FunctionType: void foo::bar::GlobalRecord::() ({{.*}}) 70*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: Name: method 71*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: } 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker 74*9880d681SAndroid Build Coastguard Worker; ModuleID = 't.cpp' 75*9880d681SAndroid Build Coastguard Workersource_filename = "t.cpp" 76*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 77*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-pc-windows-msvc19.0.23918" 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Worker%"struct.foo::bar::GlobalRecord" = type { i32 } 80*9880d681SAndroid Build Coastguard Worker%struct.LocalRecord = type { i32 } 81*9880d681SAndroid Build Coastguard Worker 82*9880d681SAndroid Build Coastguard Worker@"\01?g@bar@foo@@3UGlobalRecord@12@A" = global %"struct.foo::bar::GlobalRecord" zeroinitializer, align 4 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable 85*9880d681SAndroid Build Coastguard Workerdefine void @"\01?baz@bar@foo@@YAXXZ"() #0 !dbg !19 { 86*9880d681SAndroid Build Coastguard Workerentry: 87*9880d681SAndroid Build Coastguard Worker %l = alloca %struct.LocalRecord, align 4 88*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %struct.LocalRecord* %l, metadata !22, metadata !26), !dbg !27 89*9880d681SAndroid Build Coastguard Worker ret void, !dbg !28 90*9880d681SAndroid Build Coastguard Worker} 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 93*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1 94*9880d681SAndroid Build Coastguard Worker 95*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable 96*9880d681SAndroid Build Coastguard Workerdefine void @"\01?method@GlobalRecord@bar@foo@@QEAAXXZ"(%"struct.foo::bar::GlobalRecord"* %this) #0 align 2 !dbg !29 { 97*9880d681SAndroid Build Coastguard Workerentry: 98*9880d681SAndroid Build Coastguard Worker %this.addr = alloca %"struct.foo::bar::GlobalRecord"*, align 8 99*9880d681SAndroid Build Coastguard Worker store %"struct.foo::bar::GlobalRecord"* %this, %"struct.foo::bar::GlobalRecord"** %this.addr, align 8 100*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %"struct.foo::bar::GlobalRecord"** %this.addr, metadata !30, metadata !26), !dbg !32 101*9880d681SAndroid Build Coastguard Worker %this1 = load %"struct.foo::bar::GlobalRecord"*, %"struct.foo::bar::GlobalRecord"** %this.addr, align 8 102*9880d681SAndroid Build Coastguard Worker ret void, !dbg !33 103*9880d681SAndroid Build Coastguard Worker} 104*9880d681SAndroid Build Coastguard Worker 105*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 106*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 107*9880d681SAndroid Build Coastguard Worker 108*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 109*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!15, !16, !17} 110*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!18} 111*9880d681SAndroid Build Coastguard Worker 112*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3) 113*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild") 114*9880d681SAndroid Build Coastguard Worker!2 = !{} 115*9880d681SAndroid Build Coastguard Worker!3 = !{!4} 116*9880d681SAndroid Build Coastguard Worker!4 = distinct !DIGlobalVariable(name: "g", linkageName: "\01?g@bar@foo@@3UGlobalRecord@12@A", scope: !5, file: !1, line: 12, type: !7, isLocal: false, isDefinition: true, variable: %"struct.foo::bar::GlobalRecord"* @"\01?g@bar@foo@@3UGlobalRecord@12@A") 117*9880d681SAndroid Build Coastguard Worker!5 = !DINamespace(name: "bar", scope: !6, file: !1, line: 2) 118*9880d681SAndroid Build Coastguard Worker!6 = !DINamespace(name: "foo", scope: null, file: !1, line: 1) 119*9880d681SAndroid Build Coastguard Worker!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "GlobalRecord", scope: !5, file: !1, line: 9, size: 32, align: 32, elements: !8, identifier: ".?AUGlobalRecord@bar@foo@@") 120*9880d681SAndroid Build Coastguard Worker!8 = !{!9, !11} 121*9880d681SAndroid Build Coastguard Worker!9 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !7, file: !1, line: 10, baseType: !10, size: 32, align: 32) 122*9880d681SAndroid Build Coastguard Worker!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 123*9880d681SAndroid Build Coastguard Worker!11 = !DISubprogram(name: "method", linkageName: "\01?method@GlobalRecord@bar@foo@@QEAAXXZ", scope: !7, file: !1, line: 11, type: !12, isLocal: false, isDefinition: false, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: false) 124*9880d681SAndroid Build Coastguard Worker!12 = !DISubroutineType(types: !13) 125*9880d681SAndroid Build Coastguard Worker!13 = !{null, !14} 126*9880d681SAndroid Build Coastguard Worker!14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 127*9880d681SAndroid Build Coastguard Worker!15 = !{i32 2, !"CodeView", i32 1} 128*9880d681SAndroid Build Coastguard Worker!16 = !{i32 2, !"Debug Info Version", i32 3} 129*9880d681SAndroid Build Coastguard Worker!17 = !{i32 1, !"PIC Level", i32 2} 130*9880d681SAndroid Build Coastguard Worker!18 = !{!"clang version 3.9.0 "} 131*9880d681SAndroid Build Coastguard Worker!19 = distinct !DISubprogram(name: "baz", linkageName: "\01?baz@bar@foo@@YAXXZ", scope: !5, file: !1, line: 3, type: !20, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) 132*9880d681SAndroid Build Coastguard Worker!20 = !DISubroutineType(types: !21) 133*9880d681SAndroid Build Coastguard Worker!21 = !{null} 134*9880d681SAndroid Build Coastguard Worker!22 = !DILocalVariable(name: "l", scope: !19, file: !1, line: 6, type: !23) 135*9880d681SAndroid Build Coastguard Worker!23 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "LocalRecord", scope: !19, file: !1, line: 4, size: 32, align: 32, elements: !24) 136*9880d681SAndroid Build Coastguard Worker!24 = !{!25} 137*9880d681SAndroid Build Coastguard Worker!25 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !23, file: !1, line: 5, baseType: !10, size: 32, align: 32) 138*9880d681SAndroid Build Coastguard Worker!26 = !DIExpression() 139*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 6, column: 5, scope: !19) 140*9880d681SAndroid Build Coastguard Worker!28 = !DILocation(line: 7, column: 1, scope: !19) 141*9880d681SAndroid Build Coastguard Worker!29 = distinct !DISubprogram(name: "method", linkageName: "\01?method@GlobalRecord@bar@foo@@QEAAXXZ", scope: !7, file: !1, line: 13, type: !12, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !11, variables: !2) 142*9880d681SAndroid Build Coastguard Worker!30 = !DILocalVariable(name: "this", arg: 1, scope: !29, type: !31, flags: DIFlagArtificial | DIFlagObjectPointer) 143*9880d681SAndroid Build Coastguard Worker!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64) 144*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 0, scope: !29) 145*9880d681SAndroid Build Coastguard Worker!33 = !DILocation(line: 13, column: 30, scope: !29) 146