summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-05-21 16:52:32 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-05-21 16:52:32 +0000
commite07467901bd01aab87614890ef240e19f4ff3f4b (patch)
treec0ac8cb4ec60de1c50b619323a19a0166819293d /llvm/lib/MC/MCContext.cpp
parentcc672026cb37aefe6bd5fa6a0ba32e034345017d (diff)
downloadbcm5719-llvm-e07467901bd01aab87614890ef240e19f4ff3f4b.tar.gz
bcm5719-llvm-e07467901bd01aab87614890ef240e19f4ff3f4b.zip
Remove yet another method of creating begin and end symbol for sections.
I missed this one when first unifying how we handle begin and end symbols. llvm-svn: 237912
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r--llvm/lib/MC/MCContext.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 0a13c9e6edb..bbff9b7c6a5 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -77,7 +77,7 @@ void MCContext::reset() {
CompilationDir.clear();
MainFileName.clear();
MCDwarfLineTablesCUMap.clear();
- SectionStartEndSyms.clear();
+ SectionsForRanges.clear();
MCGenDwarfLabelEntries.clear();
DwarfDebugFlags = StringRef();
DwarfCompileUnitID = 0;
@@ -437,27 +437,17 @@ bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
return !MCDwarfFiles[FileNumber].Name.empty();
}
-/// finalizeDwarfSections - Emit end symbols for each non-empty code section.
-/// Also remove empty sections from SectionStartEndSyms, to avoid generating
+/// 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);
- }
+ std::vector<const MCSection *> Keep;
+ for (const MCSection *Sec : SectionsForRanges) {
+ MCOS.SwitchSection(Sec); // FIXME: pass the section to mayHaveInstructions
+ if (MCOS.mayHaveInstructions())
+ Keep.push_back(Sec);
}
+ SectionsForRanges.clear();
+ SectionsForRanges.insert(Keep.begin(), Keep.end());
}
void MCContext::reportFatalError(SMLoc Loc, const Twine &Msg) const {
OpenPOWER on IntegriCloud