xref: /aosp_15_r20/external/llvm/lib/DebugInfo/CodeView/ModuleSubstreamVisitor.cpp (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===- ModuleSubstreamVisitor.cpp -------------------------------*- C++ -*-===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker 
10*9880d681SAndroid Build Coastguard Worker #include "llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h"
11*9880d681SAndroid Build Coastguard Worker 
12*9880d681SAndroid Build Coastguard Worker using namespace llvm;
13*9880d681SAndroid Build Coastguard Worker using namespace llvm::codeview;
14*9880d681SAndroid Build Coastguard Worker 
visitSymbols(StreamRef Data)15*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitSymbols(StreamRef Data) {
16*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::Symbols, Data);
17*9880d681SAndroid Build Coastguard Worker }
visitLines(StreamRef Data,const LineSubstreamHeader * Header,const LineInfoArray & Lines)18*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitLines(StreamRef Data,
19*9880d681SAndroid Build Coastguard Worker                                           const LineSubstreamHeader *Header,
20*9880d681SAndroid Build Coastguard Worker                                           const LineInfoArray &Lines) {
21*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::Lines, Data);
22*9880d681SAndroid Build Coastguard Worker }
visitStringTable(StreamRef Data)23*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitStringTable(StreamRef Data) {
24*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::StringTable, Data);
25*9880d681SAndroid Build Coastguard Worker }
visitFileChecksums(StreamRef Data,const FileChecksumArray & Checksums)26*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitFileChecksums(
27*9880d681SAndroid Build Coastguard Worker     StreamRef Data, const FileChecksumArray &Checksums) {
28*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::FileChecksums, Data);
29*9880d681SAndroid Build Coastguard Worker }
visitFrameData(StreamRef Data)30*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitFrameData(StreamRef Data) {
31*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::FrameData, Data);
32*9880d681SAndroid Build Coastguard Worker }
visitInlineeLines(StreamRef Data)33*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitInlineeLines(StreamRef Data) {
34*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::InlineeLines, Data);
35*9880d681SAndroid Build Coastguard Worker }
visitCrossScopeImports(StreamRef Data)36*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitCrossScopeImports(StreamRef Data) {
37*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::CrossScopeExports, Data);
38*9880d681SAndroid Build Coastguard Worker }
visitCrossScopeExports(StreamRef Data)39*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitCrossScopeExports(StreamRef Data) {
40*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::CrossScopeImports, Data);
41*9880d681SAndroid Build Coastguard Worker }
visitILLines(StreamRef Data)42*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitILLines(StreamRef Data) {
43*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::ILLines, Data);
44*9880d681SAndroid Build Coastguard Worker }
visitFuncMDTokenMap(StreamRef Data)45*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitFuncMDTokenMap(StreamRef Data) {
46*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::FuncMDTokenMap, Data);
47*9880d681SAndroid Build Coastguard Worker }
visitTypeMDTokenMap(StreamRef Data)48*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitTypeMDTokenMap(StreamRef Data) {
49*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::TypeMDTokenMap, Data);
50*9880d681SAndroid Build Coastguard Worker }
visitMergedAssemblyInput(StreamRef Data)51*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitMergedAssemblyInput(StreamRef Data) {
52*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::MergedAssemblyInput, Data);
53*9880d681SAndroid Build Coastguard Worker }
visitCoffSymbolRVA(StreamRef Data)54*9880d681SAndroid Build Coastguard Worker Error IModuleSubstreamVisitor::visitCoffSymbolRVA(StreamRef Data) {
55*9880d681SAndroid Build Coastguard Worker   return visitUnknown(ModuleSubstreamKind::CoffSymbolRVA, Data);
56*9880d681SAndroid Build Coastguard Worker }
57*9880d681SAndroid Build Coastguard Worker 
visitModuleSubstream(const ModuleSubstream & R,IModuleSubstreamVisitor & V)58*9880d681SAndroid Build Coastguard Worker Error llvm::codeview::visitModuleSubstream(const ModuleSubstream &R,
59*9880d681SAndroid Build Coastguard Worker                                            IModuleSubstreamVisitor &V) {
60*9880d681SAndroid Build Coastguard Worker   switch (R.getSubstreamKind()) {
61*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::Symbols:
62*9880d681SAndroid Build Coastguard Worker     return V.visitSymbols(R.getRecordData());
63*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::Lines: {
64*9880d681SAndroid Build Coastguard Worker     StreamReader Reader(R.getRecordData());
65*9880d681SAndroid Build Coastguard Worker     const LineSubstreamHeader *Header;
66*9880d681SAndroid Build Coastguard Worker     if (auto EC = Reader.readObject(Header))
67*9880d681SAndroid Build Coastguard Worker       return EC;
68*9880d681SAndroid Build Coastguard Worker     VarStreamArrayExtractor<LineColumnEntry> E(Header);
69*9880d681SAndroid Build Coastguard Worker     LineInfoArray LineInfos(E);
70*9880d681SAndroid Build Coastguard Worker     if (auto EC = Reader.readArray(LineInfos, Reader.bytesRemaining()))
71*9880d681SAndroid Build Coastguard Worker       return EC;
72*9880d681SAndroid Build Coastguard Worker     return V.visitLines(R.getRecordData(), Header, LineInfos);
73*9880d681SAndroid Build Coastguard Worker   }
74*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::StringTable:
75*9880d681SAndroid Build Coastguard Worker     return V.visitStringTable(R.getRecordData());
76*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::FileChecksums: {
77*9880d681SAndroid Build Coastguard Worker     StreamReader Reader(R.getRecordData());
78*9880d681SAndroid Build Coastguard Worker     FileChecksumArray Checksums;
79*9880d681SAndroid Build Coastguard Worker     if (auto EC = Reader.readArray(Checksums, Reader.bytesRemaining()))
80*9880d681SAndroid Build Coastguard Worker       return EC;
81*9880d681SAndroid Build Coastguard Worker     return V.visitFileChecksums(R.getRecordData(), Checksums);
82*9880d681SAndroid Build Coastguard Worker   }
83*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::FrameData:
84*9880d681SAndroid Build Coastguard Worker     return V.visitFrameData(R.getRecordData());
85*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::InlineeLines:
86*9880d681SAndroid Build Coastguard Worker     return V.visitInlineeLines(R.getRecordData());
87*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::CrossScopeImports:
88*9880d681SAndroid Build Coastguard Worker     return V.visitCrossScopeImports(R.getRecordData());
89*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::CrossScopeExports:
90*9880d681SAndroid Build Coastguard Worker     return V.visitCrossScopeExports(R.getRecordData());
91*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::ILLines:
92*9880d681SAndroid Build Coastguard Worker     return V.visitILLines(R.getRecordData());
93*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::FuncMDTokenMap:
94*9880d681SAndroid Build Coastguard Worker     return V.visitFuncMDTokenMap(R.getRecordData());
95*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::TypeMDTokenMap:
96*9880d681SAndroid Build Coastguard Worker     return V.visitTypeMDTokenMap(R.getRecordData());
97*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::MergedAssemblyInput:
98*9880d681SAndroid Build Coastguard Worker     return V.visitMergedAssemblyInput(R.getRecordData());
99*9880d681SAndroid Build Coastguard Worker   case ModuleSubstreamKind::CoffSymbolRVA:
100*9880d681SAndroid Build Coastguard Worker     return V.visitCoffSymbolRVA(R.getRecordData());
101*9880d681SAndroid Build Coastguard Worker   default:
102*9880d681SAndroid Build Coastguard Worker     return V.visitUnknown(R.getSubstreamKind(), R.getRecordData());
103*9880d681SAndroid Build Coastguard Worker   }
104*9880d681SAndroid Build Coastguard Worker }
105