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