[MC] De-capitalize SwitchSection. NFC

Add SwitchSection to return switchSection. The API will be removed soon.
This commit is contained in:
Fangrui Song 2022-06-10 22:50:55 -07:00
parent 2e603c67c2
commit adf4142f76
80 changed files with 280 additions and 278 deletions

View File

@ -2067,7 +2067,7 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) {
MCSymbol *ColdStartLabel = LocalCtx->createTempSymbol();
MCSymbol *ColdEndLabel = LocalCtx->createTempSymbol();
Streamer->SwitchSection(Section);
Streamer->switchSection(Section);
Streamer->emitLabel(StartLabel);
emitFunctionBody(*Streamer, BF, /*EmitColdPart=*/false,
/*EmitCodeOnly=*/true);
@ -2079,14 +2079,14 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) {
ELF::SHF_EXECINSTR | ELF::SHF_ALLOC);
ColdSection->setHasInstructions(true);
Streamer->SwitchSection(ColdSection);
Streamer->switchSection(ColdSection);
Streamer->emitLabel(ColdStartLabel);
emitFunctionBody(*Streamer, BF, /*EmitColdPart=*/true,
/*EmitCodeOnly=*/true);
Streamer->emitLabel(ColdEndLabel);
// To avoid calling MCObjectStreamer::flushPendingLabels() which is private
Streamer->emitBytes(StringRef(""));
Streamer->SwitchSection(Section);
Streamer->switchSection(Section);
}
// To avoid calling MCObjectStreamer::flushPendingLabels() which is private or

View File

@ -249,7 +249,7 @@ void BinaryEmitter::emitFunctions() {
// Mark the start of hot text.
if (opts::HotText) {
Streamer.SwitchSection(BC.getTextSection());
Streamer.switchSection(BC.getTextSection());
Streamer.emitLabel(BC.getHotTextStartSymbol());
}
@ -262,7 +262,7 @@ void BinaryEmitter::emitFunctions() {
// Mark the end of hot text.
if (opts::HotText) {
Streamer.SwitchSection(BC.getTextSection());
Streamer.switchSection(BC.getTextSection());
Streamer.emitLabel(BC.getHotTextEndSymbol());
}
}
@ -277,7 +277,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function, bool EmitColdPart) {
MCSection *Section =
BC.getCodeSection(EmitColdPart ? Function.getColdCodeSectionName()
: Function.getCodeSectionName());
Streamer.SwitchSection(Section);
Streamer.switchSection(Section);
Section->setHasInstructions(true);
BC.Ctx->addGenDwarfSection(Section);
@ -771,7 +771,7 @@ void BinaryEmitter::emitJumpTable(const JumpTable &JT, MCSection *HotSection,
}
LabelCounts[CurrentLabel] = CurrentLabelCount;
} else {
Streamer.SwitchSection(JT.Count > 0 ? HotSection : ColdSection);
Streamer.switchSection(JT.Count > 0 ? HotSection : ColdSection);
Streamer.emitValueToAlignment(JT.EntrySize);
}
MCSymbol *LastLabel = nullptr;
@ -788,9 +788,9 @@ void BinaryEmitter::emitJumpTable(const JumpTable &JT, MCSection *HotSection,
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: jump table count: "
<< LabelCounts[LI->second] << '\n');
if (LabelCounts[LI->second] > 0)
Streamer.SwitchSection(HotSection);
Streamer.switchSection(HotSection);
else
Streamer.SwitchSection(ColdSection);
Streamer.switchSection(ColdSection);
Streamer.emitValueToAlignment(JT.EntrySize);
}
Streamer.emitLabel(LI->second);
@ -876,7 +876,7 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, bool EmitColdPart) {
for (const BinaryFunction::CallSite &CallSite : *Sites)
CallSiteTableLength += getULEB128Size(CallSite.Action);
Streamer.SwitchSection(BC.MOFI->getLSDASection());
Streamer.switchSection(BC.MOFI->getLSDASection());
const unsigned TTypeEncoding = BC.TTypeEncoding;
const unsigned TTypeEncodingSize = BC.getDWARFEncodingSize(TTypeEncoding);

View File

@ -71,7 +71,7 @@ void BinarySection::emitAsData(MCStreamer &Streamer, StringRef NewName) const {
MCSectionELF *ELFSection =
BC.Ctx->getELFSection(SectionName, getELFType(), getELFFlags());
Streamer.SwitchSection(ELFSection);
Streamer.switchSection(ELFSection);
Streamer.emitValueToAlignment(getAlignment());
if (BC.HasRelocations && opts::HotData && isReordered())

View File

@ -1609,7 +1609,7 @@ void DwarfLineTable::emit(BinaryContext &BC, MCStreamer &Streamer) {
}
// Switch to the section where the table will be emitted into.
Streamer.SwitchSection(BC.MOFI->getDwarfLineSection());
Streamer.switchSection(BC.MOFI->getDwarfLineSection());
const uint16_t DwarfVersion = BC.Ctx->getDwarfVersion();
// Handle the rest of the Compile Units.

View File

@ -1159,7 +1159,7 @@ updateDebugData(DWARFContext &DWCtx, std::string &Storage,
if (SectionIter == KnownSections.end())
return None;
Streamer.SwitchSection(SectionIter->second.first);
Streamer.switchSection(SectionIter->second.first);
StringRef OutData = SectionContents;
uint32_t DWPOffset = 0;
@ -1294,7 +1294,7 @@ static void extractTypesFromDWPDWARF5(
const DWARFUnitIndex::Entry::SectionContribution *V2) -> bool {
return V1->Offset < V2->Offset;
});
Streamer.SwitchSection(MCOFI.getDwarfInfoDWOSection());
Streamer.switchSection(MCOFI.getDwarfInfoDWOSection());
for (const auto *C : TUContributions)
Streamer.emitBytes(Contents.slice(C->Offset, C->Offset + C->Length));
}

View File

@ -80,7 +80,7 @@ void HugifyRuntimeLibrary::emitBinary(BinaryContext &BC, MCStreamer &Streamer) {
MCSymbol *InitPtr = BC.Ctx->getOrCreateSymbol("__bolt_hugify_init_ptr");
Section->setAlignment(llvm::Align(BC.RegularPageSize));
Streamer.SwitchSection(Section);
Streamer.switchSection(Section);
Streamer.emitLabel(InitPtr);
Streamer.emitSymbolAttribute(InitPtr, MCSymbolAttr::MCSA_Global);

View File

@ -87,7 +87,7 @@ void InstrumentationRuntimeLibrary::emitBinary(BinaryContext &BC,
}
Section->setAlignment(llvm::Align(BC.RegularPageSize));
Streamer.SwitchSection(Section);
Streamer.switchSection(Section);
// EmitOffset is used to determine padding size for data alignment
uint64_t EmitOffset = 0;
@ -185,7 +185,7 @@ void InstrumentationRuntimeLibrary::emitBinary(BinaryContext &BC,
MCSection *TablesSection = BC.Ctx->getMachOSection(
"__BOLT", "__tables", MachO::S_REGULAR, SectionKind::getData());
TablesSection->setAlignment(llvm::Align(BC.RegularPageSize));
Streamer.SwitchSection(TablesSection);
Streamer.switchSection(TablesSection);
emitString("__bolt_instr_tables", buildTables(BC));
}
}

View File

@ -505,7 +505,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
if (Opts.EmbedBitcode && Ctx.getObjectFileType() == MCContext::IsMachO) {
MCSection *AsmLabel = Ctx.getMachOSection(
"__LLVM", "__asm", MachO::S_REGULAR, 4, SectionKind::getReadOnly());
Str.get()->SwitchSection(AsmLabel);
Str.get()->switchSection(AsmLabel);
Str.get()->emitZeros(1);
}

View File

@ -618,7 +618,7 @@ MCStreamer is best thought of as an assembler API. It is an abstract API which
is *implemented* in different ways (e.g. to output a .s file, output an ELF .o
file, etc) but whose API correspond directly to what you see in a .s file.
MCStreamer has one method per directive, such as EmitLabel, EmitSymbolAttribute,
SwitchSection, EmitValue (for .byte, .word), etc, which directly correspond to
switchSection, emitValue (for .byte, .word), etc, which directly correspond to
assembly level directives. It also has an EmitInstruction method, which is used
to output an MCInst to the streamer.
@ -1580,7 +1580,7 @@ labels, directives, and instructions. A key class used at this time is the
MCStreamer class. This is an abstract API that is implemented in different ways
(e.g. to output a .s file, output an ELF .o file, etc) that is effectively an
"assembler API". MCStreamer has one method per directive, such as EmitLabel,
EmitSymbolAttribute, SwitchSection, etc, which directly correspond to assembly
EmitSymbolAttribute, switchSection, etc, which directly correspond to assembly
level directives.
If you are interested in implementing a code generator for a target, there are

View File

@ -940,7 +940,7 @@ a realistic example:
unsigned IntPtrSize = AP.getPointerSize();
// Put this in the data section.
OS.SwitchSection(AP.getObjFileLowering().getDataSection());
OS.switchSection(AP.getObjFileLowering().getDataSection());
// For each function...
for (iterator FI = begin(), FE = end(); FI != FE; ++FI) {

View File

@ -43,7 +43,7 @@ public:
auto Pair = Pool.insert(std::make_pair(Str, Offset));
if (Pair.second) {
Out.SwitchSection(Sec);
Out.switchSection(Sec);
Out.emitBytes(StringRef(Str, Length));
Offset += Length;
}

View File

@ -113,7 +113,7 @@ public:
/// Update streamer for a new active section.
///
/// This is called by popSection and SwitchSection, if the current
/// This is called by popSection and switchSection, if the current
/// section changes.
virtual void changeSection(const MCSection *CurSection, MCSection *Section,
const MCExpr *SubSection, raw_ostream &OS);
@ -403,7 +403,7 @@ public:
/// Update streamer for a new active section.
///
/// This is called by popSection and SwitchSection, if the current
/// This is called by popSection and switchSection, if the current
/// section changes.
virtual void changeSection(MCSection *, const MCExpr *);
@ -436,7 +436,7 @@ public:
if (SectionStack.empty())
return false;
SwitchSection(SectionStack.back().first.first, Subsection);
switchSection(SectionStack.back().first.first, Subsection);
return true;
}
@ -444,8 +444,11 @@ public:
/// is required to update CurSection.
///
/// This corresponds to assembler directives like .section, .text, etc.
virtual void SwitchSection(MCSection *Section,
virtual void switchSection(MCSection *Section,
const MCExpr *Subsection = nullptr);
void SwitchSection(MCSection *Section, const MCExpr *Subsection = nullptr) {
switchSection(Section, Subsection);
}
/// Set the current section where code is being emitted to \p Section.
/// This is required to update CurSection. This version does not call

View File

@ -50,7 +50,7 @@ void AIXException::emitExceptionInfoTable(const MCSymbol *LSDA,
EHInfo = Asm->OutContext.getXCOFFSection(NameStr, EHInfo->getKind(),
EHInfo->getCsectProp());
}
Asm->OutStreamer->SwitchSection(EHInfo);
Asm->OutStreamer->switchSection(EHInfo);
MCSymbol *EHInfoLabel =
TargetLoweringObjectFileXCOFF::getEHInfoTableSymbol(Asm->MF);
Asm->OutStreamer->emitLabel(EHInfoLabel);

View File

@ -562,7 +562,7 @@ void llvm::emitDWARF5AccelTable(
if (CompUnits.empty())
return;
Asm->OutStreamer->SwitchSection(
Asm->OutStreamer->switchSection(
Asm->getObjFileLowering().getDwarfDebugNamesSection());
Contents.finalize(Asm, "names");

View File

@ -44,7 +44,7 @@ void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
return;
// Start the dwarf addr section.
Asm.OutStreamer->SwitchSection(AddrSection);
Asm.OutStreamer->switchSection(AddrSection);
MCSymbol *EndLabel = nullptr;

View File

@ -812,7 +812,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
TheSection = getObjFileLowering().getTLSBSSSection();
OutStreamer->emitTBSSSymbol(TheSection, MangSym, Size, Alignment.value());
} else if (GVKind.isThreadData()) {
OutStreamer->SwitchSection(TheSection);
OutStreamer->switchSection(TheSection);
emitAlignment(Alignment, GV);
OutStreamer->emitLabel(MangSym);
@ -826,7 +826,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
// Emit the variable struct for the runtime.
MCSection *TLVSect = getObjFileLowering().getTLSExtraDataSection();
OutStreamer->SwitchSection(TLVSect);
OutStreamer->switchSection(TLVSect);
// Emit the linkage here.
emitLinkage(GV, GVSym);
OutStreamer->emitLabel(GVSym);
@ -847,7 +847,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
MCSymbol *EmittedInitSym = GVSym;
OutStreamer->SwitchSection(TheSection);
OutStreamer->switchSection(TheSection);
emitLinkage(GV, EmittedInitSym);
emitAlignment(Alignment, GV);
@ -897,7 +897,7 @@ void AsmPrinter::emitFunctionHeader() {
MF->setSection(getObjFileLowering().getUniqueSectionForFunction(F, TM));
else
MF->setSection(getObjFileLowering().SectionForGlobal(&F, TM));
OutStreamer->SwitchSection(MF->getSection());
OutStreamer->switchSection(MF->getSection());
if (!MAI->hasVisibilityOnlyWithLinkage())
emitVisibility(CurrentFnSym, F.getVisibility());
@ -1308,7 +1308,7 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
const MCSymbol *FunctionSymbol = getFunctionBegin();
OutStreamer->pushSection();
OutStreamer->SwitchSection(BBAddrMapSection);
OutStreamer->switchSection(BBAddrMapSection);
OutStreamer->emitSymbolValue(FunctionSymbol, getPointerSize());
// Emit the total number of basic blocks in this function.
OutStreamer->emitULEB128IntValue(MF.size());
@ -1352,7 +1352,7 @@ void AsmPrinter::emitStackSizeSection(const MachineFunction &MF) {
return;
OutStreamer->pushSection();
OutStreamer->SwitchSection(StackSizeSection);
OutStreamer->switchSection(StackSizeSection);
const MCSymbol *FunctionSymbol = getFunctionBegin();
uint64_t StackSize =
@ -1624,7 +1624,7 @@ void AsmPrinter::emitFunctionBody() {
}
// Switch to the original section in case basic block sections was used.
OutStreamer->SwitchSection(MF->getSection());
OutStreamer->switchSection(MF->getSection());
const Function &F = MF->getFunction();
for (const auto &BB : F) {
@ -1895,7 +1895,7 @@ void AsmPrinter::emitRemarksSection(remarks::RemarkStreamer &RS) {
// Switch to the remarks section.
MCSection *RemarksSection =
OutContext.getObjectFileInfo()->getRemarksSection();
OutStreamer->SwitchSection(RemarksSection);
OutStreamer->switchSection(RemarksSection);
OutStreamer->emitBinaryData(OS.str());
}
@ -1966,7 +1966,7 @@ bool AsmPrinter::doFinalization(Module &M) {
// Output stubs for external and common global variables.
MachineModuleInfoELF::SymbolListTy Stubs = MMIELF.GetGVStubList();
if (!Stubs.empty()) {
OutStreamer->SwitchSection(TLOF.getDataSection());
OutStreamer->switchSection(TLOF.getDataSection());
const DataLayout &DL = M.getDataLayout();
emitAlignment(Align(DL.getPointerSize()));
@ -1990,7 +1990,7 @@ bool AsmPrinter::doFinalization(Module &M) {
for (const auto &Stub : Stubs) {
SmallString<256> SectionName = StringRef(".rdata$");
SectionName += Stub.first->getName();
OutStreamer->SwitchSection(OutContext.getCOFFSection(
OutStreamer->switchSection(OutContext.getCOFFSection(
SectionName,
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ |
COFF::IMAGE_SCN_LNK_COMDAT,
@ -2084,11 +2084,11 @@ bool AsmPrinter::doFinalization(Module &M) {
// Emit .note.GNU-split-stack and .note.GNU-no-split-stack sections if
// split-stack is used.
if (TM.getTargetTriple().isOSBinFormatELF() && HasSplitStack) {
OutStreamer->SwitchSection(
OutContext.getELFSection(".note.GNU-split-stack", ELF::SHT_PROGBITS, 0));
OutStreamer->switchSection(OutContext.getELFSection(".note.GNU-split-stack",
ELF::SHT_PROGBITS, 0));
if (HasNoSplitStack)
OutStreamer->SwitchSection(
OutContext.getELFSection(".note.GNU-no-split-stack", ELF::SHT_PROGBITS, 0));
OutStreamer->switchSection(OutContext.getELFSection(
".note.GNU-no-split-stack", ELF::SHT_PROGBITS, 0));
}
// If we don't have any trampolines, then we don't require stack memory
@ -2096,7 +2096,7 @@ bool AsmPrinter::doFinalization(Module &M) {
Function *InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline");
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
if (MCSection *S = MAI->getNonexecutableStackSection(OutContext))
OutStreamer->SwitchSection(S);
OutStreamer->switchSection(S);
if (TM.Options.EmitAddrsig) {
// Emit address-significance attributes for all globals.
@ -2117,7 +2117,7 @@ bool AsmPrinter::doFinalization(Module &M) {
GV.getVisibility() != GlobalValue::DefaultVisibility)
continue;
OutStreamer->SwitchSection(
OutStreamer->switchSection(
OutContext.getELFSection(".llvm_sympart", ELF::SHT_LLVM_SYMPART, 0, 0,
"", false, ++UniqueID, nullptr));
OutStreamer->emitBytes(GV.getPartition());
@ -2268,7 +2268,7 @@ void AsmPrinter::emitConstantPool() {
continue;
if (CurSection != CPSections[i].S) {
OutStreamer->SwitchSection(CPSections[i].S);
OutStreamer->switchSection(CPSections[i].S);
emitAlignment(Align(CPSections[i].Alignment));
CurSection = CPSections[i].S;
Offset = 0;
@ -2311,7 +2311,7 @@ void AsmPrinter::emitJumpTableInfo() {
if (JTInDiffSection) {
// Drop it in the readonly section.
MCSection *ReadOnlySection = TLOF.getSectionForJumpTable(F, TM);
OutStreamer->SwitchSection(ReadOnlySection);
OutStreamer->switchSection(ReadOnlySection);
}
emitAlignment(Align(MJTI->getEntryAlignment(DL)));
@ -2547,7 +2547,7 @@ void AsmPrinter::emitXXStructorList(const DataLayout &DL, const Constant *List,
MCSection *OutputSection =
(IsCtor ? Obj.getStaticCtorSection(S.Priority, KeySym)
: Obj.getStaticDtorSection(S.Priority, KeySym));
OutStreamer->SwitchSection(OutputSection);
OutStreamer->switchSection(OutputSection);
if (OutStreamer->getCurrentSection() != OutStreamer->getPreviousSection())
emitAlignment(Align);
emitXXStructor(DL, S.Func);
@ -2579,7 +2579,7 @@ void AsmPrinter::emitModuleCommandLines(Module &M) {
return;
OutStreamer->pushSection();
OutStreamer->SwitchSection(CommandLine);
OutStreamer->switchSection(CommandLine);
OutStreamer->emitZeros(1);
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
const MDNode *N = NMD->getOperand(i);
@ -3464,7 +3464,7 @@ void AsmPrinter::emitBasicBlockStart(const MachineBasicBlock &MBB) {
// entry block is always placed in the function section and is handled
// separately.
if (MBB.isBeginSection() && !MBB.isEntryBlock()) {
OutStreamer->SwitchSection(
OutStreamer->switchSection(
getObjFileLowering().getSectionForMachineBasicBlock(MF->getFunction(),
MBB, TM));
CurrentSectionBeginSym = MBB.getSymbol();
@ -3719,7 +3719,7 @@ void AsmPrinter::emitXRayTable() {
// range of sleds associated with a function.
auto &Ctx = OutContext;
MCSymbol *SledsStart = OutContext.createTempSymbol("xray_sleds_start", true);
OutStreamer->SwitchSection(InstMap);
OutStreamer->switchSection(InstMap);
OutStreamer->emitLabel(SledsStart);
for (const auto &Sled : Sleds) {
MCSymbol *Dot = Ctx.createTempSymbol();
@ -3746,11 +3746,11 @@ void AsmPrinter::emitXRayTable() {
// Each entry here will be 2 * word size aligned, as we're writing down two
// pointers. This should work for both 32-bit and 64-bit platforms.
if (FnSledIndex) {
OutStreamer->SwitchSection(FnSledIndex);
OutStreamer->switchSection(FnSledIndex);
OutStreamer->emitCodeAlignment(2 * WordSizeBytes, &getSubtargetInfo());
OutStreamer->emitSymbolValue(SledsStart, WordSizeBytes, false);
OutStreamer->emitSymbolValue(SledsEnd, WordSizeBytes, false);
OutStreamer->SwitchSection(PrevSection);
OutStreamer->switchSection(PrevSection);
}
Sleds.clear();
}
@ -3795,7 +3795,7 @@ void AsmPrinter::emitPatchableFunctionEntries() {
}
LinkedToSym = cast<MCSymbolELF>(CurrentFnSym);
}
OutStreamer->SwitchSection(OutContext.getELFSection(
OutStreamer->switchSection(OutContext.getELFSection(
"__patchable_function_entries", ELF::SHT_PROGBITS, Flags, 0, GroupName,
F.hasComdat(), MCSection::NonUniqueID, LinkedToSym));
emitAlignment(Align(PointerSize));

View File

@ -719,7 +719,7 @@ void CodeViewDebug::emitTypeInformation() {
return;
// Start the .debug$T or .debug$P section with 0x4.
OS.SwitchSection(Asm->getObjFileLowering().getCOFFDebugTypesSection());
OS.switchSection(Asm->getObjFileLowering().getCOFFDebugTypesSection());
emitCodeViewMagicVersion();
TypeTableCollection Table(TypeTable.records());
@ -752,7 +752,7 @@ void CodeViewDebug::emitTypeGlobalHashes() {
// Start the .debug$H section with the version and hash algorithm, currently
// hardcoded to version 0, SHA1.
OS.SwitchSection(Asm->getObjFileLowering().getCOFFGlobalTypeHashesSection());
OS.switchSection(Asm->getObjFileLowering().getCOFFGlobalTypeHashesSection());
OS.emitValueToAlignment(4);
OS.AddComment("Magic");
@ -1044,7 +1044,7 @@ void CodeViewDebug::switchToDebugSectionForSymbol(const MCSymbol *GVSym) {
Asm->getObjFileLowering().getCOFFDebugSymbolsSection());
DebugSec = OS.getContext().getAssociativeCOFFSection(DebugSec, KeySym);
OS.SwitchSection(DebugSec);
OS.switchSection(DebugSec);
// Emit the magic version number if this is the first time we've switched to
// this section.

View File

@ -164,7 +164,7 @@ DIEAbbrev &DIEAbbrevSet::uniqueAbbreviation(DIE &Die) {
void DIEAbbrevSet::Emit(const AsmPrinter *AP, MCSection *Section) const {
if (!Abbreviations.empty()) {
// Start the debug abbrev section.
AP->OutStreamer->SwitchSection(Section);
AP->OutStreamer->switchSection(Section);
AP->emitDwarfAbbrevs(Abbreviations);
}
}

View File

@ -2312,7 +2312,7 @@ void DwarfDebug::emitStringOffsetsTableHeader() {
template <typename AccelTableT>
void DwarfDebug::emitAccel(AccelTableT &Accel, MCSection *Section,
StringRef TableName) {
Asm->OutStreamer->SwitchSection(Section);
Asm->OutStreamer->switchSection(Section);
// Emit the full data.
emitAppleAccelTable(Asm, Accel, TableName, Section->getBeginSymbol());
@ -2431,12 +2431,12 @@ void DwarfDebug::emitDebugPubSections() {
bool GnuStyle = TheU->getCUNode()->getNameTableKind() ==
DICompileUnit::DebugNameTableKind::GNU;
Asm->OutStreamer->SwitchSection(
Asm->OutStreamer->switchSection(
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
: Asm->getObjFileLowering().getDwarfPubNamesSection());
emitDebugPubSection(GnuStyle, "Names", TheU, TheU->getGlobalNames());
Asm->OutStreamer->SwitchSection(
Asm->OutStreamer->switchSection(
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
: Asm->getObjFileLowering().getDwarfPubTypesSection());
emitDebugPubSection(GnuStyle, "Types", TheU, TheU->getGlobalTypes());
@ -2846,7 +2846,7 @@ void DwarfDebug::emitDebugLocImpl(MCSection *Sec) {
if (DebugLocs.getLists().empty())
return;
Asm->OutStreamer->SwitchSection(Sec);
Asm->OutStreamer->switchSection(Sec);
MCSymbol *TableEnd = nullptr;
if (getDwarfVersion() >= 5)
@ -2877,7 +2877,7 @@ void DwarfDebug::emitDebugLocDWO() {
}
for (const auto &List : DebugLocs.getLists()) {
Asm->OutStreamer->SwitchSection(
Asm->OutStreamer->switchSection(
Asm->getObjFileLowering().getDwarfLocDWOSection());
Asm->OutStreamer->emitLabel(List.Label);
@ -2984,7 +2984,7 @@ void DwarfDebug::emitDebugARanges() {
}
// Start the dwarf aranges section.
Asm->OutStreamer->SwitchSection(
Asm->OutStreamer->switchSection(
Asm->getObjFileLowering().getDwarfARangesSection());
unsigned PtrSize = Asm->MAI->getCodePointerSize();
@ -3084,7 +3084,7 @@ void DwarfDebug::emitDebugRangesImpl(const DwarfFile &Holder, MCSection *Section
return !Pair.second->getCUNode()->isDebugDirectivesOnly();
}));
Asm->OutStreamer->SwitchSection(Section);
Asm->OutStreamer->switchSection(Section);
MCSymbol *TableEnd = nullptr;
if (getDwarfVersion() >= 5)
@ -3236,7 +3236,7 @@ void DwarfDebug::emitDebugMacinfoImpl(MCSection *Section) {
DIMacroNodeArray Macros = CUNode->getMacros();
if (Macros.empty())
continue;
Asm->OutStreamer->SwitchSection(Section);
Asm->OutStreamer->switchSection(Section);
Asm->OutStreamer->emitLabel(U.getMacroLabelBegin());
if (UseDebugMacroSection)
emitMacroHeader(Asm, *this, U, getDwarfVersion());

View File

@ -45,7 +45,7 @@ void DwarfFile::emitUnit(DwarfUnit *TheU, bool UseOffsets) {
if (llvm::empty(TheU->getUnitDie().values()))
return;
Asm->OutStreamer->SwitchSection(S);
Asm->OutStreamer->switchSection(S);
TheU->emitHeader(UseOffsets);
Asm->emitDwarfDIE(TheU->getUnitDie());

View File

@ -55,7 +55,7 @@ void DwarfStringPool::emitStringOffsetsTableHeader(AsmPrinter &Asm,
MCSymbol *StartSym) {
if (getNumIndexedStrings() == 0)
return;
Asm.OutStreamer->SwitchSection(Section);
Asm.OutStreamer->switchSection(Section);
unsigned EntrySize = Asm.getDwarfOffsetByteSize();
// We are emitting the header for a contribution to the string offsets
// table. The header consists of an entry with the contribution's
@ -78,7 +78,7 @@ void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection,
return;
// Start the dwarf str section.
Asm.OutStreamer->SwitchSection(StrSection);
Asm.OutStreamer->switchSection(StrSection);
// Get all of the string pool entries and sort them by their offset.
SmallVector<const StringMapEntry<EntryTy> *, 64> Entries;
@ -117,7 +117,7 @@ void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection,
Entries[Entry.getValue().Index] = &Entry;
}
Asm.OutStreamer->SwitchSection(OffsetSection);
Asm.OutStreamer->switchSection(OffsetSection);
unsigned size = Asm.getDwarfOffsetByteSize();
for (const auto &Entry : Entries)
if (UseRelativeOffsets)

View File

@ -457,7 +457,7 @@ MCSymbol *EHStreamer::emitExceptionTable() {
// Sometimes we want not to emit the data into separate section (e.g. ARM
// EHABI). In this case LSDASection will be NULL.
if (LSDASection)
Asm->OutStreamer->SwitchSection(LSDASection);
Asm->OutStreamer->switchSection(LSDASection);
Asm->emitAlignment(Align(4));
// Emit the LSDA.

View File

@ -45,9 +45,8 @@ void ErlangGCPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
unsigned IntPtrSize = M.getDataLayout().getPointerSize();
// Put this in a custom .note section.
OS.SwitchSection(
AP.getObjFileLowering().getContext().getELFSection(".note.gc",
ELF::SHT_PROGBITS, 0));
OS.switchSection(AP.getObjFileLowering().getContext().getELFSection(
".note.gc", ELF::SHT_PROGBITS, 0));
// For each function...
for (GCModuleInfo::FuncInfoVec::iterator FI = Info.funcinfo_begin(),

View File

@ -72,10 +72,10 @@ static void EmitCamlGlobal(const Module &M, AsmPrinter &AP, const char *Id) {
void OcamlGCMetadataPrinter::beginAssembly(Module &M, GCModuleInfo &Info,
AsmPrinter &AP) {
AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getTextSection());
AP.OutStreamer->switchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(M, AP, "code_begin");
AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
AP.OutStreamer->switchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "data_begin");
}
@ -99,16 +99,16 @@ void OcamlGCMetadataPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
AsmPrinter &AP) {
unsigned IntPtrSize = M.getDataLayout().getPointerSize();
AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getTextSection());
AP.OutStreamer->switchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(M, AP, "code_end");
AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
AP.OutStreamer->switchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "data_end");
// FIXME: Why does ocaml emit this??
AP.OutStreamer->emitIntValue(0, IntPtrSize);
AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
AP.OutStreamer->switchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "frametable");
int NumDescriptors = 0;

View File

@ -107,18 +107,18 @@ void WinCFGuard::endModule() {
// Emit the symbol index of each GFIDs entry to form the .gfids section.
auto &OS = *Asm->OutStreamer;
OS.SwitchSection(Asm->OutContext.getObjectFileInfo()->getGFIDsSection());
OS.switchSection(Asm->OutContext.getObjectFileInfo()->getGFIDsSection());
for (const MCSymbol *S : GFIDsEntries)
OS.emitCOFFSymbolIndex(S);
// Emit the symbol index of each GIATs entry to form the .giats section.
OS.SwitchSection(Asm->OutContext.getObjectFileInfo()->getGIATsSection());
OS.switchSection(Asm->OutContext.getObjectFileInfo()->getGIATsSection());
for (const MCSymbol *S : GIATsEntries) {
OS.emitCOFFSymbolIndex(S);
}
// Emit the symbol index of each longjmp target to form the .gljmp section.
OS.SwitchSection(Asm->OutContext.getObjectFileInfo()->getGLJMPSection());
OS.switchSection(Asm->OutContext.getObjectFileInfo()->getGLJMPSection());
for (const MCSymbol *S : LongjmpTargets) {
OS.emitCOFFSymbolIndex(S);
}

View File

@ -53,7 +53,7 @@ void WinException::endModule() {
if (M->getModuleFlag("ehcontguard") && !EHContTargets.empty()) {
// Emit the symbol index of each ehcont target.
OS.SwitchSection(Asm->OutContext.getObjectFileInfo()->getGEHContSection());
OS.switchSection(Asm->OutContext.getObjectFileInfo()->getGEHContSection());
for (const MCSymbol *S : EHContTargets) {
OS.emitCOFFSymbolIndex(S);
}
@ -150,7 +150,7 @@ void WinException::endFunction(const MachineFunction *MF) {
// Just switch sections to the right xdata section.
MCSection *XData = Asm->OutStreamer->getAssociatedXDataSection(
Asm->OutStreamer->getCurrentSectionOnly());
Asm->OutStreamer->SwitchSection(XData);
Asm->OutStreamer->switchSection(XData);
// Emit the tables appropriate to the personality function in use. If we
// don't recognize the personality, assume it uses an Itanium-style LSDA.
@ -249,7 +249,7 @@ void WinException::beginFunclet(const MachineBasicBlock &MBB,
void WinException::endFunclet() {
if (isAArch64 && CurrentFuncletEntry &&
(shouldEmitMoves || shouldEmitPersonality)) {
Asm->OutStreamer->SwitchSection(CurrentFuncletTextSection);
Asm->OutStreamer->switchSection(CurrentFuncletTextSection);
Asm->OutStreamer->emitWinCFIFuncletOrFuncEnd();
}
endFuncletImpl();
@ -301,7 +301,7 @@ void WinException::endFuncletImpl() {
// Switch back to the funclet start .text section now that we are done
// writing to .xdata, and emit an .seh_endproc directive to mark the end of
// the function.
Asm->OutStreamer->SwitchSection(CurrentFuncletTextSection);
Asm->OutStreamer->switchSection(CurrentFuncletTextSection);
Asm->OutStreamer->emitWinCFIEndProc();
}

View File

@ -52,7 +52,7 @@ void FaultMaps::serializeToFaultMapSection() {
// Create the section.
MCSection *FaultMapSection =
OutContext.getObjectFileInfo()->getFaultMapSection();
OS.SwitchSection(FaultMapSection);
OS.switchSection(FaultMapSection);
// Emit a dummy symbol to force section inclusion.
OS.emitLabel(OutContext.getOrCreateSymbol(Twine("__LLVM_FaultMaps")));

View File

@ -721,7 +721,7 @@ void StackMaps::serializeToStackMapSection() {
// Create the section.
MCSection *StackMapSection =
OutContext.getObjectFileInfo()->getStackMapSection();
OS.SwitchSection(StackMapSection);
OS.switchSection(StackMapSection);
// Emit a dummy symbol to force section inclusion.
OS.emitLabel(OutContext.getOrCreateSymbol(Twine("__LLVM_StackMaps")));

View File

@ -310,7 +310,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
auto *S = C.getELFSection(".linker-options", ELF::SHT_LLVM_LINKER_OPTIONS,
ELF::SHF_EXCLUDE);
Streamer.SwitchSection(S);
Streamer.switchSection(S);
for (const auto *Operand : LinkerOptions->operands()) {
if (cast<MDNode>(Operand)->getNumOperands() != 2)
@ -326,7 +326,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
auto *S = C.getELFSection(".deplibs", ELF::SHT_LLVM_DEPENDENT_LIBRARIES,
ELF::SHF_MERGE | ELF::SHF_STRINGS, 1);
Streamer.SwitchSection(S);
Streamer.switchSection(S);
for (const auto *Operand : DependentLibraries->operands()) {
Streamer.emitBytes(
@ -350,7 +350,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
auto *S = C.getObjectFileInfo()->getPseudoProbeDescSection(
TM->getFunctionSections() ? Name->getString() : StringRef());
Streamer.SwitchSection(S);
Streamer.switchSection(S);
Streamer.emitInt64(GUID->getZExtValue());
Streamer.emitInt64(Hash->getZExtValue());
Streamer.emitULEB128IntValue(Name->getString().size());
@ -365,7 +365,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
GetObjCImageInfo(M, Version, Flags, Section);
if (!Section.empty()) {
auto *S = C.getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
Streamer.SwitchSection(S);
Streamer.switchSection(S);
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
Streamer.emitInt32(Version);
Streamer.emitInt32(Flags);
@ -399,7 +399,7 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(
MCSection *Sec = getContext().getELFNamedSection(".data", Label->getName(),
ELF::SHT_PROGBITS, Flags, 0);
unsigned Size = DL.getPointerSize();
Streamer.SwitchSection(Sec);
Streamer.switchSection(Sec);
Streamer.emitValueToAlignment(DL.getPointerABIAlignment(0).value());
Streamer.emitSymbolAttribute(Label, MCSA_ELF_TypeObject);
const MCExpr *E = MCConstantExpr::create(Size, getContext());
@ -1226,7 +1226,7 @@ void TargetLoweringObjectFileMachO::emitModuleMetadata(MCStreamer &Streamer,
// Get the section.
MCSectionMachO *S = getContext().getMachOSection(
Segment, Section, TAA, StubSize, SectionKind::getData());
Streamer.SwitchSection(S);
Streamer.switchSection(S);
Streamer.emitLabel(getContext().
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
Streamer.emitInt32(VersionVal);
@ -1777,7 +1777,7 @@ void TargetLoweringObjectFileCOFF::emitModuleMetadata(MCStreamer &Streamer,
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ,
SectionKind::getReadOnly());
Streamer.SwitchSection(S);
Streamer.switchSection(S);
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
Streamer.emitInt32(Version);
Streamer.emitInt32(Flags);
@ -1794,7 +1794,7 @@ void TargetLoweringObjectFileCOFF::emitLinkerDirectives(
// spec, this section is a space-separated string containing flags for
// linker.
MCSection *Sec = getDrectveSection();
Streamer.SwitchSection(Sec);
Streamer.switchSection(Sec);
for (const auto *Option : LinkerOptions->operands()) {
for (const auto &Piece : cast<MDNode>(Option)->operands()) {
// Lead with a space for consistency with our dllexport implementation.
@ -1813,7 +1813,7 @@ void TargetLoweringObjectFileCOFF::emitLinkerDirectives(
getMangler());
OS.flush();
if (!Flags.empty()) {
Streamer.SwitchSection(getDrectveSection());
Streamer.switchSection(getDrectveSection());
Streamer.emitBytes(Flags);
}
Flags.clear();
@ -1839,7 +1839,7 @@ void TargetLoweringObjectFileCOFF::emitLinkerDirectives(
OS.flush();
if (!Flags.empty()) {
Streamer.SwitchSection(getDrectveSection());
Streamer.switchSection(getDrectveSection());
Streamer.emitBytes(Flags);
}
Flags.clear();

View File

@ -116,7 +116,7 @@ bool DwarfStreamer::init(Triple TheTriple,
void DwarfStreamer::finish() { MS->finish(); }
void DwarfStreamer::switchToDebugInfoSection(unsigned DwarfVersion) {
MS->SwitchSection(MOFI->getDwarfInfoSection());
MS->switchSection(MOFI->getDwarfInfoSection());
MC->setDwarfVersion(DwarfVersion);
}
@ -174,14 +174,14 @@ void DwarfStreamer::emitCompileUnitHeader(CompileUnit &Unit,
void DwarfStreamer::emitAbbrevs(
const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
unsigned DwarfVersion) {
MS->SwitchSection(MOFI->getDwarfAbbrevSection());
MS->switchSection(MOFI->getDwarfAbbrevSection());
MC->setDwarfVersion(DwarfVersion);
Asm->emitDwarfAbbrevs(Abbrevs);
}
/// Recursively emit the DIE tree rooted at \p Die.
void DwarfStreamer::emitDIE(DIE &Die) {
MS->SwitchSection(MOFI->getDwarfInfoSection());
MS->switchSection(MOFI->getDwarfInfoSection());
Asm->emitDwarfDIE(Die);
DebugInfoSectionSize += Die.getSize();
}
@ -200,7 +200,7 @@ void DwarfStreamer::emitSectionContents(StringRef SecData, StringRef SecName) {
.Default(nullptr);
if (Section) {
MS->SwitchSection(Section);
MS->switchSection(Section);
MS->emitBytes(SecData);
}
@ -220,7 +220,7 @@ void DwarfStreamer::emitPaperTrailWarningsDie(DIE &Die) {
/// Emit the debug_str section stored in \p Pool.
void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) {
Asm->OutStreamer->SwitchSection(MOFI->getDwarfStrSection());
Asm->OutStreamer->switchSection(MOFI->getDwarfStrSection());
std::vector<DwarfStringPoolEntryRef> Entries = Pool.getEntriesForEmission();
for (auto Entry : Entries) {
// Emit the string itself.
@ -232,7 +232,7 @@ void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) {
#if 0
if (DwarfVersion >= 5) {
// Emit an empty string offset section.
Asm->OutStreamer->SwitchSection(MOFI->getDwarfStrOffSection());
Asm->OutStreamer->switchSection(MOFI->getDwarfStrOffSection());
Asm->emitDwarfUnitLength(4, "Length of String Offsets Set");
Asm->emitInt16(DwarfVersion);
Asm->emitInt16(0);
@ -255,7 +255,7 @@ void DwarfStreamer::emitDebugNames(
UniqueIdToCuMap[CU.ID] = Id++;
}
Asm->OutStreamer->SwitchSection(MOFI->getDwarfDebugNamesSection());
Asm->OutStreamer->switchSection(MOFI->getDwarfDebugNamesSection());
emitDWARF5AccelTable(
Asm.get(), Table, CompUnits,
[&UniqueIdToCuMap](const DWARF5AccelTableStaticData &Entry) {
@ -265,7 +265,7 @@ void DwarfStreamer::emitDebugNames(
void DwarfStreamer::emitAppleNamespaces(
AccelTable<AppleAccelTableStaticOffsetData> &Table) {
Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelNamespaceSection());
Asm->OutStreamer->switchSection(MOFI->getDwarfAccelNamespaceSection());
auto *SectionBegin = Asm->createTempSymbol("namespac_begin");
Asm->OutStreamer->emitLabel(SectionBegin);
emitAppleAccelTable(Asm.get(), Table, "namespac", SectionBegin);
@ -273,7 +273,7 @@ void DwarfStreamer::emitAppleNamespaces(
void DwarfStreamer::emitAppleNames(
AccelTable<AppleAccelTableStaticOffsetData> &Table) {
Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelNamesSection());
Asm->OutStreamer->switchSection(MOFI->getDwarfAccelNamesSection());
auto *SectionBegin = Asm->createTempSymbol("names_begin");
Asm->OutStreamer->emitLabel(SectionBegin);
emitAppleAccelTable(Asm.get(), Table, "names", SectionBegin);
@ -281,7 +281,7 @@ void DwarfStreamer::emitAppleNames(
void DwarfStreamer::emitAppleObjc(
AccelTable<AppleAccelTableStaticOffsetData> &Table) {
Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelObjCSection());
Asm->OutStreamer->switchSection(MOFI->getDwarfAccelObjCSection());
auto *SectionBegin = Asm->createTempSymbol("objc_begin");
Asm->OutStreamer->emitLabel(SectionBegin);
emitAppleAccelTable(Asm.get(), Table, "objc", SectionBegin);
@ -289,7 +289,7 @@ void DwarfStreamer::emitAppleObjc(
void DwarfStreamer::emitAppleTypes(
AccelTable<AppleAccelTableStaticTypeData> &Table) {
Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelTypesSection());
Asm->OutStreamer->switchSection(MOFI->getDwarfAccelTypesSection());
auto *SectionBegin = Asm->createTempSymbol("types_begin");
Asm->OutStreamer->emitLabel(SectionBegin);
emitAppleAccelTable(Asm.get(), Table, "types", SectionBegin);
@ -299,7 +299,7 @@ void DwarfStreamer::emitAppleTypes(
void DwarfStreamer::emitSwiftAST(StringRef Buffer) {
MCSection *SwiftASTSection = MOFI->getDwarfSwiftASTSection();
SwiftASTSection->setAlignment(Align(32));
MS->SwitchSection(SwiftASTSection);
MS->switchSection(SwiftASTSection);
MS->emitBytes(Buffer);
}
@ -311,7 +311,7 @@ void DwarfStreamer::emitSwiftReflectionSection(
if (ReflectionSection == nullptr)
return;
ReflectionSection->setAlignment(Align(Alignment));
MS->SwitchSection(ReflectionSection);
MS->switchSection(ReflectionSection);
MS->emitBytes(Buffer);
}
@ -324,7 +324,7 @@ void DwarfStreamer::emitRangesEntries(
const FunctionIntervals::const_iterator &FuncRange,
const std::vector<DWARFDebugRangeList::RangeListEntry> &Entries,
unsigned AddressSize) {
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfRangesSection());
MS->switchSection(MC->getObjectFileInfo()->getDwarfRangesSection());
// Offset each range by the right amount.
int64_t PcOffset = Entries.empty() ? 0 : FuncRange.value() + UnitPcOffset;
@ -376,7 +376,7 @@ void DwarfStreamer::emitUnitRangesEntries(CompileUnit &Unit,
llvm::sort(Ranges);
if (!Ranges.empty()) {
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfARangesSection());
MS->switchSection(MC->getObjectFileInfo()->getDwarfARangesSection());
MCSymbol *BeginLabel = Asm->createTempSymbol("Barange");
MCSymbol *EndLabel = Asm->createTempSymbol("Earange");
@ -418,7 +418,7 @@ void DwarfStreamer::emitUnitRangesEntries(CompileUnit &Unit,
if (!DoDebugRanges)
return;
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfRangesSection());
MS->switchSection(MC->getObjectFileInfo()->getDwarfRangesSection());
// Offset each range by the right amount.
int64_t PcOffset = -Unit.getLowPc();
// Emit coalesced ranges.
@ -446,7 +446,7 @@ void DwarfStreamer::emitLocationsForUnit(
if (Attributes.empty())
return;
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfLocSection());
MS->switchSection(MC->getObjectFileInfo()->getDwarfLocSection());
unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize();
uint64_t BaseAddressMarker = (AddressSize == 8)
@ -508,7 +508,7 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
std::vector<DWARFDebugLine::Row> &Rows,
unsigned PointerSize) {
// Switch to the section where the table will be emitted into.
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfLineSection());
MS->switchSection(MC->getObjectFileInfo()->getDwarfLineSection());
MCSymbol *LineStartSym = MC->createTempSymbol();
MCSymbol *LineEndSym = MC->createTempSymbol();
@ -649,7 +649,7 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
/// Copy the debug_line over to the updated binary while unobfuscating the file
/// names and directories.
void DwarfStreamer::translateLineTable(DataExtractor Data, uint64_t Offset) {
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfLineSection());
MS->switchSection(MC->getObjectFileInfo()->getDwarfLineSection());
StringRef Contents = Data.getData();
// We have to deconstruct the line table header, because it contains to
@ -737,7 +737,7 @@ void DwarfStreamer::emitPubSectionForUnit(
return;
// Start the dwarf pubnames section.
Asm->OutStreamer->SwitchSection(Sec);
Asm->OutStreamer->switchSection(Sec);
MCSymbol *BeginLabel = Asm->createTempSymbol("pub" + SecName + "_begin");
MCSymbol *EndLabel = Asm->createTempSymbol("pub" + SecName + "_end");
@ -784,7 +784,7 @@ void DwarfStreamer::emitPubTypesForUnit(const CompileUnit &Unit) {
/// Emit a CIE into the debug_frame section.
void DwarfStreamer::emitCIE(StringRef CIEBytes) {
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
MS->switchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
MS->emitBytes(CIEBytes);
FrameSectionSize += CIEBytes.size();
@ -795,7 +795,7 @@ void DwarfStreamer::emitCIE(StringRef CIEBytes) {
/// which will be replaced with the parameter values.
void DwarfStreamer::emitFDE(uint32_t CIEOffset, uint32_t AddrSize,
uint32_t Address, StringRef FDEBytes) {
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
MS->switchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
MS->emitIntValue(FDEBytes.size() + 4 + AddrSize, 4);
MS->emitIntValue(CIEOffset, 4);

View File

@ -182,7 +182,7 @@ addAllTypesFromDWP(MCStreamer &Out,
const DWARFUnitIndex &TUIndex, MCSection *OutputTypes,
StringRef Types, const UnitIndexEntry &TUEntry,
uint32_t &TypesOffset, unsigned TypesContributionIndex) {
Out.SwitchSection(OutputTypes);
Out.switchSection(OutputTypes);
for (const DWARFUnitIndex::Entry &E : TUIndex.getRows()) {
auto *I = E.getContributions();
if (!I)
@ -216,7 +216,7 @@ static void addAllTypesFromTypesSection(
MCSection *OutputTypes, const std::vector<StringRef> &TypesSections,
const UnitIndexEntry &CUEntry, uint32_t &TypesOffset) {
for (StringRef Types : TypesSections) {
Out.SwitchSection(OutputTypes);
Out.switchSection(OutputTypes);
uint64_t Offset = 0;
DataExtractor Data(Types, true, 0);
while (Data.isValidOffset(Offset)) {
@ -374,7 +374,7 @@ void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
Data = DataExtractor(CurStrOffsetSection, true, 0);
Out.SwitchSection(StrOffsetSection);
Out.switchSection(StrOffsetSection);
uint64_t HeaderSize = debugStrOffsetsHeaderSize(Data, Version);
uint64_t Offset = 0;
@ -428,7 +428,7 @@ void writeIndex(MCStreamer &Out, MCSection *Section,
++I;
}
Out.SwitchSection(Section);
Out.switchSection(Section);
Out.emitIntValue(IndexVersion, 4); // Version
Out.emitIntValue(Columns, 4); // Columns
Out.emitIntValue(IndexEntries.size(), 4); // Num Units
@ -527,7 +527,7 @@ Error handleSection(
else if (OutSection == InfoSection)
CurInfoSection.push_back(Contents);
else {
Out.SwitchSection(OutSection);
Out.switchSection(OutSection);
Out.emitBytes(Contents);
}
return Error::success();
@ -634,7 +634,7 @@ Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
ContributionOffsets[getContributionIndex(DW_SECT_INFO, IndexVersion)];
if (CurCUIndexSection.empty()) {
bool FoundCUUnit = false;
Out.SwitchSection(InfoSection);
Out.switchSection(InfoSection);
for (StringRef Info : CurInfoSection) {
uint64_t UnitOffset = 0;
while (Info.size() > UnitOffset) {
@ -704,7 +704,7 @@ Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
utostr(CUIndex.getVersion()) +
" and expecting " + utostr(IndexVersion));
Out.SwitchSection(InfoSection);
Out.switchSection(InfoSection);
for (const DWARFUnitIndex::Entry &E : CUIndex.getRows()) {
auto *I = E.getContributions();
if (!I)

View File

@ -92,7 +92,7 @@ AssemblerConstantPools::getOrCreateConstantPool(MCSection *Section) {
static void emitConstantPool(MCStreamer &Streamer, MCSection *Section,
ConstantPool &CP) {
if (!CP.empty()) {
Streamer.SwitchSection(Section);
Streamer.switchSection(Section);
CP.emitEntries(Streamer);
}
}

View File

@ -2088,7 +2088,7 @@ void MCAsmStreamer::emitWinEHHandler(const MCSymbol *Sym, bool Unwind,
void MCAsmStreamer::emitWinEHHandlerData(SMLoc Loc) {
MCStreamer::emitWinEHHandlerData(Loc);
// Switch sections. Don't call SwitchSection directly, because that will
// Switch sections. Don't call switchSection directly, because that will
// cause the section switch to be visible in the emitted assembly.
// We only do this so the section switch that terminates the handler
// data block is visible.
@ -2387,7 +2387,7 @@ void MCAsmStreamer::finishImpl() {
if (!Tables.empty()) {
assert(Tables.size() == 1 && "asm output only supports one line table");
if (auto *Label = Tables.begin()->second.getLabel()) {
SwitchSection(getContext().getObjectFileInfo()->getDwarfLineSection());
switchSection(getContext().getObjectFileInfo()->getDwarfLineSection());
emitLabel(Label);
}
}

View File

@ -269,7 +269,7 @@ void MCDwarfLineTable::emit(MCStreamer *MCOS, MCDwarfLineTableParams Params) {
LineStr = MCDwarfLineStr(context);
// Switch to the section where the table will be emitted into.
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfLineSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfLineSection());
// Handle the rest of the Compile Units.
for (const auto &CUIDTablePair : LineTables) {
@ -285,7 +285,7 @@ void MCDwarfDwoLineTable::Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
if (!HasSplitLineTable)
return;
Optional<MCDwarfLineStr> NoLineStr(None);
MCOS.SwitchSection(Section);
MCOS.switchSection(Section);
MCOS.emitLabel(Header.Emit(&MCOS, Params, None, NoLineStr).second);
}
@ -332,7 +332,7 @@ static void emitAbsValue(MCStreamer &OS, const MCExpr *Value, unsigned Size) {
void MCDwarfLineStr::emitSection(MCStreamer *MCOS) {
// Switch to the .debug_line_str section.
MCOS->SwitchSection(
MCOS->switchSection(
MCOS->getContext().getObjectFileInfo()->getDwarfLineStrSection());
SmallString<0> Data = getFinalizedData();
MCOS->emitBinaryData(Data.str());
@ -769,7 +769,7 @@ static void EmitAbbrev(MCStreamer *MCOS, uint64_t Name, uint64_t Form) {
// the data for .debug_abbrev section which contains three DIEs.
static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
MCContext &context = MCOS->getContext();
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
// DW_TAG_compile_unit DIE abbrev (1).
MCOS->emitULEB128IntValue(1);
@ -822,7 +822,7 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
auto &Sections = context.getGenDwarfSectionSyms();
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfARangesSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfARangesSection());
unsigned UnitLengthBytes =
dwarf::getUnitLengthFieldByteSize(context.getDwarfFormat());
@ -901,7 +901,7 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
const MCSymbol *RangesSymbol) {
MCContext &context = MCOS->getContext();
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfInfoSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfInfoSection());
// Create a symbol at the start and end of this section used in here for the
// expression to calculate the length in the header.
@ -1078,7 +1078,7 @@ static MCSymbol *emitGenDwarfRanges(MCStreamer *MCOS) {
MCSymbol *RangesSymbol;
if (MCOS->getContext().getDwarfVersion() >= 5) {
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRnglistsSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfRnglistsSection());
MCSymbol *EndSymbol = mcdwarf::emitListsTableHeaderStart(*MCOS);
MCOS->AddComment("Offset entry count");
MCOS->emitInt32(0);
@ -1098,7 +1098,7 @@ static MCSymbol *emitGenDwarfRanges(MCStreamer *MCOS) {
MCOS->emitInt8(dwarf::DW_RLE_end_of_list);
MCOS->emitLabel(EndSymbol);
} else {
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRangesSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfRangesSection());
RangesSymbol = context.createTempSymbol("debug_ranges_start");
MCOS->emitLabel(RangesSymbol);
for (MCSection *Sec : Sections) {
@ -1159,18 +1159,18 @@ void MCGenDwarfInfo::Emit(MCStreamer *MCOS) {
MCOS->getContext().getDwarfVersion() >= 3;
CreateDwarfSectionSymbols |= UseRangesSection;
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfInfoSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfInfoSection());
if (CreateDwarfSectionSymbols) {
InfoSectionSymbol = context.createTempSymbol();
MCOS->emitLabel(InfoSectionSymbol);
}
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
if (CreateDwarfSectionSymbols) {
AbbrevSectionSymbol = context.createTempSymbol();
MCOS->emitLabel(AbbrevSectionSymbol);
}
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfARangesSection());
MCOS->switchSection(context.getObjectFileInfo()->getDwarfARangesSection());
// Output the data for .debug_aranges section.
EmitGenDwarfAranges(MCOS, InfoSectionSymbol);
@ -1857,7 +1857,7 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
for (const MCDwarfFrameInfo &Frame : FrameArray) {
if (Frame.CompactUnwindEncoding == 0) continue;
if (!SectionEmitted) {
Streamer.SwitchSection(MOFI->getCompactUnwindSection());
Streamer.switchSection(MOFI->getCompactUnwindSection());
Streamer.emitValueToAlignment(AsmInfo->getCodePointerSize());
SectionEmitted = true;
}
@ -1874,7 +1874,7 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
IsEH ? *const_cast<MCObjectFileInfo *>(MOFI)->getEHFrameSection()
: *MOFI->getDwarfFrameSection();
Streamer.SwitchSection(&Section);
Streamer.switchSection(&Section);
MCSymbol *SectionStart = Context.createTempSymbol();
Streamer.emitLabel(SectionStart);

View File

@ -90,11 +90,11 @@ void MCELFStreamer::mergeFragment(MCDataFragment *DF,
void MCELFStreamer::initSections(bool NoExecStack, const MCSubtargetInfo &STI) {
MCContext &Ctx = getContext();
SwitchSection(Ctx.getObjectFileInfo()->getTextSection());
switchSection(Ctx.getObjectFileInfo()->getTextSection());
emitCodeAlignment(Ctx.getObjectFileInfo()->getTextSectionAlignment(), &STI);
if (NoExecStack)
SwitchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
switchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
}
void MCELFStreamer::emitLabel(MCSymbol *S, SMLoc Loc) {
@ -318,13 +318,13 @@ void MCELFStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
MCSection &Section = *getAssembler().getContext().getELFSection(
".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
MCSectionSubPair P = getCurrentSection();
SwitchSection(&Section);
switchSection(&Section);
emitValueToAlignment(ByteAlignment, 0, 1, 0);
emitLabel(Symbol);
emitZeros(Size);
SwitchSection(P.first, P.second);
switchSection(P.first, P.second);
} else {
if(Symbol->declareCommon(Size, ByteAlignment))
report_fatal_error(Twine("Symbol: ") + Symbol->getName() +
@ -383,7 +383,7 @@ void MCELFStreamer::emitIdent(StringRef IdentString) {
MCSection *Comment = getAssembler().getContext().getELFSection(
".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS, 1);
pushSection();
SwitchSection(Comment);
switchSection(Comment);
if (!SeenIdent) {
emitInt8(0);
SeenIdent = true;
@ -513,7 +513,7 @@ void MCELFStreamer::finalizeCGProfile() {
".llvm.call-graph-profile", ELF::SHT_LLVM_CALL_GRAPH_PROFILE,
ELF::SHF_EXCLUDE, /*sizeof(Elf_CGProfile_Impl<>)=*/8);
pushSection();
SwitchSection(CGProfile);
switchSection(CGProfile);
uint64_t Offset = 0;
for (MCAssembler::CGProfileEntry &E : Asm.CGProfile) {
finalizeCGProfileEntry(E.From, Offset);
@ -833,10 +833,10 @@ void MCELFStreamer::createAttributesSection(
// Switch section to AttributeSection or get/create the section.
if (AttributeSection) {
SwitchSection(AttributeSection);
switchSection(AttributeSection);
} else {
AttributeSection = getContext().getELFSection(Section, Type, 0);
SwitchSection(AttributeSection);
switchSection(AttributeSection);
// Format version
emitInt8(0x41);

View File

@ -463,7 +463,7 @@ void MCMachOStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
}
pushSection();
SwitchSection(Section);
switchSection(Section);
// The symbol may not be present, which only creates the section.
if (Symbol) {

View File

@ -560,7 +560,7 @@ void MCObjectStreamer::emitDwarfLineEndEntry(MCSection *Section,
// Switch back the dwarf line section, in case endSection had to switch the
// section.
MCContext &Ctx = getContext();
SwitchSection(Ctx.getObjectFileInfo()->getDwarfLineSection());
switchSection(Ctx.getObjectFileInfo()->getDwarfLineSection());
const MCAsmInfo *AsmInfo = Ctx.getAsmInfo();
emitDwarfAdvanceLineAddr(INT64_MAX, LastLabel, SectionEnd,

View File

@ -319,7 +319,7 @@ bool COFFAsmParser::ParseSectionSwitch(StringRef Section,
return TokError("unexpected token in section switching directive");
Lex();
getStreamer().SwitchSection(getContext().getCOFFSection(
getStreamer().switchSection(getContext().getCOFFSection(
Section, Characteristics, Kind, COMDATSymName, Type));
return false;

View File

@ -238,7 +238,7 @@ bool COFFMasmParser::ParseSectionSwitch(StringRef Section,
return TokError("unexpected token in section switching directive");
Lex();
getStreamer().SwitchSection(getContext().getCOFFSection(
getStreamer().switchSection(getContext().getCOFFSection(
Section, Characteristics, Kind, COMDATSymName, Type));
return false;
@ -266,7 +266,7 @@ bool COFFMasmParser::ParseDirectiveSegment(StringRef Directive, SMLoc Loc) {
COFF::IMAGE_SCN_MEM_READ;
}
SectionKind Kind = computeSectionKind(Flags);
getStreamer().SwitchSection(getContext().getCOFFSection(
getStreamer().switchSection(getContext().getCOFFSection(
SectionName, Flags, Kind, "", (COFF::COMDATType)(0)));
return false;
}
@ -294,7 +294,7 @@ bool COFFMasmParser::ParseDirectiveIncludelib(StringRef Directive, SMLoc Loc) {
unsigned Flags = COFF::IMAGE_SCN_MEM_PRELOAD | COFF::IMAGE_SCN_MEM_16BIT;
SectionKind Kind = computeSectionKind(Flags);
getStreamer().pushSection();
getStreamer().SwitchSection(getContext().getCOFFSection(
getStreamer().switchSection(getContext().getCOFFSection(
".drectve", Flags, Kind, "", (COFF::COMDATType)(0)));
getStreamer().emitBytes("/DEFAULTLIB:");
getStreamer().emitBytes(Lib);

View File

@ -480,7 +480,7 @@ bool DarwinAsmParser::parseSectionSwitch(StringRef Segment, StringRef Section,
// FIXME: Arch specific.
bool isText = TAA & MachO::S_ATTR_PURE_INSTRUCTIONS;
getStreamer().SwitchSection(getContext().getMachOSection(
getStreamer().switchSection(getContext().getMachOSection(
Segment, Section, TAA, StubSize,
isText ? SectionKind::getText() : SectionKind::getData()));
@ -719,7 +719,7 @@ bool DarwinAsmParser::parseDirectiveSection(StringRef, SMLoc) {
// FIXME: Arch specific.
bool isText = Segment == "__TEXT"; // FIXME: Hack.
getStreamer().SwitchSection(getContext().getMachOSection(
getStreamer().switchSection(getContext().getMachOSection(
Segment, Section, TAA, StubSize,
isText ? SectionKind::getText() : SectionKind::getData()));
return false;
@ -752,7 +752,7 @@ bool DarwinAsmParser::parseDirectivePrevious(StringRef DirName, SMLoc) {
MCSectionSubPair PreviousSection = getStreamer().getPreviousSection();
if (!PreviousSection.first)
return TokError(".previous without corresponding .section");
getStreamer().SwitchSection(PreviousSection.first, PreviousSection.second);
getStreamer().switchSection(PreviousSection.first, PreviousSection.second);
return false;
}

View File

@ -212,7 +212,7 @@ bool ELFAsmParser::ParseSectionSwitch(StringRef Section, unsigned Type,
}
Lex();
getStreamer().SwitchSection(getContext().getELFSection(Section, Type, Flags),
getStreamer().switchSection(getContext().getELFSection(Section, Type, Flags),
Subsection);
return false;
@ -678,7 +678,7 @@ EndStmt:
MCSectionELF *Section =
getContext().getELFSection(SectionName, Type, Flags, Size, GroupName,
IsComdat, UniqueID, LinkedToSym);
getStreamer().SwitchSection(Section, Subsection);
getStreamer().switchSection(Section, Subsection);
// Check that flags are used consistently. However, the GNU assembler permits
// to leave out in subsequent uses of the same sections; for compatibility,
// do likewise.
@ -718,7 +718,7 @@ bool ELFAsmParser::ParseDirectivePrevious(StringRef DirName, SMLoc) {
MCSectionSubPair PreviousSection = getStreamer().getPreviousSection();
if (PreviousSection.first == nullptr)
return TokError(".previous without corresponding .section");
getStreamer().SwitchSection(PreviousSection.first, PreviousSection.second);
getStreamer().switchSection(PreviousSection.first, PreviousSection.second);
return false;
}
@ -861,7 +861,7 @@ bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
MCSection *Note = getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
getStreamer().pushSection();
getStreamer().SwitchSection(Note);
getStreamer().switchSection(Note);
getStreamer().emitInt32(Data.size() + 1); // namesz
getStreamer().emitInt32(0); // descsz = 0 (no description).
getStreamer().emitInt32(1); // type = NT_VERSION

View File

@ -93,7 +93,7 @@ public:
bool parseSectionDirectiveData(StringRef, SMLoc) {
auto *S = getContext().getObjectFileInfo()->getDataSection();
getStreamer().SwitchSection(S);
getStreamer().switchSection(S);
return false;
}
@ -201,7 +201,7 @@ public:
WS->setPassive();
}
getStreamer().SwitchSection(WS);
getStreamer().switchSection(WS);
return false;
}

View File

@ -183,7 +183,7 @@ void MCPseudoProbeSection::emit(MCObjectStreamer *MCOS) {
if (auto *S =
Ctx.getObjectFileInfo()->getPseudoProbeSection(ProbeSec.first)) {
// Switch to the .pseudoprobe section or a comdat group.
MCOS->SwitchSection(S);
MCOS->switchSection(S);
// Emit probes grouped by GUID.
ProbeSec.second.emit(MCOS, LastProbe);
}

View File

@ -408,7 +408,7 @@ void MCStreamer::emitEHSymAttributes(const MCSymbol *Symbol,
}
void MCStreamer::initSections(bool NoExecStack, const MCSubtargetInfo &STI) {
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
switchSection(getContext().getObjectFileInfo()->getTextSection());
}
void MCStreamer::assignFragment(MCSymbol *Symbol, MCFragment *Fragment) {
@ -739,7 +739,7 @@ void MCStreamer::emitWinCFIEndProc(SMLoc Loc) {
for (size_t I = CurrentProcWinFrameInfoStartIndex, E = WinFrameInfos.size();
I != E; ++I)
emitWindowsUnwindTables(WinFrameInfos[I].get());
SwitchSection(CurFrame->TextSection);
switchSection(CurFrame->TextSection);
}
void MCStreamer::emitWinCFIFuncletOrFuncEnd(SMLoc Loc) {
@ -1222,7 +1222,7 @@ void MCStreamer::emitBundleLock(bool AlignToEnd) {}
void MCStreamer::finishImpl() {}
void MCStreamer::emitBundleUnlock() {}
void MCStreamer::SwitchSection(MCSection *Section, const MCExpr *Subsection) {
void MCStreamer::switchSection(MCSection *Section, const MCExpr *Subsection) {
assert(Section && "Cannot switch to a null section!");
MCSectionSubPair curSection = SectionStack.back().first;
SectionStack.back().second = curSection;
@ -1243,7 +1243,7 @@ MCSymbol *MCStreamer::endSection(MCSection *Section) {
if (Sym->isInSection())
return Sym;
SwitchSection(Section);
switchSection(Section);
emitLabel(Sym);
return Sym;
}

View File

@ -228,14 +228,14 @@ void llvm::Win64EH::UnwindEmitter::Emit(MCStreamer &Streamer) const {
// Emit the unwind info structs first.
for (const auto &CFI : Streamer.getWinFrameInfos()) {
MCSection *XData = Streamer.getAssociatedXDataSection(CFI->TextSection);
Streamer.SwitchSection(XData);
Streamer.switchSection(XData);
::EmitUnwindInfo(Streamer, CFI.get());
}
// Now emit RUNTIME_FUNCTION entries.
for (const auto &CFI : Streamer.getWinFrameInfos()) {
MCSection *PData = Streamer.getAssociatedPDataSection(CFI->TextSection);
Streamer.SwitchSection(PData);
Streamer.switchSection(PData);
EmitRuntimeFunction(Streamer, CFI.get());
}
}
@ -246,7 +246,7 @@ void llvm::Win64EH::UnwindEmitter::EmitUnwindInfo(MCStreamer &Streamer,
// Switch sections (the static function above is meant to be called from
// here and from Emit().
MCSection *XData = Streamer.getAssociatedXDataSection(info->TextSection);
Streamer.SwitchSection(XData);
Streamer.switchSection(XData);
::EmitUnwindInfo(Streamer, info);
}
@ -2227,7 +2227,7 @@ void llvm::Win64EH::ARM64UnwindEmitter::Emit(MCStreamer &Streamer) const {
if (Info->empty())
continue;
MCSection *XData = Streamer.getAssociatedXDataSection(CFI->TextSection);
Streamer.SwitchSection(XData);
Streamer.switchSection(XData);
ARM64EmitUnwindInfo(Streamer, Info);
}
@ -2240,7 +2240,7 @@ void llvm::Win64EH::ARM64UnwindEmitter::Emit(MCStreamer &Streamer) const {
if (!Info->Symbol)
continue;
MCSection *PData = Streamer.getAssociatedPDataSection(CFI->TextSection);
Streamer.SwitchSection(PData);
Streamer.switchSection(PData);
ARMEmitRuntimeFunction(Streamer, Info);
}
}
@ -2255,13 +2255,13 @@ void llvm::Win64EH::ARM64UnwindEmitter::EmitUnwindInfo(MCStreamer &Streamer,
// end hasn't been marked yet, the xdata function length won't cover the
// whole function, only up to this point.
if (!info->FuncletOrFuncEnd) {
Streamer.SwitchSection(info->TextSection);
Streamer.switchSection(info->TextSection);
info->FuncletOrFuncEnd = Streamer.emitCFILabel();
}
// Switch sections (the static function above is meant to be called from
// here and from Emit().
MCSection *XData = Streamer.getAssociatedXDataSection(info->TextSection);
Streamer.SwitchSection(XData);
Streamer.switchSection(XData);
ARM64EmitUnwindInfo(Streamer, info, /* TryPacked = */ !HandlerData);
}
@ -2272,7 +2272,7 @@ void llvm::Win64EH::ARMUnwindEmitter::Emit(MCStreamer &Streamer) const {
if (Info->empty())
continue;
MCSection *XData = Streamer.getAssociatedXDataSection(CFI->TextSection);
Streamer.SwitchSection(XData);
Streamer.switchSection(XData);
ARMEmitUnwindInfo(Streamer, Info);
}
@ -2285,7 +2285,7 @@ void llvm::Win64EH::ARMUnwindEmitter::Emit(MCStreamer &Streamer) const {
if (!Info->Symbol)
continue;
MCSection *PData = Streamer.getAssociatedPDataSection(CFI->TextSection);
Streamer.SwitchSection(PData);
Streamer.switchSection(PData);
ARMEmitRuntimeFunction(Streamer, Info);
}
}
@ -2300,12 +2300,12 @@ void llvm::Win64EH::ARMUnwindEmitter::EmitUnwindInfo(MCStreamer &Streamer,
// end hasn't been marked yet, the xdata function length won't cover the
// whole function, only up to this point.
if (!info->FuncletOrFuncEnd) {
Streamer.SwitchSection(info->TextSection);
Streamer.switchSection(info->TextSection);
info->FuncletOrFuncEnd = Streamer.emitCFILabel();
}
// Switch sections (the static function above is meant to be called from
// here and from Emit().
MCSection *XData = Streamer.getAssociatedXDataSection(info->TextSection);
Streamer.SwitchSection(XData);
Streamer.switchSection(XData);
ARMEmitUnwindInfo(Streamer, info, /* TryPacked = */ !HandlerData);
}

View File

@ -70,16 +70,16 @@ void MCWinCOFFStreamer::initSections(bool NoExecStack,
// FIXME: this is identical to the ELF one.
// This emulates the same behavior of GNU as. This makes it easier
// to compare the output as the major sections are in the same order.
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
switchSection(getContext().getObjectFileInfo()->getTextSection());
emitCodeAlignment(4, &STI);
SwitchSection(getContext().getObjectFileInfo()->getDataSection());
switchSection(getContext().getObjectFileInfo()->getDataSection());
emitCodeAlignment(4, &STI);
SwitchSection(getContext().getObjectFileInfo()->getBSSSection());
switchSection(getContext().getObjectFileInfo()->getBSSSection());
emitCodeAlignment(4, &STI);
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
switchSection(getContext().getObjectFileInfo()->getTextSection());
}
void MCWinCOFFStreamer::emitLabel(MCSymbol *S, SMLoc Loc) {
@ -287,7 +287,7 @@ void MCWinCOFFStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
<< Log2_32_Ceil(ByteAlignment);
pushSection();
SwitchSection(MFI->getDrectveSection());
switchSection(MFI->getDrectveSection());
emitBytes(Directive);
popSection();
}
@ -299,7 +299,7 @@ void MCWinCOFFStreamer::emitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
pushSection();
SwitchSection(Section);
switchSection(Section);
emitValueToAlignment(ByteAlignment, 0, 1, 0);
emitLabel(Symbol);
Symbol->setExternal(false);

View File

@ -378,10 +378,10 @@ void AArch64AsmPrinter::emitHwasanMemaccessSymbols(Module &M) {
bool CompileKernel =
(AccessInfo >> HWASanAccessInfo::CompileKernelShift) & 1;
OutStreamer->SwitchSection(OutContext.getELFSection(
OutStreamer->switchSection(OutContext.getELFSection(
".text.hot", ELF::SHT_PROGBITS,
ELF::SHF_EXECINSTR | ELF::SHF_ALLOC | ELF::SHF_GROUP, 0,
Sym->getName(), /*IsComdat=*/true));
ELF::SHF_EXECINSTR | ELF::SHF_ALLOC | ELF::SHF_GROUP, 0, Sym->getName(),
/*IsComdat=*/true));
OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeFunction);
OutStreamer->emitSymbolAttribute(Sym, MCSA_Weak);
@ -827,7 +827,7 @@ void AArch64AsmPrinter::emitJumpTableInfo() {
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
MCSection *ReadOnlySec = TLOF.getSectionForJumpTable(MF->getFunction(), TM);
OutStreamer->SwitchSection(ReadOnlySec);
OutStreamer->switchSection(ReadOnlySec);
auto AFI = MF->getInfo<AArch64FunctionInfo>();
for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {

View File

@ -76,7 +76,7 @@ void AArch64TargetStreamer::emitNoteSection(unsigned Flags) {
return;
}
MCSection *Cur = OutStreamer.getCurrentSectionOnly();
OutStreamer.SwitchSection(Nt);
OutStreamer.switchSection(Nt);
// Emit the note header.
OutStreamer.emitValueToAlignment(Align(8).value());
@ -92,7 +92,7 @@ void AArch64TargetStreamer::emitNoteSection(unsigned Flags) {
OutStreamer.emitIntValue(0, 4); // pad
OutStreamer.endSection(Nt);
OutStreamer.SwitchSection(Cur);
OutStreamer.switchSection(Cur);
}
void AArch64TargetStreamer::emitInst(uint32_t Inst) {

View File

@ -248,7 +248,7 @@ void AMDGPUAsmPrinter::emitFunctionBodyEnd() {
auto &ReadOnlySection = *ObjectFileInfo.getReadOnlySection();
Streamer.pushSection();
Streamer.SwitchSection(&ReadOnlySection);
Streamer.switchSection(&ReadOnlySection);
// CP microcode requires the kernel descriptor to be allocated on 64 byte
// alignment.
@ -352,7 +352,7 @@ bool AMDGPUAsmPrinter::doFinalization(Module &M) {
if ((AMDGPU::isGFX10Plus(STI) || AMDGPU::isGFX90A(STI)) &&
(STI.getTargetTriple().getOS() == Triple::AMDHSA ||
STI.getTargetTriple().getOS() == Triple::AMDPAL)) {
OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
OutStreamer->switchSection(getObjFileLowering().getTextSection());
getTargetStreamer()->EmitCodeEnd(STI);
}
@ -472,7 +472,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (!STM.isAmdHsaOS() && !STM.isAmdPalOS()) {
MCSectionELF *ConfigSection =
Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
OutStreamer->SwitchSection(ConfigSection);
OutStreamer->switchSection(ConfigSection);
}
if (MFI->isModuleEntryFunction()) {
@ -509,7 +509,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (isVerbose()) {
MCSectionELF *CommentSection =
Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
OutStreamer->SwitchSection(CommentSection);
OutStreamer->switchSection(CommentSection);
if (!MFI->isEntryFunction()) {
OutStreamer->emitRawComment(" Function info:", false);
@ -608,7 +608,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (DumpCodeInstEmitter) {
OutStreamer->SwitchSection(
OutStreamer->switchSection(
Context.getELFSection(".AMDGPU.disasm", ELF::SHT_PROGBITS, 0));
for (size_t i = 0; i < DisasmLines.size(); ++i) {

View File

@ -534,7 +534,7 @@ void AMDGPUTargetELFStreamer::EmitNote(
NoteFlags = ELF::SHF_ALLOC;
S.pushSection();
S.SwitchSection(
S.switchSection(
Context.getELFSection(ElfNote::SectionName, ELF::SHT_NOTE, NoteFlags));
S.emitInt32(NameSZ); // namesz
S.emitValue(DescSZ, 4); // descz

View File

@ -111,7 +111,7 @@ bool R600AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
MCContext &Context = getObjFileLowering().getContext();
MCSectionELF *ConfigSection =
Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
OutStreamer->SwitchSection(ConfigSection);
OutStreamer->switchSection(ConfigSection);
EmitProgramInfoR600(MF);
@ -120,7 +120,7 @@ bool R600AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (isVerbose()) {
MCSectionELF *CommentSection =
Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
OutStreamer->SwitchSection(CommentSection);
OutStreamer->switchSection(CommentSection);
R600MachineFunctionInfo *MFI = MF.getInfo<R600MachineFunctionInfo>();
OutStreamer->emitRawComment(

View File

@ -535,7 +535,7 @@ void ARMAsmPrinter::emitEndOfAsmFile(Module &M) {
if (!Stubs.empty()) {
// Switch with ".non_lazy_symbol_pointer" directive.
OutStreamer->SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
OutStreamer->switchSection(TLOFMacho.getNonLazySymbolPointerSection());
emitAlignment(Align(4));
for (auto &Stub : Stubs)
@ -548,7 +548,7 @@ void ARMAsmPrinter::emitEndOfAsmFile(Module &M) {
Stubs = MMIMacho.GetThreadLocalGVStubList();
if (!Stubs.empty()) {
// Switch with ".non_lazy_symbol_pointer" directive.
OutStreamer->SwitchSection(TLOFMacho.getThreadLocalPointerSection());
OutStreamer->switchSection(TLOFMacho.getThreadLocalPointerSection());
emitAlignment(Align(4));
for (auto &Stub : Stubs)

View File

@ -1163,7 +1163,7 @@ inline void ARMELFStreamer::SwitchToEHSection(StringRef Prefix,
assert(EHSection && "Failed to get the required EH section");
// Switch to .ARM.extab or .ARM.exidx section
SwitchSection(EHSection);
switchSection(EHSection);
emitValueToAlignment(4, 0, 1, 0);
}
@ -1256,7 +1256,7 @@ void ARMELFStreamer::emitFnEnd() {
}
// Switch to the section containing FnStart
SwitchSection(&FnStart->getSection());
switchSection(&FnStart->getSection());
// Clean exception handling frame information
EHReset();

View File

@ -998,7 +998,7 @@ void BTFDebug::emitBTFSection() {
MCContext &Ctx = OS.getContext();
MCSectionELF *Sec = Ctx.getELFSection(".BTF", ELF::SHT_PROGBITS, 0);
Sec->setAlignment(Align(4));
OS.SwitchSection(Sec);
OS.switchSection(Sec);
// Emit header.
emitCommonHeader();
@ -1038,7 +1038,7 @@ void BTFDebug::emitBTFExtSection() {
MCContext &Ctx = OS.getContext();
MCSectionELF *Sec = Ctx.getELFSection(".BTF.ext", ELF::SHT_PROGBITS, 0);
Sec->setAlignment(Align(4));
OS.SwitchSection(Sec);
OS.switchSection(Sec);
// Emit header.
emitCommonHeader();

View File

@ -83,12 +83,12 @@ void CSKYTargetELFStreamer::finishAttributeSection() {
return;
if (AttributeSection) {
Streamer.SwitchSection(AttributeSection);
Streamer.switchSection(AttributeSection);
} else {
MCAssembler &MCA = getStreamer().getAssembler();
AttributeSection = MCA.getContext().getELFSection(
".csky.attributes", ELF::SHT_CSKY_ATTRIBUTES, 0);
Streamer.SwitchSection(AttributeSection);
Streamer.switchSection(AttributeSection);
Streamer.emitInt8(ELFAttrs::Format_Version);
}

View File

@ -25,7 +25,7 @@ void CSKYConstantPool::emitAll(MCStreamer &Streamer) {
return;
if (CurrentSection != nullptr)
Streamer.SwitchSection(CurrentSection);
Streamer.switchSection(CurrentSection);
Streamer.emitDataRegion(MCDR_DataRegion);
for (const ConstantPoolEntry &Entry : Entries) {

View File

@ -1485,7 +1485,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
} else
llvm_unreachable("unexpected type of machine operand!");
MES->SwitchSection(mySection);
MES->switchSection(mySection);
unsigned byteSize = is32bit ? 4 : 8;
getStreamer().emitCodeAlignment(byteSize, &getSTI(), byteSize);

View File

@ -202,7 +202,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI,
MCSectionELF *Section = OutStreamer.getContext().getELFSection(
sectionName, ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
OutStreamer.SwitchSection(Section);
OutStreamer.switchSection(Section);
Sym = AP.OutContext.getOrCreateSymbol(Twine(symbolName));
if (Sym->isUndefined()) {
@ -231,7 +231,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI,
MCSectionELF *Section = OutStreamer.getContext().getELFSection(
".lita", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
OutStreamer.SwitchSection(Section);
OutStreamer.switchSection(Section);
Sym = AP.OutContext.getOrCreateSymbol(Twine(LitaName));
if (Sym->isUndefined()) {
OutStreamer.emitLabel(Sym);
@ -331,7 +331,7 @@ void HexagonAsmPrinter::HexagonProcessInstruction(MCInst &Inst,
MCSymbol *Sym =
smallData(*this, MI, *OutStreamer, Imm, 8, getSubtargetInfo());
OutStreamer->SwitchSection(Current.first, Current.second);
OutStreamer->switchSection(Current.first, Current.second);
MCInst TmpInst;
MCOperand &Reg = MappedInst.getOperand(0);
TmpInst.setOpcode(Hexagon::L2_loadrdgp);
@ -348,7 +348,7 @@ void HexagonAsmPrinter::HexagonProcessInstruction(MCInst &Inst,
MCSectionSubPair Current = OutStreamer->getCurrentSection();
MCSymbol *Sym =
smallData(*this, MI, *OutStreamer, Imm, 4, getSubtargetInfo());
OutStreamer->SwitchSection(Current.first, Current.second);
OutStreamer->switchSection(Current.first, Current.second);
MCInst TmpInst;
MCOperand &Reg = MappedInst.getOperand(0);
TmpInst.setOpcode(Hexagon::L2_loadrigp);

View File

@ -108,7 +108,7 @@ void HexagonMCELFStreamer::HexagonMCEmitCommonSymbol(MCSymbol *Symbol,
MCSection &Section = *getAssembler().getContext().getELFSection(
SectionName, ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
MCSectionSubPair P = getCurrentSection();
SwitchSection(&Section);
switchSection(&Section);
if (ELFSymbol->isUndefined()) {
emitValueToAlignment(ByteAlignment, 0, 1, 0);
@ -120,7 +120,7 @@ void HexagonMCELFStreamer::HexagonMCEmitCommonSymbol(MCSymbol *Symbol,
if (Align(ByteAlignment) > Section.getAlignment())
Section.setAlignment(Align(ByteAlignment));
SwitchSection(P.first, P.second);
switchSection(P.first, P.second);
} else {
if (ELFSymbol->declareCommon(Size, ByteAlignment))
report_fatal_error("Symbol: " + Symbol->getName() +

View File

@ -43,7 +43,7 @@ MSP430TargetELFStreamer::MSP430TargetELFStreamer(MCStreamer &S,
// MSP430 EABI (slaa534.pdf, part 13).
MCSection *AttributeSection = getStreamer().getContext().getELFSection(
".MSP430.attributes", ELF::SHT_MSP430_ATTRIBUTES, 0);
Streamer.SwitchSection(AttributeSection);
Streamer.switchSection(AttributeSection);
// Format version.
Streamer.emitInt8(0x41);

View File

@ -166,11 +166,11 @@ void MSP430AsmPrinter::EmitInterruptVectorSection(MachineFunction &ISR) {
MCSection *IV = OutStreamer->getContext().getELFSection(
"__interrupt_vector_" + IVIdx,
ELF::SHT_PROGBITS, ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
OutStreamer->SwitchSection(IV);
OutStreamer->switchSection(IV);
const MCSymbol *FunctionSymbol = getSymbol(F);
OutStreamer->emitSymbolValue(FunctionSymbol, TM.getProgramPointerSize());
OutStreamer->SwitchSection(Cur);
OutStreamer->switchSection(Cur);
}
bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {

View File

@ -3413,10 +3413,10 @@ bool MipsAsmParser::expandLoadSingleImmToFPR(MCInst &Inst, SMLoc IDLoc,
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
getStreamer().SwitchSection(ReadOnlySection);
getStreamer().switchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
getStreamer().emitInt32(ImmOp32);
getStreamer().SwitchSection(CS);
getStreamer().switchSection(CS);
if (emitPartialAddress(TOut, IDLoc, Sym))
return true;
@ -3465,11 +3465,11 @@ bool MipsAsmParser::expandLoadDoubleImmToGPR(MCInst &Inst, SMLoc IDLoc,
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
getStreamer().SwitchSection(ReadOnlySection);
getStreamer().switchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
getStreamer().emitValueToAlignment(8);
getStreamer().emitIntValue(ImmOp64, 8);
getStreamer().SwitchSection(CS);
getStreamer().switchSection(CS);
unsigned TmpReg = getATReg(IDLoc);
if (!TmpReg)
@ -3548,11 +3548,11 @@ bool MipsAsmParser::expandLoadDoubleImmToFPR(MCInst &Inst, bool Is64FPU,
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
getStreamer().SwitchSection(ReadOnlySection);
getStreamer().switchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
getStreamer().emitValueToAlignment(8);
getStreamer().emitIntValue(ImmOp64, 8);
getStreamer().SwitchSection(CS);
getStreamer().switchSection(CS);
if (emitPartialAddress(TOut, IDLoc, Sym))
return true;
@ -8180,7 +8180,7 @@ bool MipsAsmParser::parseRSectionDirective(StringRef Section) {
MCSection *ELFSection = getContext().getELFSection(
Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
getParser().getStreamer().SwitchSection(ELFSection);
getParser().getStreamer().switchSection(ELFSection);
getParser().Lex(); // Eat EndOfStatement token.
return false;
@ -8198,7 +8198,7 @@ bool MipsAsmParser::parseSSectionDirective(StringRef Section, unsigned Type) {
MCSection *ELFSection = getContext().getELFSection(
Section, Type, ELF::SHF_WRITE | ELF::SHF_ALLOC | ELF::SHF_MIPS_GPREL);
getParser().getStreamer().SwitchSection(ELFSection);
getParser().getStreamer().switchSection(ELFSection);
getParser().Lex(); // Eat EndOfStatement token.
return false;

View File

@ -90,9 +90,9 @@ void MipsELFStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
Labels.push_back(Symbol);
}
void MipsELFStreamer::SwitchSection(MCSection *Section,
void MipsELFStreamer::switchSection(MCSection *Section,
const MCExpr *Subsection) {
MCELFStreamer::SwitchSection(Section, Subsection);
MCELFStreamer::switchSection(Section, Subsection);
Labels.clear();
}

View File

@ -50,7 +50,7 @@ public:
/// Overriding this function allows us to dismiss all labels that are
/// candidates for marking as microMIPS when .section directive is processed.
void SwitchSection(MCSection *Section,
void switchSection(MCSection *Section,
const MCExpr *Subsection = nullptr) override;
/// Overriding these functions allows us to dismiss all labels that are

View File

@ -38,7 +38,7 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1);
MCA.registerSection(*Sec);
Sec->setAlignment(Align(8));
Streamer->SwitchSection(Sec);
Streamer->switchSection(Sec);
Streamer->emitInt8(ELF::ODK_REGINFO); // kind
Streamer->emitInt8(40); // size
@ -56,7 +56,7 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
ELF::SHF_ALLOC, 24);
MCA.registerSection(*Sec);
Sec->setAlignment(MTS->getABI().IsN32() ? Align(8) : Align(4));
Streamer->SwitchSection(Sec);
Streamer->switchSection(Sec);
Streamer->emitInt32(ri_gprmask);
Streamer->emitInt32(ri_cprmask[0]);

View File

@ -914,7 +914,7 @@ void MipsTargetELFStreamer::finish() {
unsigned Alignment = Section.getAlignment();
if (Alignment) {
OS.SwitchSection(&Section);
OS.switchSection(&Section);
if (Section.useCodeAlign())
OS.emitCodeAlignment(Alignment, &STI, Alignment);
else
@ -1028,7 +1028,7 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
OS.pushSection();
OS.SwitchSection(Sec);
OS.switchSection(Sec);
OS.emitValueImpl(ExprRef, 4);
@ -1326,7 +1326,7 @@ void MipsTargetELFStreamer::emitMipsAbiFlags() {
".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24);
MCA.registerSection(*Sec);
Sec->setAlignment(Align(8));
OS.SwitchSection(Sec);
OS.switchSection(Sec);
OS << ABIFlagsSection;
}

View File

@ -798,7 +798,7 @@ void MipsAsmPrinter::emitStartOfAsmFile(Module &M) {
// Tell the assembler which ABI we are using
std::string SectionName = std::string(".mdebug.") + getCurrentABIString();
OutStreamer->SwitchSection(
OutStreamer->switchSection(
OutContext.getELFSection(SectionName, ELF::SHT_PROGBITS, 0));
// NaN: At the moment we only support:
@ -825,7 +825,7 @@ void MipsAsmPrinter::emitStartOfAsmFile(Module &M) {
TS.emitDirectiveModuleOddSPReg();
// Switch to the .text section.
OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
OutStreamer->switchSection(getObjFileLowering().getTextSection());
}
void MipsAsmPrinter::emitInlineAsmStart() const {
@ -1045,7 +1045,7 @@ void MipsAsmPrinter::EmitFPCallStub(
MCSectionELF *M = OutContext.getELFSection(
".mips16.call.fp." + std::string(Symbol), ELF::SHT_PROGBITS,
ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
OutStreamer->SwitchSection(M, nullptr);
OutStreamer->switchSection(M, nullptr);
//
// .align 2
//
@ -1130,7 +1130,7 @@ void MipsAsmPrinter::emitEndOfAsmFile(Module &M) {
EmitFPCallStub(Symbol, Signature);
}
// return to the text section
OutStreamer->SwitchSection(OutContext.getObjectFileInfo()->getTextSection());
OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
}
void MipsAsmPrinter::EmitSled(const MachineInstr &MI, SledKind Kind) {

View File

@ -1585,7 +1585,7 @@ void PPCLinuxAsmPrinter::emitStartOfAsmFile(Module &M) {
if (M.getPICLevel() == PICLevel::SmallPIC)
return AsmPrinter::emitStartOfAsmFile(M);
OutStreamer->SwitchSection(OutContext.getELFSection(
OutStreamer->switchSection(OutContext.getELFSection(
".got2", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC));
MCSymbol *TOCSym = OutContext.getOrCreateSymbol(Twine(".LTOC"));
@ -1602,7 +1602,7 @@ void PPCLinuxAsmPrinter::emitStartOfAsmFile(Module &M) {
OutStreamer->emitAssignment(TOCSym, tocExpr);
OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
OutStreamer->switchSection(getObjFileLowering().getTextSection());
}
void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
@ -1660,7 +1660,7 @@ void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
MCSectionSubPair Current = OutStreamer->getCurrentSection();
MCSectionELF *Section = OutStreamer->getContext().getELFSection(
".opd", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
OutStreamer->SwitchSection(Section);
OutStreamer->switchSection(Section);
OutStreamer->emitLabel(CurrentFnSym);
OutStreamer->emitValueToAlignment(8);
MCSymbol *Symbol1 = CurrentFnSymForSize;
@ -1675,7 +1675,7 @@ void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
8/*size*/);
// Emit a null environment pointer.
OutStreamer->emitIntValue(0, 8 /* size */);
OutStreamer->SwitchSection(Current.first, Current.second);
OutStreamer->switchSection(Current.first, Current.second);
}
void PPCLinuxAsmPrinter::emitEndOfAsmFile(Module &M) {
@ -1692,7 +1692,7 @@ void PPCLinuxAsmPrinter::emitEndOfAsmFile(Module &M) {
const char *Name = isPPC64 ? ".toc" : ".got2";
MCSectionELF *Section = OutContext.getELFSection(
Name, ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
OutStreamer->SwitchSection(Section);
OutStreamer->switchSection(Section);
if (!isPPC64)
OutStreamer->emitValueToAlignment(4);
@ -1964,7 +1964,7 @@ void PPCAIXAsmPrinter::emitFunctionBodyEnd() {
if (!TargetLoweringObjectFileXCOFF::ShouldEmitEHBlock(MF) &&
(getNumberOfVRSaved() > 0)) {
// Emit dummy EH Info Table.
OutStreamer->SwitchSection(getObjFileLowering().getCompactUnwindSection());
OutStreamer->switchSection(getObjFileLowering().getCompactUnwindSection());
MCSymbol *EHInfoLabel =
TargetLoweringObjectFileXCOFF::getEHInfoTableSymbol(MF);
OutStreamer->emitLabel(EHInfoLabel);
@ -1979,7 +1979,7 @@ void PPCAIXAsmPrinter::emitFunctionBodyEnd() {
OutStreamer->emitIntValue(0, PointerSize);
OutStreamer->emitIntValue(0, PointerSize);
OutStreamer->SwitchSection(MF->getSection());
OutStreamer->switchSection(MF->getSection());
}
}
@ -2400,7 +2400,7 @@ void PPCAIXAsmPrinter::emitGlobalVariableHelper(const GlobalVariable *GV) {
getObjFileLowering().SectionForGlobal(GV, GVKind, TM));
// Switch to the containing csect.
OutStreamer->SwitchSection(Csect);
OutStreamer->switchSection(Csect);
const DataLayout &DL = GV->getParent()->getDataLayout();
@ -2444,7 +2444,7 @@ void PPCAIXAsmPrinter::emitFunctionDescriptor() {
MCSectionSubPair Current = OutStreamer->getCurrentSection();
// Emit function descriptor.
OutStreamer->SwitchSection(
OutStreamer->switchSection(
cast<MCSymbolXCOFF>(CurrentFnDescSym)->getRepresentedCsect());
// Emit aliasing label for function descriptor csect.
@ -2463,7 +2463,7 @@ void PPCAIXAsmPrinter::emitFunctionDescriptor() {
// Emit a null environment pointer.
OutStreamer->emitIntValue(0, PointerSize);
OutStreamer->SwitchSection(Current.first, Current.second);
OutStreamer->switchSection(Current.first, Current.second);
}
void PPCAIXAsmPrinter::emitFunctionEntryLabel() {
@ -2487,7 +2487,7 @@ void PPCAIXAsmPrinter::emitPGORefs() {
XCOFF::CsectProperties(XCOFF::XMC_RW, XCOFF::XTY_SD),
/*MultiSymbolsAllowed*/ true);
OutStreamer->SwitchSection(CntsSection);
OutStreamer->switchSection(CntsSection);
if (OutContext.hasXCOFFSection(
"__llvm_prf_data",
XCOFF::CsectProperties(XCOFF::XMC_RW, XCOFF::XTY_SD)))
@ -2512,7 +2512,7 @@ void PPCAIXAsmPrinter::emitEndOfAsmFile(Module &M) {
emitPGORefs();
// Switch to section to emit TOC base.
OutStreamer->SwitchSection(getObjFileLowering().getTOCBaseSection());
OutStreamer->switchSection(getObjFileLowering().getTOCBaseSection());
PPCTargetStreamer *TS =
static_cast<PPCTargetStreamer *>(OutStreamer->getTargetStreamer());
@ -2534,7 +2534,7 @@ void PPCAIXAsmPrinter::emitEndOfAsmFile(Module &M) {
TCEntry = cast<MCSectionXCOFF>(
getObjFileLowering().getSectionForTOCEntry(I.first.first, TM));
}
OutStreamer->SwitchSection(TCEntry);
OutStreamer->switchSection(TCEntry);
OutStreamer->emitLabel(I.second);
if (TS != nullptr)

View File

@ -73,12 +73,12 @@ void RISCVTargetELFStreamer::finishAttributeSection() {
return;
if (AttributeSection) {
Streamer.SwitchSection(AttributeSection);
Streamer.switchSection(AttributeSection);
} else {
MCAssembler &MCA = getStreamer().getAssembler();
AttributeSection = MCA.getContext().getELFSection(
".riscv.attributes", ELF::SHT_RISCV_ATTRIBUTES, 0);
Streamer.SwitchSection(AttributeSection);
Streamer.switchSection(AttributeSection);
Streamer.emitInt8(ELFAttrs::Format_Version);
}

View File

@ -194,7 +194,7 @@ void SystemZTargetStreamer::emitConstantPools() {
return;
// Switch to the .text section.
const MCObjectFileInfo &OFI = *Streamer.getContext().getObjectFileInfo();
Streamer.SwitchSection(OFI.getTextSection());
Streamer.switchSection(OFI.getTextSection());
for (auto &I : EXRLTargets2Sym) {
Streamer.emitLabel(I.second);
const MCInstSTIPair &MCI_STI = I.first;

View File

@ -642,7 +642,7 @@ void SystemZAsmPrinter::LowerFENTRY_CALL(const MachineInstr &MI,
if (MF->getFunction().hasFnAttribute("mrecord-mcount")) {
MCSymbol *DotSym = OutContext.createTempSymbol();
OutStreamer->pushSection();
OutStreamer->SwitchSection(
OutStreamer->switchSection(
Ctx.getELFSection("__mcount_loc", ELF::SHT_PROGBITS, ELF::SHF_ALLOC));
OutStreamer->emitSymbolValue(DotSym, 8);
OutStreamer->popSection();
@ -827,7 +827,7 @@ void SystemZAsmPrinter::emitFunctionBodyEnd() {
OutStreamer->emitLabel(FnEndSym);
OutStreamer->pushSection();
OutStreamer->SwitchSection(getObjFileLowering().getPPA1Section());
OutStreamer->switchSection(getObjFileLowering().getPPA1Section());
emitPPA1(FnEndSym);
OutStreamer->popSection();

View File

@ -1096,7 +1096,7 @@ public:
auto *WS =
getContext().getWasmSection(SecName, SectionKind::getText(), 0, Group,
MCContext::GenericSectionID, nullptr);
getStreamer().SwitchSection(WS);
getStreamer().switchSection(WS);
// Also generate DWARF for this section if requested.
if (getContext().getGenDwarfForAssembly())
getContext().addGenDwarfSection(WS);

View File

@ -430,7 +430,7 @@ void WebAssemblyAsmPrinter::emitEndOfAsmFile(Module &M) {
std::string SectionName = (".custom_section." + Name->getString()).str();
MCSectionWasm *MySection =
OutContext.getWasmSection(SectionName, SectionKind::getMetadata());
OutStreamer->SwitchSection(MySection);
OutStreamer->switchSection(MySection);
OutStreamer->emitBytes(Contents->getString());
OutStreamer->popSection();
}
@ -471,7 +471,7 @@ void WebAssemblyAsmPrinter::EmitProducerInfo(Module &M) {
MCSectionWasm *Producers = OutContext.getWasmSection(
".custom_section.producers", SectionKind::getMetadata());
OutStreamer->pushSection();
OutStreamer->SwitchSection(Producers);
OutStreamer->switchSection(Producers);
OutStreamer->emitULEB128IntValue(FieldCount);
for (auto &Producers : {std::make_pair("language", &Languages),
std::make_pair("processed-by", &Tools)}) {
@ -544,7 +544,7 @@ void WebAssemblyAsmPrinter::EmitTargetFeatures(Module &M) {
MCSectionWasm *FeaturesSection = OutContext.getWasmSection(
".custom_section.target_features", SectionKind::getMetadata());
OutStreamer->pushSection();
OutStreamer->SwitchSection(FeaturesSection);
OutStreamer->switchSection(FeaturesSection);
OutStreamer->emitULEB128IntValue(EmittedFeatures.size());
for (auto &F : EmittedFeatures) {

View File

@ -681,7 +681,7 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
MCSection *Cur = OutStreamer->getCurrentSectionOnly();
MCSection *Nt = MMI->getContext().getELFSection(
".note.gnu.property", ELF::SHT_NOTE, ELF::SHF_ALLOC);
OutStreamer->SwitchSection(Nt);
OutStreamer->switchSection(Nt);
// Emitting note header.
const int WordSize = TT.isArch64Bit() && !TT.isX32() ? 8 : 4;
@ -698,12 +698,12 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
emitAlignment(WordSize == 4 ? Align(4) : Align(8)); // padding
OutStreamer->endSection(Nt);
OutStreamer->SwitchSection(Cur);
OutStreamer->switchSection(Cur);
}
}
if (TT.isOSBinFormatMachO())
OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
OutStreamer->switchSection(getObjFileLowering().getTextSection());
if (TT.isOSBinFormatCOFF()) {
// Emit an absolute @feat.00 symbol. This appears to be some kind of
@ -779,7 +779,7 @@ static void emitNonLazyStubs(MachineModuleInfo *MMI, MCStreamer &OutStreamer) {
// Output stubs for external and common global variables.
Stubs = MMIMacho.GetGVStubList();
if (!Stubs.empty()) {
OutStreamer.SwitchSection(MMI->getContext().getMachOSection(
OutStreamer.switchSection(MMI->getContext().getMachOSection(
"__IMPORT", "__pointers", MachO::S_NON_LAZY_SYMBOL_POINTERS,
SectionKind::getMetadata()));
@ -843,7 +843,7 @@ void X86AsmPrinter::emitEndOfAsmFile(Module &M) {
MCSection *ReadOnlySection = getObjFileLowering().getSectionForConstant(
getDataLayout(), SectionKind::getReadOnly(),
/*C=*/nullptr, Alignment);
OutStreamer->SwitchSection(ReadOnlySection);
OutStreamer->switchSection(ReadOnlySection);
OutStreamer->emitLabel(AddrSymbol);
unsigned PtrSize = MAI->getCodePointerSize();

View File

@ -110,7 +110,7 @@ void XCoreAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
return;
const DataLayout &DL = getDataLayout();
OutStreamer->SwitchSection(getObjFileLowering().SectionForGlobal(GV, TM));
OutStreamer->switchSection(getObjFileLowering().SectionForGlobal(GV, TM));
MCSymbol *GVSym = getSymbol(GV);
const Constant *C = GV->getInitializer();

View File

@ -59,7 +59,7 @@ protected:
MCSection *Sec =
TestPrinter->getCtx().getELFSection(".tst", ELF::SHT_PROGBITS, 0);
SecBeginSymbol = Sec->getBeginSymbol();
TestPrinter->getMS().SwitchSection(Sec);
TestPrinter->getMS().switchSection(Sec);
Val->setFragment(&Sec->getDummyFragment());
return true;

View File

@ -1961,10 +1961,10 @@ TEST(DWARFDebugInfo, TestErrorReporting) {
MCContext *MC = DG->getMCContext();
// Emit two compressed sections with broken headers.
AP->OutStreamer->SwitchSection(
AP->OutStreamer->switchSection(
MC->getELFSection(".zdebug_foo", 0 /*Type*/, 0 /*Flags*/));
AP->OutStreamer->emitBytes("0");
AP->OutStreamer->SwitchSection(
AP->OutStreamer->switchSection(
MC->getELFSection(".zdebug_bar", 0 /*Type*/, 0 /*Flags*/));
AP->OutStreamer->emitBytes("0");

View File

@ -135,7 +135,7 @@ SmallString<0> DWARFExpressionCopyBytesTest::emitObjFile(StringRef ExprBytes) {
C.Streamer->initSections(false, *STI);
MCSection *Section = C.MOFI->getTextSection();
Section->setHasInstructions(true);
C.Streamer->SwitchSection(Section);
C.Streamer->switchSection(Section);
C.Streamer->emitCFIStartProc(true);
auto Str = EncodeDefCfaExpr(ExprBytes);
C.Streamer->emitCFIEscape(Str);

View File

@ -521,7 +521,7 @@ StringRef dwarfgen::Generator::generate() {
StringPool->emit(*Asm, TLOF->getDwarfStrSection(),
TLOF->getDwarfStrOffSection());
MS->SwitchSection(TLOF->getDwarfInfoSection());
MS->switchSection(TLOF->getDwarfInfoSection());
for (auto &CU : CompileUnits) {
uint16_t Version = CU->getVersion();
auto Length = CU->getLength();
@ -540,7 +540,7 @@ StringRef dwarfgen::Generator::generate() {
Asm->emitDwarfDIE(*CU->getUnitDIE().Die);
}
MS->SwitchSection(TLOF->getDwarfLineSection());
MS->switchSection(TLOF->getDwarfLineSection());
for (auto &LT : LineTables)
LT->generate(*MC, *Asm);

View File

@ -101,7 +101,7 @@ public:
// Create a mock function
MCSection *Section = C.MOFI->getTextSection();
Section->setHasInstructions(true);
TheStreamer->SwitchSection(Section);
TheStreamer->switchSection(Section);
TheStreamer->emitCFIStartProc(true);
// Create a mock dwarfloc
@ -115,7 +115,7 @@ public:
TheStreamer->emitCFIEndProc();
// Start emission of .debug_line
TheStreamer->SwitchSection(C.MOFI->getDwarfLineSection());
TheStreamer->switchSection(C.MOFI->getDwarfLineSection());
MCDwarfLineTableHeader Header;
MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams();
Optional<MCDwarfLineStr> LineStr(None);
@ -133,7 +133,7 @@ public:
TheStreamer->emitLabel(LineEndSym);
if (LineStr) {
SmallString<0> Data = LineStr->getFinalizedData();
TheStreamer->SwitchSection(TheStreamer->getContext()
TheStreamer->switchSection(TheStreamer->getContext()
.getObjectFileInfo()
->getDwarfLineStrSection());
TheStreamer->emitBinaryData(Data.str());