1 //===- MCSymbolXCOFF.h - ----------------------------------------*- C++ -*-===//
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
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"
19 class MCSymbolXCOFF
: public MCSymbol
{
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.");
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.");
45 MCSectionXCOFF
*getContainingCsect() const {
46 assert(ContainingCsect
&&
47 "Trying to get containing csect but none was set.");
48 return ContainingCsect
;
52 Optional
<XCOFF::StorageClass
> StorageClass
;
53 MCSectionXCOFF
*ContainingCsect
= nullptr;
56 } // end namespace llvm
58 #endif // LLVM_MC_MCSYMBOLXCOFF_H