1 //===- SymbolRecordHelpers.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_SYMBOLRECORDHELPERS_H 11 #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORDHELPERS_H 12 13 #include "llvm/DebugInfo/CodeView/SymbolRecord.h" 14 15 namespace llvm { 16 namespace codeview { 17 /// Return true if this symbol opens a scope. This implies that the symbol has 18 /// "parent" and "end" fields, which contain the offset of the S_END or 19 /// S_INLINESITE_END record. symbolOpensScope(SymbolKind Kind)20inline bool symbolOpensScope(SymbolKind Kind) { 21 switch (Kind) { 22 case SymbolKind::S_GPROC32: 23 case SymbolKind::S_LPROC32: 24 case SymbolKind::S_LPROC32_ID: 25 case SymbolKind::S_GPROC32_ID: 26 case SymbolKind::S_BLOCK32: 27 case SymbolKind::S_SEPCODE: 28 case SymbolKind::S_THUNK32: 29 case SymbolKind::S_INLINESITE: 30 case SymbolKind::S_INLINESITE2: 31 return true; 32 default: 33 break; 34 } 35 return false; 36 } 37 38 /// Return true if this ssymbol ends a scope. symbolEndsScope(SymbolKind Kind)39inline bool symbolEndsScope(SymbolKind Kind) { 40 switch (Kind) { 41 case SymbolKind::S_END: 42 case SymbolKind::S_PROC_ID_END: 43 case SymbolKind::S_INLINESITE_END: 44 return true; 45 default: 46 break; 47 } 48 return false; 49 } 50 51 /// Given a symbol P for which symbolOpensScope(P) == true, return the 52 /// corresponding end offset. 53 uint32_t getScopeEndOffset(const CVSymbol &Symbol); 54 uint32_t getScopeParentOffset(const CVSymbol &Symbol); 55 56 CVSymbolArray limitSymbolArrayToScope(const CVSymbolArray &Symbols, 57 uint32_t ScopeBegin); 58 59 } // namespace codeview 60 } // namespace llvm 61 62 #endif 63