1 //===- MCSymbolCOFF.h - ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_MC_MCSYMBOLCOFF_H
11 #define LLVM_MC_MCSYMBOLCOFF_H
13 #include "llvm/MC/MCSymbol.h"
18 class MCSymbolCOFF : public MCSymbol {
19 /// This corresponds to the e_type field of the COFF symbol.
20 mutable uint16_t Type = 0;
22 enum SymbolFlags : uint16_t {
23 SF_ClassMask = 0x00FF,
26 SF_WeakExternal = 0x0100,
31 MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
32 : MCSymbol(SymbolKindCOFF, Name, isTemporary) {}
34 uint16_t getType() const {
37 void setType(uint16_t Ty) const {
41 uint16_t getClass() const {
42 return (getFlags() & SF_ClassMask) >> SF_ClassShift;
44 void setClass(uint16_t StorageClass) const {
45 modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
48 bool isWeakExternal() const {
49 return getFlags() & SF_WeakExternal;
51 void setIsWeakExternal() const {
52 modifyFlags(SF_WeakExternal, SF_WeakExternal);
55 bool isSafeSEH() const {
56 return getFlags() & SF_SafeSEH;
58 void setIsSafeSEH() const {
59 modifyFlags(SF_SafeSEH, SF_SafeSEH);
62 static bool classof(const MCSymbol *S) { return S->isCOFF(); }
65 } // end namespace llvm
67 #endif // LLVM_MC_MCSYMBOLCOFF_H