LLVM  6.0.0svn
DebugSubsectionVisitor.h
Go to the documentation of this file.
1 //===- DebugSubsectionVisitor.h -----------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
11 #define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
12 
16 #include "llvm/Support/Error.h"
17 #include <cstdint>
18 
19 namespace llvm {
20 
21 namespace codeview {
22 
23 class DebugChecksumsSubsectionRef;
24 class DebugSubsectionRecord;
25 class DebugInlineeLinesSubsectionRef;
26 class DebugCrossModuleExportsSubsectionRef;
27 class DebugCrossModuleImportsSubsectionRef;
28 class DebugFrameDataSubsectionRef;
29 class DebugLinesSubsectionRef;
30 class DebugStringTableSubsectionRef;
31 class DebugSymbolRVASubsectionRef;
32 class DebugSymbolsSubsectionRef;
33 class DebugUnknownSubsectionRef;
34 class StringsAndChecksumsRef;
35 
37 public:
38  virtual ~DebugSubsectionVisitor() = default;
39 
41  return Error::success();
42  }
44  const StringsAndChecksumsRef &State) = 0;
46  const StringsAndChecksumsRef &State) = 0;
48  const StringsAndChecksumsRef &State) = 0;
49  virtual Error
51  const StringsAndChecksumsRef &State) = 0;
52  virtual Error
54  const StringsAndChecksumsRef &State) = 0;
55 
57  const StringsAndChecksumsRef &State) = 0;
58 
60  const StringsAndChecksumsRef &State) = 0;
61 
63  const StringsAndChecksumsRef &State) = 0;
65  const StringsAndChecksumsRef &State) = 0;
66 };
67 
70  const StringsAndChecksumsRef &State);
71 
72 namespace detail {
73 template <typename T>
75  StringsAndChecksumsRef &State) {
76  State.initialize(std::forward<T>(FragmentRange));
77 
78  for (const DebugSubsectionRecord &L : FragmentRange) {
79  if (auto EC = visitDebugSubsection(L, V, State))
80  return EC;
81  }
82  return Error::success();
83 }
84 } // namespace detail
85 
86 template <typename T>
89  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
90  State);
91 }
92 
93 template <typename T>
95  const DebugStringTableSubsectionRef &Strings) {
96  StringsAndChecksumsRef State(Strings);
97  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
98  State);
99 }
100 
101 template <typename T>
103  const DebugStringTableSubsectionRef &Strings,
104  const DebugChecksumsSubsectionRef &Checksums) {
105  StringsAndChecksumsRef State(Strings, Checksums);
106  return detail::visitDebugSubsections(std::forward<T>(FragmentRange), V,
107  State);
108 }
109 
110 } // end namespace codeview
111 
112 } // end namespace llvm
113 
114 #endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
virtual Error visitUnknown(DebugUnknownSubsectionRef &Unknown)
virtual Error visitCOFFSymbolRVAs(DebugSymbolRVASubsectionRef &RVAs, const StringsAndChecksumsRef &State)=0
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
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:313
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:156
virtual Error visitSymbols(DebugSymbolsSubsectionRef &CSE, const StringsAndChecksumsRef &State)=0