Repository: llvm/llvm-project
File: llvm/lib/MC/MCAsmInfoGOFF.cpp (C++)

Code before:
      break;
    case GOFF::ESD_BSC_Library:
      OS << "LIBRARY";
      break;
    case GOFF::ESD_BSC_ImportExport:
      OS << "EXPORT";
      break;
    default:
      break;
    }
    OS << ')';
  }
  OS << '\n';
}

void MCAsmInfoGOFF::printSwitchToSection(const MCSection &Section,
                                         uint32_t Subsection, const Triple &T,
                                         raw_ostream &OS) const {
  auto &Sec =
      const_cast<MCSectionGOFF &>(static_cast<const MCSectionGOFF &>(Section));
  switch (Sec.SymbolType) {
  case GOFF::ESD_ST_SectionDefinition: {
    OS << Sec.getName() << " CSECT\n";
    Sec.Emitted = true;
    if (Sec.hasExternalName())
      OS << Sec.getName() << " ALIAS \"" << Sec.getExternalName() << "\"\n";
    break;
  }
  case GOFF::ESD_ST_ElementDefinition: {
    printSwitchToSection(*Sec.getParent(), Subsection, T, OS);
    if (!Sec.Emitted) {
      emitCATTR(OS, Sec.getName(), Sec.EDAttributes.Rmode,
                Sec.EDAttributes.Alignment, Sec.EDAttributes.LoadBehavior,
                GOFF::ESD_EXE_Unspecified, Sec.EDAttributes.IsReadOnly, 0,
                Sec.EDAttributes.FillByteValue, StringRef());
      Sec.Emitted = true;
      if (Sec.hasExternalName())
        OS << Sec.getName() << " ALIAS \"" << Sec.getExternalName() << "\"\n";
    } else
      OS << Sec.getName() << " CATTR\n";
    break;
  }
  case GOFF::ESD_ST_PartReference: {
    MCSectionGOFF *ED = Sec.getParent();
    printSwitchToSection(*ED->getParent(), Subsection, T, OS);
    if (!Sec.Emitted) {
      emitCATTR(OS, ED->getName(), ED->getEDAttributes().Rmode,
                ED->EDAttributes.Alignment, ED->EDAttributes.LoadBehavior,
                Sec.PRAttributes.Executable, ED->EDAttributes.IsReadOnly,
                Sec.PRAttributes.SortKey, ED->EDAttributes.FillByteValue,
                Sec.getName());

Review comment (suggestion):
The syntax of ALIAS is slightly different, see https://www.ibm.com/docs/en/hla-and-tf/1.6.0?topic=statements-alias-instruction:


```suggestion
      OS << Sec.getName() << " ALIAS "C'" << Sec.getExternalName() << "'\n";
```

Code after:
      break;
    case GOFF::ESD_BSC_Library:
      OS << "LIBRARY";
      break;
    case GOFF::ESD_BSC_ImportExport:
      OS << "EXPORT";
      break;
    default:
      break;
    }
    OS << ')';
  }
  OS << '\n';
}

void MCAsmInfoGOFF::printSwitchToSection(const MCSection &Section,
                                         uint32_t Subsection, const Triple &T,
                                         raw_ostream &OS) const {
  auto &Sec =
      const_cast<MCSectionGOFF &>(static_cast<const MCSectionGOFF &>(Section));
  auto EmitExternalName = [&Sec, &OS]() {
    if (Sec.hasExternalName())
      OS << Sec.getName() << " ALIAS C'" << Sec.getExternalName() << "'\n";
  };
  switch (Sec.SymbolType) {
  case GOFF::ESD_ST_SectionDefinition: {
    OS << Sec.getName() << " CSECT\n";
    Sec.Emitted = true;
    EmitExternalName();
    break;
  }
  case GOFF::ESD_ST_ElementDefinition: {
    printSwitchToSection(*Sec.getParent(), Subsection, T, OS);
    if (!Sec.Emitted) {
      emitCATTR(OS, Sec.getName(), Sec.EDAttributes.Rmode,
                Sec.EDAttributes.Alignment, Sec.EDAttributes.LoadBehavior,
                GOFF::ESD_EXE_Unspecified, Sec.EDAttributes.IsReadOnly, 0,
                Sec.EDAttributes.FillByteValue, StringRef());
      Sec.Emitted = true;
      EmitExternalName();
    } else
      OS << Sec.getName() << " CATTR\n";
    break;
  }
  case GOFF::ESD_ST_PartReference: {
    MCSectionGOFF *ED = Sec.getParent();
    printSwitchToSection(*ED->getParent(), Subsection, T, OS);
    if (!Sec.Emitted) {
      emitCATTR(OS, ED->getName(), ED->getEDAttributes().Rmode,
                ED->EDAttributes.Alignment, ED->EDAttributes.LoadBehavior,
                Sec.PRAttributes.Executable, ED->EDAttributes.IsReadOnly,