[InstCombine] Signed saturation patterns
[llvm-core.git] / include / llvm / DebugInfo / CodeView / SymbolVisitorCallbackPipeline.h
blob145d63a6fe61e1cb0bba76fe447da1c3d1db3424
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
10 #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
12 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
13 #include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
14 #include "llvm/Support/Error.h"
15 #include <vector>
17 namespace llvm {
18 namespace codeview {
20 class SymbolVisitorCallbackPipeline : public SymbolVisitorCallbacks {
21 public:
22 SymbolVisitorCallbackPipeline() = default;
24 Error visitUnknownSymbol(CVSymbol &Record) override {
25 for (auto Visitor : Pipeline) {
26 if (auto EC = Visitor->visitUnknownSymbol(Record))
27 return EC;
29 return Error::success();
32 Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
33 for (auto Visitor : Pipeline) {
34 if (auto EC = Visitor->visitSymbolBegin(Record, Offset))
35 return EC;
37 return Error::success();
40 Error visitSymbolBegin(CVSymbol &Record) override {
41 for (auto Visitor : Pipeline) {
42 if (auto EC = Visitor->visitSymbolBegin(Record))
43 return EC;
45 return Error::success();
48 Error visitSymbolEnd(CVSymbol &Record) override {
49 for (auto Visitor : Pipeline) {
50 if (auto EC = Visitor->visitSymbolEnd(Record))
51 return EC;
53 return Error::success();
56 void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks) {
57 Pipeline.push_back(&Callbacks);
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(); \
68 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
69 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
71 private:
72 std::vector<SymbolVisitorCallbacks *> Pipeline;
75 } // end namespace codeview
76 } // end namespace llvm
78 #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H