1 //===- MCSymbolCOFF.h - ----------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCSYMBOLCOFF_H
10 #define LLVM_MC_MCSYMBOLCOFF_H
12 #include "llvm/MC/MCSymbol.h"
17 class MCSymbolCOFF
: public MCSymbol
{
18 /// This corresponds to the e_type field of the COFF symbol.
19 mutable uint16_t Type
= 0;
21 enum SymbolFlags
: uint16_t {
22 SF_ClassMask
= 0x00FF,
25 SF_WeakExternal
= 0x0100,
30 MCSymbolCOFF(const StringMapEntry
<bool> *Name
, bool isTemporary
)
31 : MCSymbol(SymbolKindCOFF
, Name
, isTemporary
) {}
33 uint16_t getType() const {
36 void setType(uint16_t Ty
) const {
40 uint16_t getClass() const {
41 return (getFlags() & SF_ClassMask
) >> SF_ClassShift
;
43 void setClass(uint16_t StorageClass
) const {
44 modifyFlags(StorageClass
<< SF_ClassShift
, SF_ClassMask
);
47 bool isWeakExternal() const {
48 return getFlags() & SF_WeakExternal
;
50 void setIsWeakExternal() const {
51 modifyFlags(SF_WeakExternal
, SF_WeakExternal
);
54 bool isSafeSEH() const {
55 return getFlags() & SF_SafeSEH
;
57 void setIsSafeSEH() const {
58 modifyFlags(SF_SafeSEH
, SF_SafeSEH
);
61 static bool classof(const MCSymbol
*S
) { return S
->isCOFF(); }
64 } // end namespace llvm
66 #endif // LLVM_MC_MCSYMBOLCOFF_H