Line data Source code
1 : //===- ModuleDebugFragmentVisitor.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 :
13 : #include "llvm/Support/Error.h"
14 : #include <cstdint>
15 :
16 : namespace llvm {
17 :
18 : namespace codeview {
19 :
20 : class ModuleDebugFileChecksumFragmentRef;
21 : class ModuleDebugFragmentRecord;
22 : class ModuleDebugInlineeLineFragmentRef;
23 : class ModuleDebugLineFragmentRef;
24 : class ModuleDebugUnknownFragmentRef;
25 :
26 : class ModuleDebugFragmentVisitor {
27 : public:
28 : virtual ~ModuleDebugFragmentVisitor() = default;
29 :
30 0 : virtual Error visitUnknown(ModuleDebugUnknownFragmentRef &Unknown) {
31 0 : return Error::success();
32 : }
33 0 : virtual Error visitLines(ModuleDebugLineFragmentRef &Lines) {
34 0 : return Error::success();
35 : }
36 :
37 : virtual Error
38 0 : visitFileChecksums(ModuleDebugFileChecksumFragmentRef &Checksums) {
39 0 : return Error::success();
40 : }
41 :
42 0 : virtual Error visitInlineeLines(ModuleDebugInlineeLineFragmentRef &Inlinees) {
43 0 : return Error::success();
44 : }
45 :
46 0 : virtual Error finished() { return Error::success(); }
47 : };
48 :
49 : Error visitModuleDebugFragment(const ModuleDebugFragmentRecord &R,
50 : ModuleDebugFragmentVisitor &V);
51 :
52 : template <typename T>
53 6 : Error visitModuleDebugFragments(T &&FragmentRange,
54 : ModuleDebugFragmentVisitor &V) {
55 33 : for (const auto &L : FragmentRange) {
56 27 : if (auto EC = visitModuleDebugFragment(L, V))
57 0 : return EC;
58 : }
59 18 : if (auto EC = V.finished())
60 0 : return EC;
61 18 : return Error::success();
62 : }
63 :
64 : } // end namespace codeview
65 :
66 : } // end namespace llvm
67 :
68 : #endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
|