LLVM  10.0.0svn
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_MODULEDEBUGFRAGMENTVISITOR_H
10 #define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
11 
15 #include "llvm/Support/Error.h"
16 #include <cstdint>
17 
18 namespace llvm {
19 
20 namespace codeview {
21 
22 class DebugChecksumsSubsectionRef;
23 class DebugSubsectionRecord;
24 class DebugInlineeLinesSubsectionRef;
25 class DebugCrossModuleExportsSubsectionRef;
26 class DebugCrossModuleImportsSubsectionRef;
27 class DebugFrameDataSubsectionRef;
28 class DebugLinesSubsectionRef;
29 class DebugStringTableSubsectionRef;
30 class DebugSymbolRVASubsectionRef;
31 class DebugSymbolsSubsectionRef;
32 class DebugUnknownSubsectionRef;
33 class StringsAndChecksumsRef;
34 
36 public:
37  virtual ~DebugSubsectionVisitor() = default;
38 
40  return Error::success();
41  }
43  const StringsAndChecksumsRef &State) = 0;
45  const StringsAndChecksumsRef &State) = 0;
47  const StringsAndChecksumsRef &State) = 0;
48  virtual Error
50  const StringsAndChecksumsRef &State) = 0;
51  virtual Error
53  const StringsAndChecksumsRef &State) = 0;
54 
56  const StringsAndChecksumsRef &State) = 0;
57 
59  const StringsAndChecksumsRef &State) = 0;
60 
62  const StringsAndChecksumsRef &State) = 0;
64  const StringsAndChecksumsRef &State) = 0;
65 };
66 
69  const StringsAndChecksumsRef &State);
70 
71 namespace detail {
72 template <typename T>
74  StringsAndChecksumsRef &State) {
75  State.initialize(std::forward<T>(FragmentRange));
76 
77  for (const DebugSubsectionRecord &L : FragmentRange) {
78  if (auto EC = visitDebugSubsection(L, V, State))
79  return EC;
80  }
81  return Error::success();
82 }
83 } // namespace detail
84 
85 template <typename T>
88  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
89  State);
90 }
91 
92 template <typename T>
94  const DebugStringTableSubsectionRef &Strings) {
95  StringsAndChecksumsRef State(Strings);
96  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
97  State);
98 }
99 
100 template <typename T>
102  const DebugStringTableSubsectionRef &Strings,
103  const DebugChecksumsSubsectionRef &Checksums) {
104  StringsAndChecksumsRef State(Strings, Checksums);
105  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
106  State);
107 }
108 
109 } // end namespace codeview
110 
111 } // end namespace llvm
112 
113 #endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
virtual Error visitUnknown(DebugUnknownSubsectionRef &Unknown)
virtual Error visitCOFFSymbolRVAs(DebugSymbolRVASubsectionRef &RVAs, const StringsAndChecksumsRef &State)=0
This class represents lattice values for constants.
Definition: AllocatorList.h:23
virtual Error visitCrossModuleImports(DebugCrossModuleImportsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0
Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V)
virtual Error visitFileChecksums(DebugChecksumsSubsectionRef &Checksums, const StringsAndChecksumsRef &State)=0
separate const offset from Split GEPs to a variadic base and a constant offset for better CSE
virtual Error visitFrameData(DebugFrameDataSubsectionRef &FD, const StringsAndChecksumsRef &State)=0
Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V, StringsAndChecksumsRef &State)
static ErrorSuccess success()
Create a success value.
Definition: Error.h:326
virtual Error visitStringTable(DebugStringTableSubsectionRef &ST, const StringsAndChecksumsRef &State)=0
virtual Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees, const StringsAndChecksumsRef &State)=0
Error visitDebugSubsection(const DebugSubsectionRecord &R, DebugSubsectionVisitor &V, const StringsAndChecksumsRef &State)
virtual Error visitCrossModuleExports(DebugCrossModuleExportsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0
Represents a read-only view of a CodeView string table.
virtual Error visitLines(DebugLinesSubsectionRef &Lines, const StringsAndChecksumsRef &State)=0
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
virtual Error visitSymbols(DebugSymbolsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0