diff options
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/MC/ConstantPools.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/MC/MCAsmStreamer.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/COFFAsmParser.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/DarwinAsmParser.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 4 |
11 files changed, 29 insertions, 30 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index da5fca8e418..a4cd4d74c3d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -157,7 +157,7 @@ void AsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) { /// getCurrentSection() - Return the current section we are emitting to. const MCSection *AsmPrinter::getCurrentSection() const { - return OutStreamer->getCurrentSection().first; + return OutStreamer->getCurrentSectionOnly(); } void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/llvm/lib/MC/ConstantPools.cpp b/llvm/lib/MC/ConstantPools.cpp index 17a23d063b7..c52eec38090 100644 --- a/llvm/lib/MC/ConstantPools.cpp +++ b/llvm/lib/MC/ConstantPools.cpp @@ -79,7 +79,7 @@ void AssemblerConstantPools::emitAll(MCStreamer &Streamer) { } void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) { - MCSection *Section = Streamer.getCurrentSection().first; + MCSection *Section = Streamer.getCurrentSectionOnly(); if (ConstantPool *CP = getConstantPool(Section)) { emitConstantPool(Streamer, Section, *CP); } @@ -88,7 +88,7 @@ void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) { const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer, const MCExpr *Expr, unsigned Size, SMLoc Loc) { - MCSection *Section = Streamer.getCurrentSection().first; + MCSection *Section = Streamer.getCurrentSectionOnly(); return getOrCreateConstantPool(Section).addEntry(Expr, Streamer.getContext(), Size, Loc); } diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index 7b1c59f1c04..e83a62c9a35 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -749,7 +749,7 @@ static void PrintQuotedString(StringRef Data, raw_ostream &OS) { } void MCAsmStreamer::EmitBytes(StringRef Data) { - assert(getCurrentSection().first && + assert(getCurrentSectionOnly() && "Cannot emit contents before setting section!"); if (Data.empty()) return; @@ -794,7 +794,7 @@ void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size) { void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) { assert(Size <= 8 && "Invalid size"); - assert(getCurrentSection().first && + assert(getCurrentSectionOnly() && "Cannot emit contents before setting section!"); const char *Directive = nullptr; switch (Size) { @@ -1580,8 +1580,9 @@ void MCAsmStreamer::AddEncodingComment(const MCInst &Inst, } } -void MCAsmStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) { - assert(getCurrentSection().first && +void MCAsmStreamer::EmitInstruction(const MCInst &Inst, + const MCSubtargetInfo &STI) { + assert(getCurrentSectionOnly() && "Cannot emit contents before setting section!"); // Show the encoding in a comment if we have a code emitter. diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index ed27eae87ff..a7551a3283a 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -917,7 +917,7 @@ void MCGenDwarfLabelEntry::Make(MCSymbol *Symbol, MCStreamer *MCOS, MCContext &context = MCOS->getContext(); // We won't create dwarf labels for symbols in sections that we are not // generating debug info for. - if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSection().first)) + if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSectionOnly())) return; // The dwarf label's name does not have the symbol name's leading diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index f4cb09494d0..123295da15a 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -128,7 +128,7 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, flushPendingLabels(DF, DF->getContents().size()); MCCVLineEntry::Make(this); - MCDwarfLineEntry::Make(this, getCurrentSection().first); + MCDwarfLineEntry::Make(this, getCurrentSectionOnly()); // Avoid fixups when possible. int64_t AbsValue; @@ -236,7 +236,7 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst, // Now that a machine instruction has been assembled into this section, make // a line entry for any .loc directive that has been seen. MCCVLineEntry::Make(this); - MCDwarfLineEntry::Make(this, getCurrentSection().first); + MCDwarfLineEntry::Make(this, getCurrentSectionOnly()); // If this instruction doesn't need relaxation, just emit it as data. MCAssembler &Assembler = getAssembler(); @@ -305,7 +305,7 @@ void MCObjectStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line, StringRef FileName) { // In case we see two .loc directives in a row, make sure the // first one gets a line entry. - MCDwarfLineEntry::Make(this, getCurrentSection().first); + MCDwarfLineEntry::Make(this, getCurrentSectionOnly()); this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags, Isa, Discriminator, FileName); @@ -413,7 +413,7 @@ void MCObjectStreamer::EmitCVFileChecksumsDirective() { void MCObjectStreamer::EmitBytes(StringRef Data) { MCCVLineEntry::Make(this); - MCDwarfLineEntry::Make(this, getCurrentSection().first); + MCDwarfLineEntry::Make(this, getCurrentSectionOnly()); MCDataFragment *DF = getOrCreateDataFragment(); flushPendingLabels(DF, DF->getContents().size()); DF->getContents().append(Data.begin(), Data.end()); @@ -428,7 +428,7 @@ void MCObjectStreamer::EmitValueToAlignment(unsigned ByteAlignment, insert(new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit)); // Update the maximum alignment on the current section if necessary. - MCSection *CurSec = getCurrentSection().first; + MCSection *CurSec = getCurrentSectionOnly(); if (ByteAlignment > CurSec->getAlignment()) CurSec->setAlignment(ByteAlignment); } @@ -530,9 +530,7 @@ bool MCObjectStreamer::EmitRelocDirective(const MCExpr &Offset, StringRef Name, } void MCObjectStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) { - const MCSection *Sec = getCurrentSection().first; - (void)Sec; - assert(Sec && "need a section"); + assert(getCurrentSectionOnly() && "need a section"); insert(new MCFillFragment(FillValue, NumBytes)); } diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index e817a8fa57d..c7e0e1f4597 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -733,7 +733,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { // If we are generating dwarf for assembly source files save the initial text // section and generate a .file directive. if (getContext().getGenDwarfForAssembly()) { - MCSection *Sec = getStreamer().getCurrentSection().first; + MCSection *Sec = getStreamer().getCurrentSectionOnly(); if (!Sec->getBeginSymbol()) { MCSymbol *SectionStartSym = getContext().createTempSymbol(); getStreamer().EmitLabel(SectionStartSym); @@ -829,7 +829,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { } bool AsmParser::checkForValidSection() { - if (!ParsingInlineAsm && !getStreamer().getCurrentSection().first) { + if (!ParsingInlineAsm && !getStreamer().getCurrentSectionOnly()) { Out.InitSections(false); return Error(getTok().getLoc(), "expected section directive before assembly directive"); @@ -2014,7 +2014,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info, // directive for the instruction. if (!ParseHadError && getContext().getGenDwarfForAssembly() && getContext().getGenDwarfSectionSyms().count( - getStreamer().getCurrentSection().first)) { + getStreamer().getCurrentSectionOnly())) { unsigned Line; if (ActiveMacros.empty()) Line = SrcMgr.FindLineNumber(IDLoc, CurBuffer); @@ -3109,7 +3109,7 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) { // Check whether we should use optimal code alignment for this .align // directive. - const MCSection *Section = getStreamer().getCurrentSection().first; + const MCSection *Section = getStreamer().getCurrentSectionOnly(); assert(Section && "must have section to emit alignment"); bool UseCodeAlign = Section->UseCodeAlign(); if ((!HasFillExpr || Lexer.getMAI().getTextAlignFillValue() == FillExpr) && diff --git a/llvm/lib/MC/MCParser/COFFAsmParser.cpp b/llvm/lib/MC/MCParser/COFFAsmParser.cpp index 5bb5d98ccc9..2c9f9eb0cda 100644 --- a/llvm/lib/MC/MCParser/COFFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFAsmParser.cpp @@ -525,8 +525,8 @@ bool COFFAsmParser::ParseDirectiveLinkOnce(StringRef, SMLoc Loc) { if (parseCOMDATType(Type)) return true; - const MCSectionCOFF *Current = static_cast<const MCSectionCOFF*>( - getStreamer().getCurrentSection().first); + const MCSectionCOFF *Current = + static_cast<const MCSectionCOFF *>(getStreamer().getCurrentSectionOnly()); if (Type == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) return Error(Loc, "cannot make section associative with .linkonce"); diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp index 063b4a6f895..4eee39cf872 100644 --- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp +++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp @@ -468,8 +468,8 @@ bool DarwinAsmParser::parseDirectiveDesc(StringRef, SMLoc) { /// parseDirectiveIndirectSymbol /// ::= .indirect_symbol identifier bool DarwinAsmParser::parseDirectiveIndirectSymbol(StringRef, SMLoc Loc) { - const MCSectionMachO *Current = static_cast<const MCSectionMachO*>( - getStreamer().getCurrentSection().first); + const MCSectionMachO *Current = static_cast<const MCSectionMachO *>( + getStreamer().getCurrentSectionOnly()); MachO::SectionType SectionType = Current->getType(); if (SectionType != MachO::S_NON_LAZY_SYMBOL_POINTERS && SectionType != MachO::S_LAZY_SYMBOL_POINTERS && diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 124a1911a9a..e0b5310bfea 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -292,7 +292,7 @@ void MCStreamer::AssignFragment(MCSymbol *Symbol, MCFragment *Fragment) { void MCStreamer::EmitLabel(MCSymbol *Symbol) { assert(!Symbol->isVariable() && "Cannot emit a variable symbol!"); - assert(getCurrentSection().first && "Cannot emit before setting section!"); + assert(getCurrentSectionOnly() && "Cannot emit before setting section!"); assert(!Symbol->getFragment() && "Unexpected fragment on symbol data!"); Symbol->setFragment(&getCurrentSectionOnly()->getDummyFragment()); diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 8c9318b4061..90da11580e8 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -10106,7 +10106,7 @@ bool ARMAsmParser::parseDirectiveLtorg(SMLoc L) { } bool ARMAsmParser::parseDirectiveEven(SMLoc L) { - const MCSection *Section = getStreamer().getCurrentSection().first; + const MCSection *Section = getStreamer().getCurrentSectionOnly(); if (getLexer().isNot(AsmToken::EndOfStatement)) { TokError("unexpected token in directive"); @@ -10115,7 +10115,7 @@ bool ARMAsmParser::parseDirectiveEven(SMLoc L) { if (!Section) { getStreamer().InitSections(false); - Section = getStreamer().getCurrentSection().first; + Section = getStreamer().getCurrentSectionOnly(); } assert(Section && "must have section to emit alignment"); @@ -10369,7 +10369,7 @@ bool ARMAsmParser::parseDirectiveAlign(SMLoc L) { return true; // '.align' is target specifically handled to mean 2**2 byte alignment. - const MCSection *Section = getStreamer().getCurrentSection().first; + const MCSection *Section = getStreamer().getCurrentSectionOnly(); assert(Section && "must have section to emit alignment"); if (Section->UseCodeAlign()) getStreamer().EmitCodeAlignment(4, 0); diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 539cda2c8c7..373cdf964d8 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -2972,14 +2972,14 @@ bool X86AsmParser::ParseDirective(AsmToken DirectiveID) { /// parseDirectiveEven /// ::= .even bool X86AsmParser::parseDirectiveEven(SMLoc L) { - const MCSection *Section = getStreamer().getCurrentSection().first; if (getLexer().isNot(AsmToken::EndOfStatement)) { TokError("unexpected token in directive"); return false; } + const MCSection *Section = getStreamer().getCurrentSectionOnly(); if (!Section) { getStreamer().InitSections(false); - Section = getStreamer().getCurrentSection().first; + Section = getStreamer().getCurrentSectionOnly(); } if (Section->UseCodeAlign()) getStreamer().EmitCodeAlignment(2, 0); |