コード例 #1
0
/// finalizeDwarfSections - Emit end symbols for each non-empty code section.
/// Also remove empty sections from SectionStartEndSyms, to avoid generating
/// useless debug info for them.
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
  MCContext &context = MCOS.getContext();

  auto sec = SectionStartEndSyms.begin();
  while (sec != SectionStartEndSyms.end()) {
    assert(sec->second.first && "Start symbol must be set by now");
    MCOS.SwitchSection(sec->first);
    if (MCOS.mayHaveInstructions()) {
      MCSymbol *SectionEndSym = context.CreateTempSymbol();
      MCOS.EmitLabel(SectionEndSym);
      sec->second.second = SectionEndSym;
      ++sec;
    } else {
      MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> >::iterator
        to_erase = sec;
      sec = SectionStartEndSyms.erase(to_erase);
    }
  }
}
コード例 #2
0
ファイル: MCContext.cpp プロジェクト: 2asoft/freebsd
/// Remove empty sections from SectionStartEndSyms, to avoid generating
/// useless debug info for them.
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
  SectionsForRanges.remove_if(
      [&](MCSection *Sec) { return !MCOS.mayHaveInstructions(*Sec); });
}