1 //===- DebugSubsectionVisitor.cpp -------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h"
12 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
13 #include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"
14 #include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"
15 #include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h"
16 #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
17 #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
18 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
19 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
20 #include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
21 #include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"
22 #include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h"
23 #include "llvm/Support/BinaryStreamReader.h"
24 #include "llvm/Support/BinaryStreamRef.h"
27 using namespace llvm::codeview
;
29 Error
llvm::codeview::visitDebugSubsection(
30 const DebugSubsectionRecord
&R
, DebugSubsectionVisitor
&V
,
31 const StringsAndChecksumsRef
&State
) {
32 BinaryStreamReader
Reader(R
.getRecordData());
34 case DebugSubsectionKind::Lines
: {
35 DebugLinesSubsectionRef Fragment
;
36 if (auto EC
= Fragment
.initialize(Reader
))
39 return V
.visitLines(Fragment
, State
);
41 case DebugSubsectionKind::FileChecksums
: {
42 DebugChecksumsSubsectionRef Fragment
;
43 if (auto EC
= Fragment
.initialize(Reader
))
46 return V
.visitFileChecksums(Fragment
, State
);
48 case DebugSubsectionKind::InlineeLines
: {
49 DebugInlineeLinesSubsectionRef Fragment
;
50 if (auto EC
= Fragment
.initialize(Reader
))
52 return V
.visitInlineeLines(Fragment
, State
);
54 case DebugSubsectionKind::CrossScopeExports
: {
55 DebugCrossModuleExportsSubsectionRef Section
;
56 if (auto EC
= Section
.initialize(Reader
))
58 return V
.visitCrossModuleExports(Section
, State
);
60 case DebugSubsectionKind::CrossScopeImports
: {
61 DebugCrossModuleImportsSubsectionRef Section
;
62 if (auto EC
= Section
.initialize(Reader
))
64 return V
.visitCrossModuleImports(Section
, State
);
66 case DebugSubsectionKind::Symbols
: {
67 DebugSymbolsSubsectionRef Section
;
68 if (auto EC
= Section
.initialize(Reader
))
70 return V
.visitSymbols(Section
, State
);
72 case DebugSubsectionKind::StringTable
: {
73 DebugStringTableSubsectionRef Section
;
74 if (auto EC
= Section
.initialize(Reader
))
76 return V
.visitStringTable(Section
, State
);
78 case DebugSubsectionKind::FrameData
: {
79 DebugFrameDataSubsectionRef Section
;
80 if (auto EC
= Section
.initialize(Reader
))
82 return V
.visitFrameData(Section
, State
);
84 case DebugSubsectionKind::CoffSymbolRVA
: {
85 DebugSymbolRVASubsectionRef Section
;
86 if (auto EC
= Section
.initialize(Reader
))
88 return V
.visitCOFFSymbolRVAs(Section
, State
);
91 DebugUnknownSubsectionRef
Fragment(R
.kind(), R
.getRecordData());
92 return V
.visitUnknown(Fragment
);