SymbolVisitorCallbacks.h 1.8 KB

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