LLVM  14.0.0git
DebugSubsectionVisitor.h
Go to the documentation of this file.
1 //===- DebugSubsectionVisitor.h -----------------------------*- 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 #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONVISITOR_H
10 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONVISITOR_H
11 
14 #include "llvm/Support/Error.h"
15 
16 namespace llvm {
17 
18 namespace codeview {
19 
20 class DebugChecksumsSubsectionRef;
21 class DebugSubsectionRecord;
22 class DebugInlineeLinesSubsectionRef;
23 class DebugCrossModuleExportsSubsectionRef;
24 class DebugCrossModuleImportsSubsectionRef;
25 class DebugFrameDataSubsectionRef;
26 class DebugLinesSubsectionRef;
27 class DebugStringTableSubsectionRef;
28 class DebugSymbolRVASubsectionRef;
29 class DebugSymbolsSubsectionRef;
30 class DebugUnknownSubsectionRef;
31 
33 public:
34  virtual ~DebugSubsectionVisitor() = default;
35 
37  return Error::success();
38  }
40  const StringsAndChecksumsRef &State) = 0;
42  const StringsAndChecksumsRef &State) = 0;
44  const StringsAndChecksumsRef &State) = 0;
45  virtual Error
47  const StringsAndChecksumsRef &State) = 0;
48  virtual Error
50  const StringsAndChecksumsRef &State) = 0;
51 
53  const StringsAndChecksumsRef &State) = 0;
54 
56  const StringsAndChecksumsRef &State) = 0;
57 
59  const StringsAndChecksumsRef &State) = 0;
61  const StringsAndChecksumsRef &State) = 0;
62 };
63 
64 Error visitDebugSubsection(const DebugSubsectionRecord &R,
65  DebugSubsectionVisitor &V,
66  const StringsAndChecksumsRef &State);
67 
68 namespace detail {
69 template <typename T>
71  StringsAndChecksumsRef &State) {
72  State.initialize(std::forward<T>(FragmentRange));
73 
74  for (const DebugSubsectionRecord &L : FragmentRange) {
75  if (auto EC = visitDebugSubsection(L, V, State))
76  return EC;
77  }
78  return Error::success();
79 }
80 } // namespace detail
81 
82 template <typename T>
85  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
86  State);
87 }
88 
89 template <typename T>
91  const DebugStringTableSubsectionRef &Strings) {
92  StringsAndChecksumsRef State(Strings);
93  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
94  State);
95 }
96 
97 template <typename T>
99  const DebugStringTableSubsectionRef &Strings,
100  const DebugChecksumsSubsectionRef &Checksums) {
101  StringsAndChecksumsRef State(Strings, Checksums);
102  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
103  State);
104 }
105 
106 } // end namespace codeview
107 
108 } // end namespace llvm
109 
110 #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONVISITOR_H
llvm::codeview::DebugUnknownSubsectionRef
Definition: DebugUnknownSubsection.h:18
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::codeview::DebugSubsectionVisitor::visitUnknown
virtual Error visitUnknown(DebugUnknownSubsectionRef &Unknown)
Definition: DebugSubsectionVisitor.h:36
llvm::codeview::StringsAndChecksumsRef::initialize
void initialize(T &&FragmentRange)
Definition: StringsAndChecksums.h:40
llvm::codeview::DebugSubsectionVisitor::visitLines
virtual Error visitLines(DebugLinesSubsectionRef &Lines, const StringsAndChecksumsRef &State)=0
llvm::codeview::DebugFrameDataSubsectionRef
Definition: DebugFrameDataSubsection.h:20
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
llvm::codeview::DebugSubsectionVisitor::visitCOFFSymbolRVAs
virtual Error visitCOFFSymbolRVAs(DebugSymbolRVASubsectionRef &RVAs, const StringsAndChecksumsRef &State)=0
Error.h
llvm::codeview::visitDebugSubsections
Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V)
Definition: DebugSubsectionVisitor.h:83
llvm::codeview::DebugSubsectionVisitor::visitCrossModuleImports
virtual Error visitCrossModuleImports(DebugCrossModuleImportsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0
llvm::codeview::StringsAndChecksumsRef
Definition: StringsAndChecksums.h:21
CSE
separate const offset from Split GEPs to a variadic base and a constant offset for better CSE
Definition: SeparateConstOffsetFromGEP.cpp:496
llvm::codeview::DebugSubsectionVisitor::visitInlineeLines
virtual Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees, const StringsAndChecksumsRef &State)=0
llvm::codeview::DebugCrossModuleExportsSubsectionRef
Definition: DebugCrossExSubsection.h:24
llvm::codeview::DebugSymbolRVASubsectionRef
Definition: DebugSymbolRVASubsection.h:26
CodeView.h
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::codeview::detail::visitDebugSubsections
Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V, StringsAndChecksumsRef &State)
Definition: DebugSubsectionVisitor.h:70
llvm::codeview::DebugLinesSubsectionRef
Definition: DebugLinesSubsection.h:78
llvm::codeview::DebugCrossModuleImportsSubsectionRef
Definition: DebugCrossImpSubsection.h:47
llvm::codeview::DebugSubsectionRecord
Definition: DebugSubsectionRecord.h:35
llvm::codeview::CompileSym2Flags::EC
@ EC
llvm::codeview::DebugSubsectionVisitor::~DebugSubsectionVisitor
virtual ~DebugSubsectionVisitor()=default
llvm::codeview::DebugSubsectionVisitor::visitStringTable
virtual Error visitStringTable(DebugStringTableSubsectionRef &ST, const StringsAndChecksumsRef &State)=0
llvm::codeview::DebugSubsectionVisitor::visitFileChecksums
virtual Error visitFileChecksums(DebugChecksumsSubsectionRef &Checksums, const StringsAndChecksumsRef &State)=0
llvm::codeview::visitDebugSubsection
Error visitDebugSubsection(const DebugSubsectionRecord &R, DebugSubsectionVisitor &V, const StringsAndChecksumsRef &State)
Definition: DebugSubsectionVisitor.cpp:28
llvm::codeview::DebugSubsectionVisitor::visitFrameData
virtual Error visitFrameData(DebugFrameDataSubsectionRef &FD, const StringsAndChecksumsRef &State)=0
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
StringsAndChecksums.h
llvm::codeview::DebugInlineeLinesSubsectionRef
Definition: DebugInlineeLinesSubsection.h:61
llvm::codeview::DebugSubsectionVisitor::visitSymbols
virtual Error visitSymbols(DebugSymbolsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0
llvm::codeview::DebugSubsectionVisitor
Definition: DebugSubsectionVisitor.h:32
llvm::codeview::DebugStringTableSubsectionRef
Represents a read-only view of a CodeView string table.
Definition: DebugStringTableSubsection.h:31
llvm::codeview::DebugSubsectionVisitor::visitCrossModuleExports
virtual Error visitCrossModuleExports(DebugCrossModuleExportsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0
llvm::codeview::DebugSymbolsSubsectionRef
Definition: DebugSymbolsSubsection.h:18
llvm::codeview::DebugChecksumsSubsectionRef
Definition: DebugChecksumsSubsection.h:49