LLVM 19.0.0git
SymbolVisitorCallbackPipeline.h
Go to the documentation of this file.
1//===- SymbolVisitorCallbackPipeline.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_SYMBOLVISITORCALLBACKPIPELINE_H
10#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
11
14#include "llvm/Support/Error.h"
15#include <vector>
16
17namespace llvm {
18namespace codeview {
19
21public:
23
25 for (auto *Visitor : Pipeline) {
26 if (auto EC = Visitor->visitUnknownSymbol(Record))
27 return EC;
28 }
29 return Error::success();
30 }
31
33 for (auto *Visitor : Pipeline) {
34 if (auto EC = Visitor->visitSymbolBegin(Record, Offset))
35 return EC;
36 }
37 return Error::success();
38 }
39
41 for (auto *Visitor : Pipeline) {
42 if (auto EC = Visitor->visitSymbolBegin(Record))
43 return EC;
44 }
45 return Error::success();
46 }
47
49 for (auto *Visitor : Pipeline) {
50 if (auto EC = Visitor->visitSymbolEnd(Record))
51 return EC;
52 }
53 return Error::success();
54 }
55
57 Pipeline.push_back(&Callbacks);
58 }
59
60#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
61 Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
62 for (auto Visitor : Pipeline) { \
63 if (auto EC = Visitor->visitKnownRecord(CVR, Record)) \
64 return EC; \
65 } \
66 return Error::success(); \
67 }
68#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
69#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
70
71private:
72 std::vector<SymbolVisitorCallbacks *> Pipeline;
73};
74
75} // end namespace codeview
76} // end namespace llvm
77
78#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:334
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
Definition: CVRecord.h:29
Error visitUnknownSymbol(CVSymbol &Record) override
Action to take on unknown symbols. By default, they are ignored.
Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override
Paired begin/end actions for all symbols.
void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:456