xref: /llvm-project/llvm/test/DebugInfo/COFF/types-method-ref-qualifiers.ll (revision 10b03e66629aedad79a804e22d23b575077303b3)
1; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
2; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
3
4; RUN: llc --try-experimental-debuginfo-iterators < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
5; RUN: llc --try-experimental-debuginfo-iterators < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
6
7; C++ source to regenerate:
8; struct A {
9;   int NoRefQual();
10;
11;   int RefQual() &;
12;   int RefQual() &&;
13;
14;   int LValueRef() &;
15;
16;   int RValueRef() &&;
17; };
18;
19; void foo() {
20;   A *GenericPtr = nullptr;
21;   A a;
22; }
23
24
25; ModuleID = 'foo.cpp'
26source_filename = "foo.cpp"
27target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
28target triple = "x86_64-pc-windows-msvc19.15.26732"
29
30%struct.A = type { i8 }
31
32; Function Attrs: noinline nounwind optnone uwtable
33define dso_local void @"?foo@@YAXXZ"() #0 !dbg !10 {
34entry:
35  %GenericPtr = alloca ptr, align 8
36  %a = alloca %struct.A, align 1
37  call void @llvm.dbg.declare(metadata ptr %GenericPtr, metadata !13, metadata !DIExpression()), !dbg !28
38  store ptr null, ptr %GenericPtr, align 8, !dbg !28
39  call void @llvm.dbg.declare(metadata ptr %a, metadata !29, metadata !DIExpression()), !dbg !30
40  ret void, !dbg !31
41}
42
43; Function Attrs: nounwind readnone speculatable
44declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
45
46attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "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"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
47attributes #1 = { nounwind readnone speculatable }
48
49!llvm.dbg.cu = !{!0}
50!llvm.linker.options = !{!3, !4}
51!llvm.module.flags = !{!5, !6, !7, !8}
52!llvm.ident = !{!9}
53
54!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
55!1 = !DIFile(filename: "foo.cpp", directory: "D:\5C\5Csrc\5C\5Cllvmbuild\5C\5Cninja-x64", checksumkind: CSK_MD5, checksum: "d1b6ae9dc9ab85ca0a41c8b8c79a0b6a")
56!2 = !{}
57!3 = !{!"/DEFAULTLIB:libcmt.lib"}
58!4 = !{!"/DEFAULTLIB:oldnames.lib"}
59!5 = !{i32 2, !"CodeView", i32 1}
60!6 = !{i32 2, !"Debug Info Version", i32 3}
61!7 = !{i32 1, !"wchar_size", i32 2}
62!8 = !{i32 7, !"PIC Level", i32 2}
63!9 = !{!"clang version 8.0.0 "}
64!10 = distinct !DISubprogram(name: "foo", linkageName: "?foo@@YAXXZ", scope: !1, file: !1, line: 12, type: !11, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
65!11 = !DISubroutineType(types: !12)
66!12 = !{null}
67!13 = !DILocalVariable(name: "GenericPtr", scope: !10, file: !1, line: 13, type: !14)
68!14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !15, size: 64)
69!15 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !16, identifier: ".?AUA@@")
70!16 = !{!17, !22, !24, !26, !27}
71!17 = !DISubprogram(name: "NoRefQual", linkageName: "?NoRefQual@A@@QEAAHXZ", scope: !15, file: !1, line: 2, type: !18, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)
72!18 = !DISubroutineType(types: !19)
73!19 = !{!20, !21}
74!20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
75!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !15, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
76!22 = !DISubprogram(name: "RefQual", linkageName: "?RefQual@A@@QEGAAHXZ", scope: !15, file: !1, line: 4, type: !23, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped | DIFlagLValueReference, isOptimized: false)
77!23 = !DISubroutineType(flags: DIFlagLValueReference, types: !19)
78!24 = !DISubprogram(name: "RefQual", linkageName: "?RefQual@A@@QEHAAHXZ", scope: !15, file: !1, line: 5, type: !25, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped | DIFlagRValueReference, isOptimized: false)
79!25 = !DISubroutineType(flags: DIFlagRValueReference, types: !19)
80!26 = !DISubprogram(name: "LValueRef", linkageName: "?LValueRef@A@@QEGAAHXZ", scope: !15, file: !1, line: 7, type: !23, isLocal: false, isDefinition: false, scopeLine: 7, flags: DIFlagPrototyped | DIFlagLValueReference, isOptimized: false)
81!27 = !DISubprogram(name: "RValueRef", linkageName: "?RValueRef@A@@QEHAAHXZ", scope: !15, file: !1, line: 9, type: !25, isLocal: false, isDefinition: false, scopeLine: 9, flags: DIFlagPrototyped | DIFlagRValueReference, isOptimized: false)
82!28 = !DILocation(line: 13, scope: !10)
83!29 = !DILocalVariable(name: "a", scope: !10, file: !1, line: 14, type: !15)
84!30 = !DILocation(line: 14, scope: !10)
85!31 = !DILocation(line: 15, scope: !10)
86
87
88
89
90; CHECK: CodeViewTypes [
91; CHECK:   Section: .debug$T (7)
92; CHECK:   Magic: 0x4
93; CHECK:   Pointer (0x1005) {
94; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
95; CHECK:     PointeeType: A (0x1003)
96; CHECK:     PtrType: Near64 (0xC)
97; CHECK:     PtrMode: Pointer (0x0)
98; CHECK:     IsFlat: 0
99; CHECK:     IsConst: 1
100; CHECK:     IsVolatile: 0
101; CHECK:     IsUnaligned: 0
102; CHECK:     IsRestrict: 0
103; CHECK:     IsThisPtr&: 0
104; CHECK:     IsThisPtr&&: 0
105; CHECK:     SizeOf: 8
106; CHECK:   }
107; CHECK:   MemberFunction (0x1006) {
108; CHECK:     TypeLeafKind: LF_MFUNCTION (0x1009)
109; CHECK:     ReturnType: int (0x74)
110; CHECK:     ClassType: A (0x1003)
111; CHECK:     ThisType: A* const (0x1005)
112; CHECK:     CallingConvention: NearC (0x0)
113; CHECK:     FunctionOptions [ (0x0)
114; CHECK:     ]
115; CHECK:     NumParameters: 0
116; CHECK:     ArgListType: () (0x1000)
117; CHECK:     ThisAdjustment: 0
118; CHECK:   }
119; CHECK:   Pointer (0x1007) {
120; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
121; CHECK:     PointeeType: A (0x1003)
122; CHECK:     PtrType: Near64 (0xC)
123; CHECK:     PtrMode: Pointer (0x0)
124; CHECK:     IsFlat: 0
125; CHECK:     IsConst: 1
126; CHECK:     IsVolatile: 0
127; CHECK:     IsUnaligned: 0
128; CHECK:     IsRestrict: 0
129; CHECK:     IsThisPtr&: 1
130; CHECK:     IsThisPtr&&: 0
131; CHECK:     SizeOf: 136
132; CHECK:   }
133; CHECK:   MemberFunction (0x1008) {
134; CHECK:     TypeLeafKind: LF_MFUNCTION (0x1009)
135; CHECK:     ReturnType: int (0x74)
136; CHECK:     ClassType: A (0x1003)
137; CHECK:     ThisType: A* const (0x1007)
138; CHECK:     CallingConvention: NearC (0x0)
139; CHECK:     FunctionOptions [ (0x0)
140; CHECK:     ]
141; CHECK:     NumParameters: 0
142; CHECK:     ArgListType: () (0x1000)
143; CHECK:     ThisAdjustment: 0
144; CHECK:   }
145; CHECK:   Pointer (0x1009) {
146; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
147; CHECK:     PointeeType: A (0x1003)
148; CHECK:     PtrType: Near64 (0xC)
149; CHECK:     PtrMode: Pointer (0x0)
150; CHECK:     IsFlat: 0
151; CHECK:     IsConst: 1
152; CHECK:     IsVolatile: 0
153; CHECK:     IsUnaligned: 0
154; CHECK:     IsRestrict: 0
155; CHECK:     IsThisPtr&: 0
156; CHECK:     IsThisPtr&&: 1
157; CHECK:     SizeOf: 8
158; CHECK:   }
159; CHECK:   MemberFunction (0x100A) {
160; CHECK:     TypeLeafKind: LF_MFUNCTION (0x1009)
161; CHECK:     ReturnType: int (0x74)
162; CHECK:     ClassType: A (0x1003)
163; CHECK:     ThisType: A* const (0x1009)
164; CHECK:     CallingConvention: NearC (0x0)
165; CHECK:     FunctionOptions [ (0x0)
166; CHECK:     ]
167; CHECK:     NumParameters: 0
168; CHECK:     ArgListType: () (0x1000)
169; CHECK:     ThisAdjustment: 0
170; CHECK:   }
171; CHECK:   MethodOverloadList (0x100B) {
172; CHECK:     TypeLeafKind: LF_METHODLIST (0x1206)
173; CHECK:     Method [
174; CHECK:       AccessSpecifier: Public (0x3)
175; CHECK:       Type: int A::() (0x1008)
176; CHECK:     ]
177; CHECK:     Method [
178; CHECK:       AccessSpecifier: Public (0x3)
179; CHECK:       Type: int A::() (0x100A)
180; CHECK:     ]
181; CHECK:   }
182; CHECK:   FieldList (0x100C) {
183; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
184; CHECK:     OneMethod {
185; CHECK:       TypeLeafKind: LF_ONEMETHOD (0x1511)
186; CHECK:       AccessSpecifier: Public (0x3)
187; CHECK:       Type: int A::() (0x1006)
188; CHECK:       Name: NoRefQual
189; CHECK:     }
190; CHECK:     OverloadedMethod {
191; CHECK:       TypeLeafKind: LF_METHOD (0x150F)
192; CHECK:       MethodCount: 0x2
193; CHECK:       MethodListIndex: 0x100B
194; CHECK:       Name: RefQual
195; CHECK:     }
196; CHECK:     OneMethod {
197; CHECK:       TypeLeafKind: LF_ONEMETHOD (0x1511)
198; CHECK:       AccessSpecifier: Public (0x3)
199; CHECK:       Type: int A::() (0x1008)
200; CHECK:       Name: LValueRef
201; CHECK:     }
202; CHECK:     OneMethod {
203; CHECK:       TypeLeafKind: LF_ONEMETHOD (0x1511)
204; CHECK:       AccessSpecifier: Public (0x3)
205; CHECK:       Type: int A::() (0x100A)
206; CHECK:       Name: RValueRef
207; CHECK:     }
208; CHECK:   }
209; CHECK: ]
210