llvm.org GIT mirror llvm / 790af1a
[codeview] Add support for inlinee lists This adds type index discovery and dumper support for symbol record kind 0x1168, which is a list of inlined function ids. This symbol kind is undocumented, but S_INLINEES is consistent with the existing nomenclature. Fixes PR34222 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316398 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 1 year, 9 months ago
5 changed file(s) with 49 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
183183 CV_SYMBOL(S_GDATA_HLSL32_EX, 0x1164)
184184 CV_SYMBOL(S_LDATA_HLSL32_EX, 0x1165)
185185
186 CV_SYMBOL(S_FASTLINK, 0x1167)
186 CV_SYMBOL(S_FASTLINK, 0x1167) // Undocumented
187 SYMBOL_RECORD_ALIAS(S_INLINEES, 0x1168, InlineesSym, CallerSym) // Undocumented
187188
188189 // Known symbol types
189190 SYMBOL_RECORD(S_END , 0x0006, ScopeEndSym)
233234 SYMBOL_RECORD(S_FRAMECOOKIE , 0x113a, FrameCookieSym)
234235
235236 SYMBOL_RECORD(S_CALLEES , 0x115a, CallerSym)
236 SYMBOL_RECORD_ALIAS(S_CALLERS , 0x115b, CalleeSym, CallerSym)
237 SYMBOL_RECORD_ALIAS(S_CALLERS, 0x115b, CalleeSym, CallerSym)
237238
238239 SYMBOL_RECORD(S_UDT , 0x1108, UDTSym)
239240 SYMBOL_RECORD_ALIAS(S_COBOLUDT , 0x1109, CobolUDT, UDTSym)
403403 break;
404404 case SymbolKind::S_CALLERS:
405405 case SymbolKind::S_CALLEES:
406 case SymbolKind::S_INLINEES:
406407 // The record is a count followed by an array of type indices.
407408 Count = *reinterpret_cast(Content.data());
408409 Refs.push_back({TiRefKind::IndexRef, 4, Count}); // Callees
0 Compile the following like so to reproduce the input:
1 $ cl -c -O2 t.c -Z7
2 void g();
3 static inline void f() { g(); }
4 static inline void h() { g(); }
5 void k() {
6 f();
7 h();
8 }
9
10 RUN: llvm-readobj -codeview %p/Inputs/codeview-inlinees.obj | FileCheck %s
11
12 CHECK: SubSectionType: InlineeLines (0xF6)
13 CHECK: Inlinee: f (0x1003)
14 CHECK: Inlinee: h (0x1004)
15 CHECK-NOT: Inlinee:
16
17 CHECK: GlobalProcIdSym {
18 CHECK: Kind: S_GPROC32_ID (0x1147)
19 CHECK: DisplayName: k
20 CHECK: LinkageName: k
21 CHECK: }
22 CHECK: InlineSiteSym
23 CHECK: Kind: S_INLINESITE (0x114D)
24 CHECK: Inlinee: h (0x1004)
25 CHECK: InlineSiteSym
26 CHECK: Kind: S_INLINESITE (0x114D)
27 CHECK: Inlinee: f (0x1003)
28 CHECK: InlineesSym {
29 CHECK-NEXT: Kind: S_INLINEES (0x1168)
30 CHECK-NEXT: Callers [
31 CHECK-NEXT: FuncID: f (0x1003)
32 CHECK-NEXT: FuncID: h (0x1004)
33 CHECK-NEXT: ]
34 CHECK: }
35 CHECK: ProcEnd {
36 CHECK: Kind: S_PROC_ID_END (0x114F)
37 CHECK: }
559559 Callers.Indices.push_back(TypeIndex(4));
560560 Callers.Indices.push_back(TypeIndex(5));
561561 Callers.Indices.push_back(TypeIndex(6));
562 writeSymbolRecords(Callees, Callers);
562 CallerSym Inlinees(SymbolRecordKind::InlineesSym);
563 Inlinees.Indices.push_back(TypeIndex(7));
564 Inlinees.Indices.push_back(TypeIndex(8));
565 Inlinees.Indices.push_back(TypeIndex(9));
566 writeSymbolRecords(Callees, Callers, Inlinees);
563567 checkTypeReferences(0, TypeIndex(1), TypeIndex(2), TypeIndex(3));
564568 checkTypeReferences(1, TypeIndex(4), TypeIndex(5), TypeIndex(6));
565 }
569 checkTypeReferences(2, TypeIndex(7), TypeIndex(8), TypeIndex(9));
570 }