LLVM  4.0.0
SymbolVisitorCallbackPipeline.h
Go to the documentation of this file.
1 //===- SymbolVisitorCallbackPipeline.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_SYMBOLVISITORCALLBACKPIPELINE_H
11 #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
12 
15 #include "llvm/Support/Error.h"
16 #include <vector>
17 
18 namespace llvm {
19 namespace codeview {
20 
22 public:
24 
26  for (auto Visitor : Pipeline) {
27  if (auto EC = Visitor->visitUnknownSymbol(Record))
28  return EC;
29  }
30  return Error::success();
31  }
32 
34  for (auto Visitor : Pipeline) {
35  if (auto EC = Visitor->visitSymbolBegin(Record))
36  return EC;
37  }
38  return Error::success();
39  }
40 
42  for (auto Visitor : Pipeline) {
43  if (auto EC = Visitor->visitSymbolEnd(Record))
44  return EC;
45  }
46  return Error::success();
47  }
48 
50  Pipeline.push_back(&Callbacks);
51  }
52 
53 #define SYMBOL_RECORD(EnumName, EnumVal, Name) \
54  Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
55  for (auto Visitor : Pipeline) { \
56  if (auto EC = Visitor->visitKnownRecord(CVR, Record)) \
57  return EC; \
58  } \
59  return Error::success(); \
60  }
61 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
62 #include "llvm/DebugInfo/CodeView/CVSymbolTypes.def"
63 
64 private:
65  std::vector<SymbolVisitorCallbacks *> Pipeline;
66 };
67 
68 } // end namespace codeview
69 } // end namespace llvm
70 
71 #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
Error visitUnknownSymbol(CVSymbol &Record) override
Action to take on unknown symbols. By default, they are ignored.
void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks)
static ErrorSuccess success()
Create a success value.
Error visitSymbolBegin(CVSymbol &Record) override
Paired begin/end actions for all symbols.
Lightweight error class with error context and mandatory checking.