/src/llvm-project/llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===- DebugSubsectionVisitor.cpp -------------------------------*- C++ -*-===// |
2 | | // |
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 |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | |
9 | | #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h" |
10 | | |
11 | | #include "llvm/DebugInfo/CodeView/CodeView.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/SwapByteOrder.h" |
25 | | |
26 | | using namespace llvm; |
27 | | using namespace llvm::codeview; |
28 | | |
29 | | Error llvm::codeview::visitDebugSubsection( |
30 | | const DebugSubsectionRecord &R, DebugSubsectionVisitor &V, |
31 | 0 | const StringsAndChecksumsRef &State) { |
32 | 0 | BinaryStreamReader Reader(R.getRecordData()); |
33 | 0 | switch (R.kind()) { |
34 | 0 | case DebugSubsectionKind::Lines: { |
35 | 0 | DebugLinesSubsectionRef Fragment; |
36 | 0 | if (auto EC = Fragment.initialize(Reader)) |
37 | 0 | return EC; |
38 | | |
39 | 0 | return V.visitLines(Fragment, State); |
40 | 0 | } |
41 | 0 | case DebugSubsectionKind::FileChecksums: { |
42 | 0 | DebugChecksumsSubsectionRef Fragment; |
43 | 0 | if (auto EC = Fragment.initialize(Reader)) |
44 | 0 | return EC; |
45 | | |
46 | 0 | return V.visitFileChecksums(Fragment, State); |
47 | 0 | } |
48 | 0 | case DebugSubsectionKind::InlineeLines: { |
49 | 0 | DebugInlineeLinesSubsectionRef Fragment; |
50 | 0 | if (auto EC = Fragment.initialize(Reader)) |
51 | 0 | return EC; |
52 | 0 | return V.visitInlineeLines(Fragment, State); |
53 | 0 | } |
54 | 0 | case DebugSubsectionKind::CrossScopeExports: { |
55 | 0 | DebugCrossModuleExportsSubsectionRef Section; |
56 | 0 | if (auto EC = Section.initialize(Reader)) |
57 | 0 | return EC; |
58 | 0 | return V.visitCrossModuleExports(Section, State); |
59 | 0 | } |
60 | 0 | case DebugSubsectionKind::CrossScopeImports: { |
61 | 0 | DebugCrossModuleImportsSubsectionRef Section; |
62 | 0 | if (auto EC = Section.initialize(Reader)) |
63 | 0 | return EC; |
64 | 0 | return V.visitCrossModuleImports(Section, State); |
65 | 0 | } |
66 | 0 | case DebugSubsectionKind::Symbols: { |
67 | 0 | DebugSymbolsSubsectionRef Section; |
68 | 0 | if (auto EC = Section.initialize(Reader)) |
69 | 0 | return EC; |
70 | 0 | return V.visitSymbols(Section, State); |
71 | 0 | } |
72 | 0 | case DebugSubsectionKind::StringTable: { |
73 | 0 | DebugStringTableSubsectionRef Section; |
74 | 0 | if (auto EC = Section.initialize(Reader)) |
75 | 0 | return EC; |
76 | 0 | return V.visitStringTable(Section, State); |
77 | 0 | } |
78 | 0 | case DebugSubsectionKind::FrameData: { |
79 | 0 | DebugFrameDataSubsectionRef Section; |
80 | 0 | if (auto EC = Section.initialize(Reader)) |
81 | 0 | return EC; |
82 | 0 | return V.visitFrameData(Section, State); |
83 | 0 | } |
84 | 0 | case DebugSubsectionKind::CoffSymbolRVA: { |
85 | 0 | DebugSymbolRVASubsectionRef Section; |
86 | 0 | if (auto EC = Section.initialize(Reader)) |
87 | 0 | return EC; |
88 | 0 | return V.visitCOFFSymbolRVAs(Section, State); |
89 | 0 | } |
90 | 0 | default: { |
91 | 0 | DebugUnknownSubsectionRef Fragment(R.kind(), R.getRecordData()); |
92 | 0 | return V.visitUnknown(Fragment); |
93 | 0 | } |
94 | 0 | } |
95 | 0 | } |