LLVM  16.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 
13 #include "llvm/Support/Error.h"
14 
15 namespace llvm {
16 
17 namespace codeview {
18 
19 class DebugChecksumsSubsectionRef;
20 class DebugSubsectionRecord;
21 class DebugInlineeLinesSubsectionRef;
22 class DebugCrossModuleExportsSubsectionRef;
23 class DebugCrossModuleImportsSubsectionRef;
24 class DebugFrameDataSubsectionRef;
25 class DebugLinesSubsectionRef;
26 class DebugStringTableSubsectionRef;
27 class DebugSymbolRVASubsectionRef;
28 class DebugSymbolsSubsectionRef;
29 class DebugUnknownSubsectionRef;
30 
32 public:
33  virtual ~DebugSubsectionVisitor() = default;
34 
36  return Error::success();
37  }
39  const StringsAndChecksumsRef &State) = 0;
41  const StringsAndChecksumsRef &State) = 0;
43  const StringsAndChecksumsRef &State) = 0;
44  virtual Error
46  const StringsAndChecksumsRef &State) = 0;
47  virtual Error
49  const StringsAndChecksumsRef &State) = 0;
50 
52  const StringsAndChecksumsRef &State) = 0;
53 
55  const StringsAndChecksumsRef &State) = 0;
56 
58  const StringsAndChecksumsRef &State) = 0;
60  const StringsAndChecksumsRef &State) = 0;
61 };
62 
63 Error visitDebugSubsection(const DebugSubsectionRecord &R,
64  DebugSubsectionVisitor &V,
65  const StringsAndChecksumsRef &State);
66 
67 namespace detail {
68 template <typename T>
70  StringsAndChecksumsRef &State) {
71  State.initialize(std::forward<T>(FragmentRange));
72 
73  for (const DebugSubsectionRecord &L : FragmentRange) {
74  if (auto EC = visitDebugSubsection(L, V, State))
75  return EC;
76  }
77  return Error::success();
78 }
79 } // namespace detail
80 
81 template <typename T>
84  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
85  State);
86 }
87 
88 template <typename T>
90  const DebugStringTableSubsectionRef &Strings) {
91  StringsAndChecksumsRef State(Strings);
92  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
93  State);
94 }
95 
96 template <typename T>
98  const DebugStringTableSubsectionRef &Strings,
99  const DebugChecksumsSubsectionRef &Checksums) {
100  StringsAndChecksumsRef State(Strings, Checksums);
101  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
102  State);
103 }
104 
105 } // end namespace codeview
106 
107 } // end namespace llvm
108 
109 #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONVISITOR_H
llvm::codeview::DebugUnknownSubsectionRef
Definition: DebugUnknownSubsection.h:18
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::codeview::DebugSubsectionVisitor::visitUnknown
virtual Error visitUnknown(DebugUnknownSubsectionRef &Unknown)
Definition: DebugSubsectionVisitor.h:35
llvm::codeview::StringsAndChecksumsRef::initialize
void initialize(T &&FragmentRange)
Definition: StringsAndChecksums.h:42
llvm::codeview::DebugSubsectionVisitor::visitLines
virtual Error visitLines(DebugLinesSubsectionRef &Lines, const StringsAndChecksumsRef &State)=0
llvm::codeview::DebugFrameDataSubsectionRef
Definition: DebugFrameDataSubsection.h:24
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:329
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:82
llvm::codeview::DebugSubsectionVisitor::visitCrossModuleImports
virtual Error visitCrossModuleImports(DebugCrossModuleImportsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0
llvm::codeview::StringsAndChecksumsRef
Definition: StringsAndChecksums.h:23
CSE
separate const offset from Split GEPs to a variadic base and a constant offset for better CSE
Definition: SeparateConstOffsetFromGEP.cpp:495
llvm::codeview::DebugSubsectionVisitor::visitInlineeLines
virtual Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees, const StringsAndChecksumsRef &State)=0
llvm::codeview::DebugCrossModuleExportsSubsectionRef
Definition: DebugCrossExSubsection.h:25
llvm::codeview::DebugSymbolRVASubsectionRef
Definition: DebugSymbolRVASubsection.h:26
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::codeview::detail::visitDebugSubsections
Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V, StringsAndChecksumsRef &State)
Definition: DebugSubsectionVisitor.h:69
llvm::codeview::DebugLinesSubsectionRef
Definition: DebugLinesSubsection.h:79
llvm::codeview::DebugCrossModuleImportsSubsectionRef
Definition: DebugCrossImpSubsection.h:48
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:29
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:155
StringsAndChecksums.h
llvm::codeview::DebugInlineeLinesSubsectionRef
Definition: DebugInlineeLinesSubsection.h:60
llvm::codeview::DebugSubsectionVisitor::visitSymbols
virtual Error visitSymbols(DebugSymbolsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0
llvm::codeview::DebugSubsectionVisitor
Definition: DebugSubsectionVisitor.h:31
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:51