LLVM  4.0.0
MCSymbolCOFF.h
Go to the documentation of this file.
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:
30  : MCSymbol(SymbolKindCOFF, Name, isTemporary), Type(0) {}
31 
32  uint16_t getType() const {
33  return Type;
34  }
35  void setType(uint16_t Ty) const {
36  Type = Ty;
37  }
38 
39  uint16_t getClass() const {
40  return (getFlags() & SF_ClassMask) >> SF_ClassShift;
41  }
42  void setClass(uint16_t StorageClass) const {
43  modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
44  }
45 
46  bool isWeakExternal() const {
47  return getFlags() & SF_WeakExternal;
48  }
49  void setIsWeakExternal() const {
50  modifyFlags(SF_WeakExternal, SF_WeakExternal);
51  }
52 
53  bool isSafeSEH() const {
54  return getFlags() & SF_SafeSEH;
55  }
56  void setIsSafeSEH() const {
57  modifyFlags(SF_SafeSEH, SF_SafeSEH);
58  }
59 
60  static bool classof(const MCSymbol *S) { return S->isCOFF(); }
61 };
62 }
63 
64 #endif
void setType(uint16_t Ty) const
Definition: MCSymbolCOFF.h:35
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
MCSymbolCOFF(const StringMapEntry< bool > *Name, bool isTemporary)
Definition: MCSymbolCOFF.h:29
COFF::SymbolStorageClass StorageClass
Definition: COFFYAML.cpp:296
void setClass(uint16_t StorageClass) const
Definition: MCSymbolCOFF.h:42
bool isSafeSEH() const
Definition: MCSymbolCOFF.h:53
bool isWeakExternal() const
Definition: MCSymbolCOFF.h:46
uint32_t getFlags() const
Get the (implementation defined) symbol flags.
Definition: MCSymbol.h:400
void setIsWeakExternal() const
Definition: MCSymbolCOFF.h:49
uint16_t getClass() const
Definition: MCSymbolCOFF.h:39
void modifyFlags(uint32_t Value, uint32_t Mask) const
Modify the flags via a mask.
Definition: MCSymbol.h:409
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
static bool classof(const MCSymbol *S)
Definition: MCSymbolCOFF.h:60
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:216
void setIsSafeSEH() const
Definition: MCSymbolCOFF.h:56
uint16_t getType() const
Definition: MCSymbolCOFF.h:32
bool isCOFF() const
Definition: MCSymbol.h:280