LLVM  14.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 
17 namespace llvm {
18 namespace codeview {
19 
21 public:
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 
71 private:
72  std::vector<SymbolVisitorCallbacks *> Pipeline;
73 };
74 
75 } // end namespace codeview
76 } // end namespace llvm
77 
78 #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
SymbolRecord.h
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
Error.h
llvm::codeview::SymbolVisitorCallbackPipeline::visitSymbolEnd
Error visitSymbolEnd(CVSymbol &Record) override
Definition: SymbolVisitorCallbackPipeline.h:48
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
SymbolVisitorCallbacks.h
llvm::codeview::SymbolVisitorCallbacks
Definition: SymbolVisitorCallbacks.h:18
llvm::codeview::CompileSym2Flags::EC
@ EC
llvm::codeview::SymbolVisitorCallbackPipeline::addCallbackToPipeline
void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks)
Definition: SymbolVisitorCallbackPipeline.h:56
llvm::Record
Definition: Record.h:1472
llvm::codeview::SymbolVisitorCallbackPipeline::visitSymbolBegin
Error visitSymbolBegin(CVSymbol &Record) override
Definition: SymbolVisitorCallbackPipeline.h:40
llvm::codeview::CVRecord
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
Definition: CVRecord.h:30
uint32_t
llvm::codeview::SymbolVisitorCallbackPipeline::SymbolVisitorCallbackPipeline
SymbolVisitorCallbackPipeline()=default
llvm::codeview::SymbolVisitorCallbackPipeline::visitSymbolBegin
Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override
Paired begin/end actions for all symbols.
Definition: SymbolVisitorCallbackPipeline.h:32
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::codeview::SymbolVisitorCallbackPipeline
Definition: SymbolVisitorCallbackPipeline.h:20
llvm::codeview::SymbolVisitorCallbackPipeline::visitUnknownSymbol
Error visitUnknownSymbol(CVSymbol &Record) override
Action to take on unknown symbols. By default, they are ignored.
Definition: SymbolVisitorCallbackPipeline.h:24