[Alignment][NFC] Support compile time constants
[llvm-core.git] / include / llvm / MC / MCSymbolXCOFF.h
blob98ecd24669262f2be8caee23477777adb2926922
1 //===- MCSymbolXCOFF.h - ----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_MC_MCSYMBOLXCOFF_H
9 #define LLVM_MC_MCSYMBOLXCOFF_H
11 #include "llvm/ADT/Optional.h"
12 #include "llvm/BinaryFormat/XCOFF.h"
13 #include "llvm/MC/MCSymbol.h"
15 namespace llvm {
17 class MCSectionXCOFF;
19 class MCSymbolXCOFF : public MCSymbol {
20 public:
21 MCSymbolXCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
22 : MCSymbol(SymbolKindXCOFF, Name, isTemporary) {}
24 static bool classof(const MCSymbol *S) { return S->isXCOFF(); }
26 void setStorageClass(XCOFF::StorageClass SC) {
27 assert((!StorageClass.hasValue() || StorageClass.getValue() == SC) &&
28 "Redefining StorageClass of XCOFF MCSymbol.");
29 StorageClass = SC;
32 XCOFF::StorageClass getStorageClass() const {
33 assert(StorageClass.hasValue() &&
34 "StorageClass not set on XCOFF MCSymbol.");
35 return StorageClass.getValue();
38 void setContainingCsect(MCSectionXCOFF *C) {
39 assert((!ContainingCsect || ContainingCsect == C) &&
40 "Trying to set a containing csect that doesn't match the one that"
41 "this symbol is already mapped to.");
42 ContainingCsect = C;
45 MCSectionXCOFF *getContainingCsect() const {
46 assert(ContainingCsect &&
47 "Trying to get containing csect but none was set.");
48 return ContainingCsect;
51 private:
52 Optional<XCOFF::StorageClass> StorageClass;
53 MCSectionXCOFF *ContainingCsect = nullptr;
56 } // end namespace llvm
58 #endif // LLVM_MC_MCSYMBOLXCOFF_H