/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/MC/MCSymbolCOFF.h
Line | Count | Source |
1 | | //===- MCSymbolCOFF.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_MC_MCSYMBOLCOFF_H |
10 | | #define LLVM_MC_MCSYMBOLCOFF_H |
11 | | |
12 | | #include "llvm/MC/MCSymbol.h" |
13 | | #include <cstdint> |
14 | | |
15 | | namespace llvm { |
16 | | |
17 | | class MCSymbolCOFF : public MCSymbol { |
18 | | /// This corresponds to the e_type field of the COFF symbol. |
19 | | mutable uint16_t Type = 0; |
20 | | |
21 | | enum SymbolFlags : uint16_t { |
22 | | SF_ClassMask = 0x00FF, |
23 | | SF_ClassShift = 0, |
24 | | |
25 | | SF_WeakExternal = 0x0100, |
26 | | SF_SafeSEH = 0x0200, |
27 | | }; |
28 | | |
29 | | public: |
30 | | MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary) |
31 | 44.0k | : MCSymbol(SymbolKindCOFF, Name, isTemporary) {} |
32 | | |
33 | 6.39k | uint16_t getType() const { |
34 | 6.39k | return Type; |
35 | 6.39k | } |
36 | 678 | void setType(uint16_t Ty) const { |
37 | 678 | Type = Ty; |
38 | 678 | } |
39 | | |
40 | 1.86k | uint16_t getClass() const { |
41 | 1.86k | return (getFlags() & SF_ClassMask) >> SF_ClassShift; |
42 | 1.86k | } |
43 | 674 | void setClass(uint16_t StorageClass) const { |
44 | 674 | modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask); |
45 | 674 | } |
46 | | |
47 | 1.85k | bool isWeakExternal() const { |
48 | 1.85k | return getFlags() & SF_WeakExternal; |
49 | 1.85k | } |
50 | 8 | void setIsWeakExternal() const { |
51 | 8 | modifyFlags(SF_WeakExternal, SF_WeakExternal); |
52 | 8 | } |
53 | | |
54 | 5 | bool isSafeSEH() const { |
55 | 5 | return getFlags() & SF_SafeSEH; |
56 | 5 | } |
57 | 5 | void setIsSafeSEH() const { |
58 | 5 | modifyFlags(SF_SafeSEH, SF_SafeSEH); |
59 | 5 | } |
60 | | |
61 | | static bool classof(const MCSymbol *S) { return S->isCOFF(); } |
62 | | }; |
63 | | |
64 | | } // end namespace llvm |
65 | | |
66 | | #endif // LLVM_MC_MCSYMBOLCOFF_H |