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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCSYMBOLCOFF_H
10 #define LLVM_MC_MCSYMBOLCOFF_H
12 #include "llvm/MC/MCSymbol.h"
15 class MCSymbolCOFF : public MCSymbol {
17 /// This corresponds to the e_type field of the COFF symbol.
18 mutable uint16_t Type;
20 enum SymbolFlags : uint16_t {
21 SF_ClassMask = 0x00FF,
24 SF_WeakExternal = 0x0100,
29 MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
30 : MCSymbol(SymbolKindCOFF, Name, isTemporary), Type(0) {}
32 uint16_t getType() const {
35 void setType(uint16_t Ty) const {
39 uint16_t getClass() const {
40 return (getFlags() & SF_ClassMask) >> SF_ClassShift;
42 void setClass(uint16_t StorageClass) const {
43 modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
46 bool isWeakExternal() const {
47 return getFlags() & SF_WeakExternal;
49 void setIsWeakExternal() const {
50 modifyFlags(SF_WeakExternal, SF_WeakExternal);
53 bool isSafeSEH() const {
54 return getFlags() & SF_SafeSEH;
56 void setIsSafeSEH() const {
57 modifyFlags(SF_SafeSEH, SF_SafeSEH);
60 static bool classof(const MCSymbol *S) { return S->isCOFF(); }