LLVM  6.0.0svn
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, Offset))
36  return EC;
37  }
38  return Error::success();
39  }
40 
42  for (auto Visitor : Pipeline) {
43  if (auto EC = Visitor->visitSymbolBegin(Record))
44  return EC;
45  }
46  return Error::success();
47  }
48 
50  for (auto Visitor : Pipeline) {
51  if (auto EC = Visitor->visitSymbolEnd(Record))
52  return EC;
53  }
54  return Error::success();
55  }
56 
58  Pipeline.push_back(&Callbacks);
59  }
60 
61 #define SYMBOL_RECORD(EnumName, EnumVal, Name) \
62  Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
63  for (auto Visitor : Pipeline) { \
64  if (auto EC = Visitor->visitKnownRecord(CVR, Record)) \
65  return EC; \
66  } \
67  return Error::success(); \
68  }
69 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
70 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
71 
72 private:
73  std::vector<SymbolVisitorCallbacks *> Pipeline;
74 };
75 
76 } // end namespace codeview
77 } // end namespace llvm
78 
79 #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
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.
Definition: Error.h:313
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override
Paired begin/end actions for all symbols.