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