1 //===- DebugSubsectionVisitor.cpp -------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h"
11 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
12 #include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"
13 #include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"
14 #include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h"
15 #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
16 #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
17 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
18 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
19 #include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
20 #include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"
21 #include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h"
22 #include "llvm/Support/BinaryStreamReader.h"
23 #include "llvm/Support/BinaryStreamRef.h"
26 using namespace llvm::codeview
;
28 Error
llvm::codeview::visitDebugSubsection(
29 const DebugSubsectionRecord
&R
, DebugSubsectionVisitor
&V
,
30 const StringsAndChecksumsRef
&State
) {
31 BinaryStreamReader
Reader(R
.getRecordData());
33 case DebugSubsectionKind::Lines
: {
34 DebugLinesSubsectionRef Fragment
;
35 if (auto EC
= Fragment
.initialize(Reader
))
38 return V
.visitLines(Fragment
, State
);
40 case DebugSubsectionKind::FileChecksums
: {
41 DebugChecksumsSubsectionRef Fragment
;
42 if (auto EC
= Fragment
.initialize(Reader
))
45 return V
.visitFileChecksums(Fragment
, State
);
47 case DebugSubsectionKind::InlineeLines
: {
48 DebugInlineeLinesSubsectionRef Fragment
;
49 if (auto EC
= Fragment
.initialize(Reader
))
51 return V
.visitInlineeLines(Fragment
, State
);
53 case DebugSubsectionKind::CrossScopeExports
: {
54 DebugCrossModuleExportsSubsectionRef Section
;
55 if (auto EC
= Section
.initialize(Reader
))
57 return V
.visitCrossModuleExports(Section
, State
);
59 case DebugSubsectionKind::CrossScopeImports
: {
60 DebugCrossModuleImportsSubsectionRef Section
;
61 if (auto EC
= Section
.initialize(Reader
))
63 return V
.visitCrossModuleImports(Section
, State
);
65 case DebugSubsectionKind::Symbols
: {
66 DebugSymbolsSubsectionRef Section
;
67 if (auto EC
= Section
.initialize(Reader
))
69 return V
.visitSymbols(Section
, State
);
71 case DebugSubsectionKind::StringTable
: {
72 DebugStringTableSubsectionRef Section
;
73 if (auto EC
= Section
.initialize(Reader
))
75 return V
.visitStringTable(Section
, State
);
77 case DebugSubsectionKind::FrameData
: {
78 DebugFrameDataSubsectionRef Section
;
79 if (auto EC
= Section
.initialize(Reader
))
81 return V
.visitFrameData(Section
, State
);
83 case DebugSubsectionKind::CoffSymbolRVA
: {
84 DebugSymbolRVASubsectionRef Section
;
85 if (auto EC
= Section
.initialize(Reader
))
87 return V
.visitCOFFSymbolRVAs(Section
, State
);
90 DebugUnknownSubsectionRef
Fragment(R
.kind(), R
.getRecordData());
91 return V
.visitUnknown(Fragment
);