1RUN: yaml2obj %p/Inputs/pdb-hashes-1.yaml > %t.1.obj
2RUN: yaml2obj %p/Inputs/pdb-hashes-2.yaml > %t.2.obj
3RUN: yaml2obj %p/Inputs/pdb-hashes-2-missing.yaml > %t.2.missing.obj
4RUN: lld-link /debug %t.1.obj %t.2.obj /entry:main /nodefaultlib /PDB:%t.nohash.pdb
5RUN: lld-link /debug:ghash %t.1.obj %t.2.obj /entry:main /nodefaultlib /PDB:%t.hash.pdb
6RUN: lld-link /debug:ghash %t.1.obj %t.2.missing.obj /entry:main /nodefaultlib /PDB:%t.mixed.pdb
7RUN: llvm-pdbutil dump -types -ids -dont-resolve-forward-refs %t.nohash.pdb | FileCheck %s
8RUN: llvm-pdbutil dump -types -ids -dont-resolve-forward-refs %t.hash.pdb | FileCheck %s
9RUN: llvm-pdbutil dump -types -ids -dont-resolve-forward-refs %t.mixed.pdb | FileCheck %s
10
11; These object files were generated via the following inputs and commands:
12; ----------------------------------------------
13; // obj.h
14; namespace NS {
15;   struct Foo {
16;     explicit Foo(int x) : X(x) {}
17;     int X;
18;   };
19;
20;   int func(const Foo &f);
21; }
22; ----------------------------------------------
23; // obj1.cpp
24; #include "obj.h"
25;
26; int main(int argc, char **argv) {
27;   NS::Foo f(argc);
28;   return NS::func(f);
29; }
30; ----------------------------------------------
31; // obj2.cpp
32; #include "obj.h"
33;
34; int NS::func(const Foo &f) {
35;   return 2 * f.X;
36; }
37; ----------------------------------------------
38; $ clang-cl /Z7 /GS- obj1.cpp /c /o obj1.obj
39; $ clang-cl /Z7 /GS- obj2.cpp /c /o obj2.obj
40
41CHECK:                           Types (TPI Stream)
42CHECK-NEXT: ============================================================
43CHECK-NEXT:   Showing 13 records
44CHECK-NEXT:   0x1000 | LF_POINTER [size = 12]
45CHECK-NEXT:            referent = 0x0470 (char*), mode = pointer, opts = None, kind = ptr32
46CHECK-NEXT:   0x1001 | LF_ARGLIST [size = 16]
47CHECK-NEXT:            0x0074 (int): `int`
48CHECK-NEXT:            0x1000: `char**`
49CHECK-NEXT:   0x1002 | LF_PROCEDURE [size = 16]
50CHECK-NEXT:            return type = 0x0074 (int), # args = 2, param list = 0x1001
51CHECK-NEXT:            calling conv = cdecl, options = None
52CHECK-NEXT:   0x1003 | LF_STRUCTURE [size = 44] `NS::Foo`
53CHECK-NEXT:            unique name: `.?AUFoo@NS@@`
54CHECK-NEXT:            vtable: <no type>, base list: <no type>, field list: <no type>
55CHECK-NEXT:            options: forward ref | has unique name
56CHECK-NEXT:   0x1004 | LF_POINTER [size = 12]
57CHECK-NEXT:            referent = 0x1003, mode = pointer, opts = None, kind = ptr32
58CHECK-NEXT:   0x1005 | LF_ARGLIST [size = 12]
59CHECK-NEXT:            0x0074 (int): `int`
60CHECK-NEXT:   0x1006 | LF_MFUNCTION [size = 28]
61CHECK-NEXT:            return type = 0x0003 (void), # args = 1, param list = 0x1005
62CHECK-NEXT:            class type = 0x1003, this type = 0x1004, this adjust = 0
63CHECK-NEXT:            calling conv = thiscall, options = None
64CHECK-NEXT:   0x1007 | LF_FIELDLIST [size = 28]
65CHECK-NEXT:            - LF_MEMBER [name = `X`, Type = 0x0074 (int), offset = 0, attrs = public]
66CHECK-NEXT:            - LF_ONEMETHOD [name = `Foo`]
67CHECK-NEXT:              type = 0x1006, vftable offset = -1, attrs = public
68CHECK-NEXT:   0x1008 | LF_STRUCTURE [size = 44] `NS::Foo`
69CHECK-NEXT:            unique name: `.?AUFoo@NS@@`
70CHECK-NEXT:            vtable: <no type>, base list: <no type>, field list: 0x1007
71CHECK-NEXT:            options: has unique name
72CHECK-NEXT:   0x1009 | LF_MODIFIER [size = 12]
73CHECK-NEXT:            referent = 0x1003, modifiers = const
74CHECK-NEXT:   0x100A | LF_POINTER [size = 12]
75CHECK-NEXT:            referent = 0x1009, mode = ref, opts = None, kind = ptr32
76CHECK-NEXT:   0x100B | LF_ARGLIST [size = 12]
77CHECK-NEXT:            0x100A: `const NS::Foo&`
78CHECK-NEXT:   0x100C | LF_PROCEDURE [size = 16]
79CHECK-NEXT:            return type = 0x0074 (int), # args = 1, param list = 0x100B
80CHECK-NEXT:            calling conv = cdecl, options = None
81CHECK:                           Types (IPI Stream)
82CHECK-NEXT: ============================================================
83CHECK-NEXT:   Showing 6 records
84CHECK-NEXT:   0x1000 | LF_FUNC_ID [size = 20]
85CHECK-NEXT:            name = main, type = 0x1002, parent scope = <no type>
86CHECK-NEXT:   0x1001 | LF_STRING_ID [size = {{.*}}] ID: <no type>, String: {{.*}}obj.h
87CHECK-NEXT:   0x1002 | LF_UDT_SRC_LINE [size = 16]
88CHECK-NEXT:            udt = 0x1008, file = 4097, line = 2
89CHECK-NEXT:   0x1003 | LF_MFUNC_ID [size = 16]
90CHECK-NEXT:            name = Foo, type = 0x1006, class type = 0x1003
91CHECK-NEXT:   0x1004 | LF_STRING_ID [size = 12] ID: <no type>, String: NS
92CHECK-NEXT:   0x1005 | LF_FUNC_ID [size = 20]
93CHECK-NEXT:            name = func, type = 0x100C, parent scope = 0x1004
94