MCSymbolCOFF.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #include "llvm/MC/MCSymbol.h"
  12. namespace llvm {
  13. class MCSymbolCOFF : public MCSymbol {
  14. /// This corresponds to the e_type field of the COFF symbol.
  15. mutable uint16_t Type;
  16. enum SymbolFlags : uint16_t {
  17. SF_ClassMask = 0x00FF,
  18. SF_ClassShift = 0,
  19. SF_WeakExternal = 0x0100,
  20. SF_SafeSEH = 0x0200,
  21. };
  22. public:
  23. MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
  24. : MCSymbol(SymbolKindCOFF, Name, isTemporary), Type(0) {}
  25. uint16_t getType() const {
  26. return Type;
  27. }
  28. void setType(uint16_t Ty) const {
  29. Type = Ty;
  30. }
  31. uint16_t getClass() const {
  32. return (getFlags() & SF_ClassMask) >> SF_ClassShift;
  33. }
  34. void setClass(uint16_t StorageClass) const {
  35. modifyFlags(StorageClass << SF_ClassShift, SF_ClassMask);
  36. }
  37. bool isWeakExternal() const {
  38. return getFlags() & SF_WeakExternal;
  39. }
  40. void setIsWeakExternal() const {
  41. modifyFlags(SF_WeakExternal, SF_WeakExternal);
  42. }
  43. bool isSafeSEH() const {
  44. return getFlags() & SF_SafeSEH;
  45. }
  46. void setIsSafeSEH() const {
  47. modifyFlags(SF_SafeSEH, SF_SafeSEH);
  48. }
  49. static bool classof(const MCSymbol *S) { return S->isCOFF(); }
  50. };
  51. }
  52. #endif