1 //===- MCSymbolCOFF.h -  ----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCSYMBOLCOFF_H
10 #define LLVM_MC_MCSYMBOLCOFF_H
11 
12 #include "llvm/MC/MCSymbol.h"
13 
14 namespace llvm {
15 class MCSymbolCOFF : public MCSymbol {
16 
17   /// This corresponds to the e_type field of the COFF symbol.
18   mutable uint16_t Type;
19 
20   enum SymbolFlags : uint16_t {
21     SF_ClassMask = 0x00FF,
22     SF_ClassShift = 0,
23 
24     SF_WeakExternal = 0x0100,
25     SF_SafeSEH = 0x0200,
26   };
27 
28 public:
MCSymbolCOFF(const StringMapEntry<bool> * Name,bool isTemporary)29   MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
30       : MCSymbol(SymbolKindCOFF, Name, isTemporary), Type(0) {}
31 
getType()32   uint16_t getType() const {
33     return Type;
34   }
setType(uint16_t Ty)35   void setType(uint16_t Ty) const {
36     Type = Ty;
37   }
38 
getClass()39   uint16_t getClass() const {
40     return (getFlags() & SF_ClassMask) >> SF_ClassShift;
41   }
setClass(uint16_t StorageClass)42   void setClass(uint16_t StorageClass) const {
43     modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
44   }
45 
isWeakExternal()46   bool isWeakExternal() const {
47     return getFlags() & SF_WeakExternal;
48   }
setIsWeakExternal()49   void setIsWeakExternal() const {
50     modifyFlags(SF_WeakExternal, SF_WeakExternal);
51   }
52 
isSafeSEH()53   bool isSafeSEH() const {
54     return getFlags() & SF_SafeSEH;
55   }
setIsSafeSEH()56   void setIsSafeSEH() const {
57     modifyFlags(SF_SafeSEH, SF_SafeSEH);
58   }
59 
classof(const MCSymbol * S)60   static bool classof(const MCSymbol *S) { return S->isCOFF(); }
61 };
62 }
63 
64 #endif
65