1; RUN: llc -filetype=obj %s -o %t.obj
2; RUN: llvm-pdbutil dump -symbols -types %t.obj | FileCheck %s
3
4; Make sure that `gv`, `Bar`, and `Baz` all point to the complete type index of
5; Foo (0x1002), and not the forward declaration index (0x1000).
6
7; C++ source:
8; struct Foo {
9;   int x;
10; };
11; typedef Foo Bar;
12; typedef Bar Baz;
13; static_assert(sizeof(Foo) == 4, "");
14; Baz gv;
15
16; CHECK:                       Types (.debug$T)
17; CHECK-NEXT: ============================================================
18; CHECK: 0x1000 | LF_STRUCTURE [size = 36] `Foo`
19; CHECK:          unique name: `.?AUFoo@@`
20; CHECK:          vtable: <no type>, base list: <no type>, field list: <no type>
21; CHECK:          options: forward ref | has unique name, sizeof 0
22; CHECK: 0x1001 | LF_FIELDLIST [size = 16]
23; CHECK:          - LF_MEMBER [name = `x`, Type = 0x0074 (int), offset = 0, attrs = public]
24; CHECK: 0x1002 | LF_STRUCTURE [size = 36] `Foo`
25; CHECK:          unique name: `.?AUFoo@@`
26; CHECK:          vtable: <no type>, base list: <no type>, field list: 0x1001
27; CHECK:          options: has unique name, sizeof 4
28; CHECK: 0x1004 | LF_UDT_SRC_LINE [size = 16]
29; CHECK:          udt = 0x1002, file = 4099, line = 1
30
31; CHECK:                           Symbols
32; CHECK: ============================================================
33; CHECK:   Mod 0000 | `.debug$S`:
34; CHECK:        0 | S_GDATA32 [size = 20] `gv`
35; CHECK:            type = 0x1002 (Foo), addr = 0000:0000
36; CHECK:        0 | S_UDT [size = 12] `Bar`
37; CHECK:            original type = 0x1002
38; CHECK:        0 | S_UDT [size = 12] `Baz`
39; CHECK:            original type = 0x1002
40; CHECK:        0 | S_UDT [size = 12] `Foo`
41; CHECK:            original type = 0x1002
42
43; ModuleID = 't.cpp'
44source_filename = "t.cpp"
45target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
46target triple = "x86_64-pc-windows-msvc19.14.26433"
47
48%struct.Foo = type { i32 }
49
50@"?gv@@3UFoo@@A" = dso_local global %struct.Foo zeroinitializer, align 4, !dbg !0
51
52!llvm.dbg.cu = !{!2}
53!llvm.module.flags = !{!12, !13, !14, !15}
54!llvm.ident = !{!16}
55
56!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
57!1 = distinct !DIGlobalVariable(name: "gv", linkageName: "?gv@@3UFoo@@A", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true)
58!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 8.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
59!3 = !DIFile(filename: "t.cpp", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "e21cd263d43db2ff55050be3e41e789f")
60!4 = !{}
61!5 = !{!0}
62!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "Baz", file: !3, line: 5, baseType: !7)
63!7 = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar", file: !3, line: 4, baseType: !8)
64!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !3, line: 1, size: 32, flags: DIFlagTypePassByValue, elements: !9, identifier: ".?AUFoo@@")
65!9 = !{!10}
66!10 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !8, file: !3, line: 2, baseType: !11, size: 32)
67!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
68!12 = !{i32 2, !"CodeView", i32 1}
69!13 = !{i32 2, !"Debug Info Version", i32 3}
70!14 = !{i32 1, !"wchar_size", i32 2}
71!15 = !{i32 7, !"PIC Level", i32 2}
72!16 = !{!"clang version 8.0.0 "}
73