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 Tidy up. Trailing whitespace. 2012-05-11 01:39:13 +00:00
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 Aligned bundling support. Following the discussion here: 2012-12-20 19:05:53 +00:00
MCAssembler.h Simplify the code a bit: MCRelaxableFragment doesn't need a separate getInstSize 2013-01-08 22:05:10 +00:00
MCAtom.h MCAtom extending methods need to extend the range of the atom as well. 2011-10-10 18:09:38 +00:00
MCCodeEmitter.h Add more reset methods to make all objects that the backend may use for outputting code have a reset, some are not used but were declared for completeness 2012-12-14 18:52:11 +00:00
MCCodeGenInfo.h Fix typo in comment. 2012-02-17 16:39:47 +00:00
MCContext.h Add support for passing -main-file-name all the way through to 2012-12-18 00:31:01 +00:00
MCDirectives.h Refactor data-in-code annotations. 2012-05-18 19:12:01 +00:00
MCDisassembler.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCDwarf.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCELF.h Added Mapping Symbols for ARM ELF 2012-12-07 16:50:23 +00:00
MCELFObjectWriter.h Add 'const' qualifier on member functions not changing its fields. 2012-10-25 18:35:04 +00:00
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 This patch improves the 64-bit PowerPC InitialExec TLS support by providing 2012-12-14 17:02:38 +00:00
MCFixedLenDisassembler.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCFixup.h Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
MCFixupKindInfo.h Tidy up. Trailing whitespace. 2012-05-11 01:39:13 +00:00
MCInst.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCInstBuilder.h Decouple MCInstBuilder from the streamer per Eli's request. 2012-11-26 18:05:52 +00:00
MCInstPrinter.h Try to unbreak the build on hosts that don't transitively pull in a definition for int64_t. 2012-12-05 18:31:11 +00:00
MCInstrAnalysis.h Use the correct predicate for determining if a branch is conditional or not. 2011-10-17 21:21:44 +00:00
MCInstrDesc.h Resort the #include lines in include/... and lib/... with the 2013-01-02 10:22:59 +00:00
MCInstrInfo.h Revert r152202: "Use uint16_t to store InstrNameIndices in MCInstrInfo." 2012-03-15 18:05:57 +00:00
MCInstrItineraries.h I'm introducing a new machine model to simultaneously allow simple 2012-07-07 04:00:00 +00:00
MCLabel.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCMachObjectWriter.h llvm/MC/MCMachObjectWriter.h: ComputeSymbolTable(): Prune one description in the comment. [-Wdocumentation] 2012-12-24 01:24:04 +00:00
MCMachOSymbolFlags.h MC/Mach-O/Thumb: Set the thumb bit in the symbol table. 2010-12-29 14:14:06 +00:00
MCModule.h Start stubbing out MCModule and MCAtom, which provide an API for accessing the rich disassembly of a complete object or executable. 2011-09-22 22:32:22 +00:00
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 Add more reset methods to make all objects that the backend may use for outputting code have a reset, some are not used but were declared for completeness 2012-12-14 18:52:11 +00:00
MCRegisterInfo.h Add a missing assertion, the null register has no register units. 2012-12-21 18:38:09 +00:00
MCSchedule.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCSection.h Add a way of printing out an arbitrary label name for a section 2012-12-13 03:00:35 +00:00
MCSectionCOFF.h Add a way of printing out an arbitrary label name for a section 2012-12-13 03:00:35 +00:00
MCSectionELF.h Resort the #include lines in include/... and lib/... with the 2013-01-02 10:22:59 +00:00
MCSectionMachO.h Add a way of printing out an arbitrary label name for a section 2012-12-13 03:00:35 +00:00
MCStreamer.h Expose an InitToTextSection through MCStreamer. 2013-01-14 19:04:57 +00:00
MCSubtargetInfo.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCSymbol.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCTargetAsmParser.h [ms-inline asm] Add support for the TYPE operator. 2012-10-26 18:04:20 +00:00
MCValue.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCWin64EH.h Add a parameter to the Win64 EH section getters to get a section with a 2011-05-27 19:09:24 +00:00
MCWinCOFFObjectWriter.h Use the new script to sort the includes of every file under lib. 2012-12-03 16:50:05 +00:00
SectionKind.h
SubtargetFeature.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00