1; RUN: opt -S -passes=strip-nonlinetable-debuginfo %s -o %t.ll 2; RUN: cat %t.ll | FileCheck %s 3; RUN: cat %t.ll | FileCheck %s --check-prefix=CHECK-NEG 4; 5; This test provides coverage for setting the containing type of a DISubprogram. 6; 7; Generated an reduced from: 8; struct A { 9; virtual ~A(); 10; }; 11; struct B : A {}; 12; B b; 13 14source_filename = "t.cpp" 15target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 16target triple = "x86_64-apple-macosx10.12.0" 17 18%struct.B = type { %struct.A } 19%struct.A = type { ptr } 20 21; CHECK: @b = global 22; CHECK-NOT: !dbg 23@b = global %struct.B zeroinitializer, align 8, !dbg !0 24 25declare void @_ZN1BC2Ev(ptr) unnamed_addr 26 27; Function Attrs: nounwind readnone 28declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 29; CHECK: define 30 31; Function Attrs: inlinehint nounwind ssp uwtable 32define linkonce_odr void @_ZN1BC1Ev(ptr %this) unnamed_addr #1 align 2 !dbg !25 { 33entry: 34 %this.addr = alloca ptr, align 8 35 store ptr %this, ptr %this.addr, align 8 36 ; CHECK-NOT: @llvm.dbg.declare 37 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !30, metadata !32), !dbg !33 38 %this1 = load ptr, ptr %this.addr, align 8 39 call void @_ZN1BC2Ev(ptr %this1) #2, !dbg !34 40 ret void, !dbg !34 41 ; CHECK: call void @_ZN1BC2Ev(ptr %this1){{.*}} !dbg ! 42} 43 44attributes #0 = { nounwind readnone } 45attributes #1 = { inlinehint nounwind ssp uwtable } 46attributes #2 = { nounwind } 47 48!llvm.dbg.cu = !{!2} 49!llvm.module.flags = !{!21, !22, !23} 50!llvm.ident = !{!24} 51 52; CHECK-NEG-NOT: !DI{{Basic|Composite|Derived}}Type 53 54!0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 55!1 = !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 5, type: !6, isLocal: false, isDefinition: true) 56!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 4.0.0 (trunk 282583) (llvm/trunk 282611)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) 57!3 = !DIFile(filename: "t.cpp", directory: "/") 58!4 = !{} 59!5 = !{!0} 60!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !3, line: 4, size: 64, align: 64, elements: !7, vtableHolder: !9, identifier: "_ZTS1B") 61!7 = !{!8} 62!8 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !6, baseType: !9) 63!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 1, size: 64, align: 64, elements: !10, vtableHolder: !9, identifier: "_ZTS1A") 64!10 = !{!11, !17} 65!11 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", scope: !3, file: !3, baseType: !12, size: 64, flags: DIFlagArtificial) 66!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64) 67!13 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", baseType: !14, size: 64) 68!14 = !DISubroutineType(types: !15) 69!15 = !{!16} 70!16 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 71!17 = !DISubprogram(name: "~A", scope: !9, file: !3, line: 2, type: !18, isLocal: false, isDefinition: false, scopeLine: 2, containingType: !9, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0, flags: DIFlagPrototyped, isOptimized: false) 72!18 = !DISubroutineType(types: !19) 73!19 = !{null, !20} 74!20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 75!21 = !{i32 2, !"Dwarf Version", i32 4} 76!22 = !{i32 2, !"Debug Info Version", i32 3} 77!23 = !{i32 1, !"PIC Level", i32 2} 78!24 = !{!"clang version 4.0.0 (trunk 282583) (llvm/trunk 282611)"} 79; Only referenced by the type system. 80; CHECK-NEG-NOT: !DISubprogram(name: "~A" 81!25 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC1Ev", scope: !6, file: !3, line: 4, type: !26, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, unit: !2, declaration: !29, retainedNodes: !4) 82!26 = !DISubroutineType(types: !27) 83!27 = !{null, !28} 84!28 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 85!29 = !DISubprogram(name: "B", scope: !6, type: !26, isLocal: false, isDefinition: false, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false) 86!30 = !DILocalVariable(name: "this", arg: 1, scope: !25, type: !31, flags: DIFlagArtificial | DIFlagObjectPointer) 87!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, align: 64) 88!32 = !DIExpression() 89!33 = !DILocation(line: 0, scope: !25) 90!34 = !DILocation(line: 4, column: 8, scope: !25) 91 92; CHECK: !DISubprogram(name: "B", scope: ![[FILE:.*]], file: ![[FILE]], 93; CHECK-NOT: containingType: 94; CHECK-NEG-NOT: !DISubprogram(name: "B", {{.*}}, isDefinition: false 95