1; RUN: llc < %s -filetype=obj -o %t.o 2; RUN: llvm-pdbutil dump -types %t.o | FileCheck %s 3 4; RUN: llc --try-experimental-debuginfo-iterators < %s -filetype=obj -o %t.o 5; RUN: llvm-pdbutil dump -types %t.o | FileCheck %s 6 7; C++ source: 8; // Note that MSVC doesn't emit anything about WrapTypedef or WrapTypedef::Inner! 9; struct WrapTypedef { 10; typedef int Inner; 11; }; 12; struct WrapStruct { 13; struct Inner { int x; }; 14; }; 15; struct WrapClass { 16; class Inner { public: int x; }; 17; }; 18; struct WrapEnum { 19; enum Inner { One, Two }; 20; }; 21; struct WrapUnion { 22; union Inner { int x; float y; }; 23; }; 24; void useInnerTypes() { 25; WrapTypedef::Inner v1; 26; WrapStruct::Inner v2; 27; WrapClass::Inner v3; 28; WrapEnum::Inner v4; 29; WrapUnion::Inner v5; 30; } 31 32; There should be two LF_STRUCTURE records for each wrapped type, forward decl 33; and complete type. For every inner record type, there should be two. Enums 34; don't get forward decls. 35 36; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapStruct` 37; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapStruct` 38; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapStruct::Inner` 39; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapStruct::Inner` 40; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapClass` 41; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapClass` 42; CHECK-DAG: | LF_CLASS {{.*}} `WrapClass::Inner` 43; CHECK-DAG: | LF_CLASS {{.*}} `WrapClass::Inner` 44; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapEnum` 45; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapEnum` 46; CHECK-DAG: | LF_ENUM {{.*}} `WrapEnum::Inner` 47; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapUnion` 48; CHECK-DAG: | LF_STRUCTURE {{.*}} `WrapUnion` 49; CHECK-DAG: | LF_UNION {{.*}} `WrapUnion::Inner` 50; CHECK-DAG: | LF_UNION {{.*}} `WrapUnion::Inner` 51 52; ModuleID = 't.cpp' 53source_filename = "t.cpp" 54target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 55target triple = "x86_64-pc-windows-msvc19.23.28106" 56 57%"struct.WrapStruct::Inner" = type { i32 } 58%"class.WrapClass::Inner" = type { i32 } 59%"union.WrapUnion::Inner" = type { i32 } 60 61; Function Attrs: noinline nounwind optnone uwtable 62define dso_local void @"?useInnerTypes@@YAXXZ"() #0 !dbg !15 { 63entry: 64 %v1 = alloca i32, align 4 65 %v2 = alloca %"struct.WrapStruct::Inner", align 4 66 %v3 = alloca %"class.WrapClass::Inner", align 4 67 %v4 = alloca i32, align 4 68 %v5 = alloca %"union.WrapUnion::Inner", align 4 69 call void @llvm.dbg.declare(metadata ptr %v1, metadata !19, metadata !DIExpression()), !dbg !23 70 call void @llvm.dbg.declare(metadata ptr %v2, metadata !24, metadata !DIExpression()), !dbg !30 71 call void @llvm.dbg.declare(metadata ptr %v3, metadata !31, metadata !DIExpression()), !dbg !37 72 call void @llvm.dbg.declare(metadata ptr %v4, metadata !38, metadata !DIExpression()), !dbg !39 73 call void @llvm.dbg.declare(metadata ptr %v5, metadata !40, metadata !DIExpression()), !dbg !48 74 ret void, !dbg !49 75} 76 77; Function Attrs: nounwind readnone speculatable willreturn 78declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 79 80attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 81attributes #1 = { nounwind readnone speculatable willreturn } 82 83!llvm.dbg.cu = !{!0} 84!llvm.module.flags = !{!10, !11, !12, !13} 85!llvm.ident = !{!14} 86 87!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0 (git@github.com:llvm/llvm-project.git a8ccb48f697d3fbe85c593248ff1053fdf522a6e)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) 88!1 = !DIFile(filename: "t.cpp", directory: "C:\\src\\llvm-project\\build", checksumkind: CSK_MD5, checksum: "4228f12f516cd3d6dd76462be09ec111") 89!2 = !{!3, !3} 90!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Inner", scope: !4, file: !1, line: 11, baseType: !6, size: 32, elements: !7, identifier: ".?AW4Inner@WrapEnum@@") 91!4 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "WrapEnum", file: !1, line: 10, size: 8, flags: DIFlagTypePassByValue, elements: !5, identifier: ".?AUWrapEnum@@") 92!5 = !{!3} 93!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 94!7 = !{!8, !9} 95!8 = !DIEnumerator(name: "One", value: 0) 96!9 = !DIEnumerator(name: "Two", value: 1) 97!10 = !{i32 2, !"CodeView", i32 1} 98!11 = !{i32 2, !"Debug Info Version", i32 3} 99!12 = !{i32 1, !"wchar_size", i32 2} 100!13 = !{i32 7, !"PIC Level", i32 2} 101!14 = !{!"clang version 10.0.0 (git@github.com:llvm/llvm-project.git a8ccb48f697d3fbe85c593248ff1053fdf522a6e)"} 102!15 = distinct !DISubprogram(name: "useInnerTypes", linkageName: "?useInnerTypes@@YAXXZ", scope: !1, file: !1, line: 16, type: !16, scopeLine: 16, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !18) 103!16 = !DISubroutineType(types: !17) 104!17 = !{null} 105!18 = !{} 106!19 = !DILocalVariable(name: "v1", scope: !15, file: !1, line: 17, type: !20) 107!20 = !DIDerivedType(tag: DW_TAG_typedef, name: "Inner", scope: !21, file: !1, line: 2, baseType: !6) 108!21 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "WrapTypedef", file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !22, identifier: ".?AUWrapTypedef@@") 109!22 = !{!20} 110!23 = !DILocation(line: 17, scope: !15) 111!24 = !DILocalVariable(name: "v2", scope: !15, file: !1, line: 18, type: !25) 112!25 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Inner", scope: !26, file: !1, line: 5, size: 32, flags: DIFlagTypePassByValue, elements: !28, identifier: ".?AUInner@WrapStruct@@") 113!26 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "WrapStruct", file: !1, line: 4, size: 8, flags: DIFlagTypePassByValue, elements: !27, identifier: ".?AUWrapStruct@@") 114!27 = !{!25} 115!28 = !{!29} 116!29 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !25, file: !1, line: 5, baseType: !6, size: 32) 117!30 = !DILocation(line: 18, scope: !15) 118!31 = !DILocalVariable(name: "v3", scope: !15, file: !1, line: 19, type: !32) 119!32 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "Inner", scope: !33, file: !1, line: 8, size: 32, flags: DIFlagTypePassByValue, elements: !35, identifier: ".?AVInner@WrapClass@@") 120!33 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "WrapClass", file: !1, line: 7, size: 8, flags: DIFlagTypePassByValue, elements: !34, identifier: ".?AUWrapClass@@") 121!34 = !{!32} 122!35 = !{!36} 123!36 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !32, file: !1, line: 8, baseType: !6, size: 32, flags: DIFlagPublic) 124!37 = !DILocation(line: 19, scope: !15) 125!38 = !DILocalVariable(name: "v4", scope: !15, file: !1, line: 20, type: !3) 126!39 = !DILocation(line: 20, scope: !15) 127!40 = !DILocalVariable(name: "v5", scope: !15, file: !1, line: 21, type: !41) 128!41 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "Inner", scope: !42, file: !1, line: 14, size: 32, flags: DIFlagTypePassByValue, elements: !44, identifier: ".?ATInner@WrapUnion@@") 129!42 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "WrapUnion", file: !1, line: 13, size: 8, flags: DIFlagTypePassByValue, elements: !43, identifier: ".?AUWrapUnion@@") 130!43 = !{!41} 131!44 = !{!45, !46} 132!45 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !41, file: !1, line: 14, baseType: !6, size: 32) 133!46 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !41, file: !1, line: 14, baseType: !47, size: 32) 134!47 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float) 135!48 = !DILocation(line: 21, scope: !15) 136!49 = !DILocation(line: 22, scope: !15) 137