SymbolVisitorCallbacks.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- SymbolVisitorCallbacks.h ---------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKS_H
  14. #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKS_H
  15. #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
  16. #include "llvm/Support/Error.h"
  17. namespace llvm {
  18. namespace codeview {
  19. class SymbolVisitorCallbacks {
  20. friend class CVSymbolVisitor;
  21. public:
  22. virtual ~SymbolVisitorCallbacks() = default;
  23. /// Action to take on unknown symbols. By default, they are ignored.
  24. virtual Error visitUnknownSymbol(CVSymbol &Record) {
  25. return Error::success();
  26. }
  27. /// Paired begin/end actions for all symbols. Receives all record data,
  28. /// including the fixed-length record prefix. visitSymbolBegin() should
  29. /// return the type of the Symbol, or an error if it cannot be determined.
  30. virtual Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) {
  31. return Error::success();
  32. }
  33. virtual Error visitSymbolBegin(CVSymbol &Record) { return Error::success(); }
  34. virtual Error visitSymbolEnd(CVSymbol &Record) { return Error::success(); }
  35. #define SYMBOL_RECORD(EnumName, EnumVal, Name) \
  36. virtual Error visitKnownRecord(CVSymbol &CVR, Name &Record) { \
  37. return Error::success(); \
  38. }
  39. #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
  40. #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
  41. };
  42. } // end namespace codeview
  43. } // end namespace llvm
  44. #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKS_H
  45. #ifdef __GNUC__
  46. #pragma GCC diagnostic pop
  47. #endif