1//===- SymbolVisitorCallbacks.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_SYMBOLVISITORCALLBACKS_H
11#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKS_H
12
13#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
14#include "llvm/Support/Error.h"
15
16namespace llvm {
17namespace codeview {
18
19class SymbolVisitorCallbacks {
20  friend class CVSymbolVisitor;
21
22public:
23  virtual ~SymbolVisitorCallbacks() = default;
24
25  /// Action to take on unknown symbols. By default, they are ignored.
26  virtual Error visitUnknownSymbol(CVSymbol &Record) {
27    return Error::success();
28  }
29
30  /// Paired begin/end actions for all symbols. Receives all record data,
31  /// including the fixed-length record prefix.  visitSymbolBegin() should
32  /// return the type of the Symbol, or an error if it cannot be determined.
33  virtual Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) {
34    return Error::success();
35  }
36  virtual Error visitSymbolBegin(CVSymbol &Record) { return Error::success(); }
37  virtual Error visitSymbolEnd(CVSymbol &Record) { return Error::success(); }
38
39#define SYMBOL_RECORD(EnumName, EnumVal, Name)                                 \
40  virtual Error visitKnownRecord(CVSymbol &CVR, Name &Record) {                \
41    return Error::success();                                                   \
42  }
43#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
44#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
45};
46
47} // end namespace codeview
48} // end namespace llvm
49
50#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKS_H
51