1 //===- SymbolVisitorCallbackPipeline.h --------------------------*- C++ -*-===//
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
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"
20 class SymbolVisitorCallbackPipeline
: public SymbolVisitorCallbacks
{
22 SymbolVisitorCallbackPipeline() = default;
24 Error
visitUnknownSymbol(CVSymbol
&Record
) override
{
25 for (auto Visitor
: Pipeline
) {
26 if (auto EC
= Visitor
->visitUnknownSymbol(Record
))
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
))
37 return Error::success();
40 Error
visitSymbolBegin(CVSymbol
&Record
) override
{
41 for (auto Visitor
: Pipeline
) {
42 if (auto EC
= Visitor
->visitSymbolBegin(Record
))
45 return Error::success();
48 Error
visitSymbolEnd(CVSymbol
&Record
) override
{
49 for (auto Visitor
: Pipeline
) {
50 if (auto EC
= Visitor
->visitSymbolEnd(Record
))
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)) \
66 return Error::success(); \
68 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
69 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
72 std::vector
<SymbolVisitorCallbacks
*> Pipeline
;
75 } // end namespace codeview
76 } // end namespace llvm
78 #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H