diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-27 20:52:32 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-27 20:52:32 +0000 |
commit | 2f9bdd8c9fffe4646d33a85349f55b43f795a253 (patch) | |
tree | 720917563730dd13fd75b0bc9c72528947fab830 /llvm/lib/MC/MCStreamer.cpp | |
parent | 8b34f82462d5fd719f19f6bda17b2983ccbadcfa (diff) | |
download | llvm-2f9bdd8c9fffe4646d33a85349f55b43f795a253.zip llvm-2f9bdd8c9fffe4646d33a85349f55b43f795a253.tar.gz llvm-2f9bdd8c9fffe4646d33a85349f55b43f795a253.tar.bz2 |
There is only one current section.
Both MCStreamer and MCObjectStreamer were maintaining a current section
variable and they were slightly out of sync. I don't think this was observable,
but was inefficient and error prone.
Changing this requires a few cascading changes:
* SwitchSection has to call ChangeSection earlier for ChangeSection to see
the old section.
* With that change, ChangeSection cannot call EmitLabel, since during
ChangeSection we are still in the old section.
* When the object streamer requires a begin label, just reused the existing
generic support for begin labels instead of calling EmitLabel directly.
llvm-svn: 238357
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 9e0cc6b..71d4b06 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -669,9 +669,9 @@ void MCStreamer::SwitchSection(MCSection *Section, const MCExpr *Subsection) { MCSectionSubPair curSection = SectionStack.back().first; SectionStack.back().second = curSection; if (MCSectionSubPair(Section, Subsection) != curSection) { + ChangeSection(Section, Subsection); SectionStack.back().first = MCSectionSubPair(Section, Subsection); assert(!Section->hasEnded() && "Section already ended"); - ChangeSection(Section, Subsection); MCSymbol *Sym = Section->getBeginSymbol(); if (Sym && !Sym->isInSection()) EmitLabel(Sym); |