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 assert(getSymbolTableName().equals(RepresentedCsect->getSymbolTableName()) && 21 "SymbolTableNames need to be the same for this symbol and its csect " 22 "representation."); 23 return RepresentedCsect; 24 } 25 26 void MCSymbolXCOFF::setRepresentedCsect(MCSectionXCOFF *C) { 27 assert(C && "Assigned csect should not be null."); 28 assert((!RepresentedCsect || RepresentedCsect == C) && 29 "Trying to set a csect that doesn't match the one that" 30 "this symbol is already mapped to."); 31 assert((!getName().equals(getUnqualifiedName()) || 32 C->getCSectType() == XCOFF::XTY_ER) && 33 "Symbol does not represent a csect; can only set a MCSectionXCOFF " 34 "representation for a csect."); 35 assert(getSymbolTableName().equals(C->getSymbolTableName()) && 36 "SymbolTableNames need to be the same for this symbol and its csect " 37 "representation."); 38 RepresentedCsect = C; 39 } 40