llvm-6502/include/llvm/MC
Eli Bendersky 030f63a397 Expose an InitToTextSection through MCStreamer.
The aim of this patch is to fix the following piece of code in the
platform-independent AsmParser:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.SwitchSection(Ctx.getMachOSection(
                        "__TEXT", "__text",
                        MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
                        0, SectionKind::getText()));
  }
}

This was added for the "-n" option of llvm-mc.

The proposed fix adds another virtual method to MCStreamer, called
InitToTextSection. Conceptually, it's similar to the existing
InitSections which initializes all common sections and switches to
text. The new method is implemented by each platform streamer in a way
that it sees fit. So AsmParser can now do this:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.InitToTextSection();
  }
}

Which is much more reasonable.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172450 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 19:04:57 +00:00
..
MCParser Move ParseMacroArgument to the MCAsmParser interfance. 2013-01-14 19:00:26 +00:00
MachineLocation.h
MCAsmBackend.h Renamed MCInstFragment to MCRelaxableFragment and added some comments. 2013-01-08 00:22:56 +00:00
MCAsmInfo.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCAsmInfoCOFF.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCAsmInfoDarwin.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCAsmLayout.h
MCAssembler.h Simplify the code a bit: MCRelaxableFragment doesn't need a separate getInstSize 2013-01-08 22:05:10 +00:00
MCAtom.h
MCCodeEmitter.h
MCCodeGenInfo.h
MCContext.h
MCDirectives.h
MCDisassembler.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCDwarf.h
MCELF.h
MCELFObjectWriter.h
MCELFStreamer.h Expose an InitToTextSection through MCStreamer. 2013-01-14 19:04:57 +00:00
MCELFSymbolFlags.h sets bit 0 of the function address of thumb function in .symtab 2011-05-16 16:17:21 +00:00
MCExpr.h
MCFixedLenDisassembler.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCFixup.h
MCFixupKindInfo.h
MCInst.h
MCInstBuilder.h
MCInstPrinter.h
MCInstrAnalysis.h
MCInstrDesc.h
MCInstrInfo.h
MCInstrItineraries.h
MCLabel.h
MCMachObjectWriter.h
MCMachOSymbolFlags.h
MCModule.h
MCObjectFileInfo.h Add section information for the DWARF5 split debug proposal 2013-01-04 17:59:22 +00:00
MCObjectStreamer.h These functions have default arguments of 0 for the last arg. Use 2013-01-09 01:35:34 +00:00
MCObjectWriter.h
MCRegisterInfo.h
MCSchedule.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCSection.h
MCSectionCOFF.h
MCSectionELF.h
MCSectionMachO.h
MCStreamer.h Expose an InitToTextSection through MCStreamer. 2013-01-14 19:04:57 +00:00
MCSubtargetInfo.h
MCSymbol.h
MCTargetAsmParser.h [ms-inline asm] Add support for the TYPE operator. 2012-10-26 18:04:20 +00:00
MCValue.h
MCWin64EH.h
MCWinCOFFObjectWriter.h
SectionKind.h
SubtargetFeature.h