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