1 //===- lib/MC/MCSymbolXCOFF.cpp - XCOFF Code Symbol Representation --------===//
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 
9 #include "llvm/MC/MCSectionXCOFF.h"
10 
11 using namespace llvm;
12 
13 MCSectionXCOFF *MCSymbolXCOFF::getRepresentedCsect() const {
14   assert(RepresentedCsect &&
15          "Trying to get csect representation of this symbol but none was set.");
16   assert((!getName().equals(getUnqualifiedName()) ||
17           RepresentedCsect->getCSectType() == XCOFF::XTY_ER) &&
18          "Symbol does not represent a csect; MCSectionXCOFF that represents "
19          "the symbol should not be (but is) set.");
20   return RepresentedCsect;
21 }
22 
23 void MCSymbolXCOFF::setRepresentedCsect(MCSectionXCOFF *C) {
24   assert(C && "Assigned csect should not be null.");
25   assert((!RepresentedCsect || RepresentedCsect == C) &&
26          "Trying to set a csect that doesn't match the one that"
27          "this symbol is already mapped to.");
28   assert((!getName().equals(getUnqualifiedName()) ||
29           C->getCSectType() == XCOFF::XTY_ER) &&
30          "Symbol does not represent a csect; can only set a MCSectionXCOFF "
31          "representation for a csect.");
32   RepresentedCsect = C;
33 }
34