MCSymbolXCOFF.cpp 1.6 KB

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