Refactor how passes get a symbol at the end of a section.

There is now a canonical symbol at the end of a section that different
passes can request.

This also allows us to assert that we don't switch back to a section whose
end symbol has already been printed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233026 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-03-23 21:22:04 +00:00
parent dce96380c1
commit 79cd79b1e6
8 changed files with 42 additions and 31 deletions

View File

@ -1664,15 +1664,8 @@ void DwarfDebug::emitDebugARanges() {
const MCSection *Section = I.first;
MCSymbol *Sym = nullptr;
if (Section) {
// We can't call MCSection::getLabelEndName, as it's only safe to do so
// if we know the section name up-front. For user-created sections, the
// resulting label may not be valid to use as a label. (section names can
// use a greater set of characters on some systems)
Sym = Asm->createTempSymbol("debug_end");
Asm->OutStreamer.SwitchSection(Section);
Asm->OutStreamer.EmitLabel(Sym);
}
if (Section)
Sym = Asm->OutStreamer.endSection(Section);
// Insert a final terminator.
SectionMap[Section].push_back(SymbolCU(nullptr, Sym));