[llvm] r288607 - [MC] Generalize MCContext's SectionSymbols field.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 3 15:55:57 PST 2016
Author: djg
Date: Sat Dec 3 17:55:57 2016
New Revision: 288607
URL: http://llvm.org/viewvc/llvm-project?rev=288607&view=rev
Log:
[MC] Generalize MCContext's SectionSymbols field.
Change SectionSymbols so that it doesn't hard-code ELF types, so that
it can be used for non-ELF targets.
Modified:
llvm/trunk/include/llvm/MC/MCContext.h
llvm/trunk/lib/MC/MCContext.cpp
Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=288607&r1=288606&r2=288607&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Sat Dec 3 17:55:57 2016
@@ -82,9 +82,9 @@ namespace llvm {
/// Bindings of names to symbols.
SymbolTable Symbols;
- /// ELF sections can have a corresponding symbol. This maps one to the
+ /// Sections can have a corresponding symbol. This maps one to the
/// other.
- DenseMap<const MCSectionELF *, MCSymbolELF *> SectionSymbols;
+ DenseMap<const MCSection *, MCSymbol *> SectionSymbols;
/// A mapping from a local label number and an instance count to a symbol.
/// For example, in the assembly
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=288607&r1=288606&r2=288607&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Sat Dec 3 17:55:57 2016
@@ -125,15 +125,15 @@ MCSymbol *MCContext::getOrCreateSymbol(c
}
MCSymbolELF *MCContext::getOrCreateSectionSymbol(const MCSectionELF &Section) {
- MCSymbolELF *&Sym = SectionSymbols[&Section];
+ MCSymbol *&Sym = SectionSymbols[&Section];
if (Sym)
- return Sym;
+ return cast<MCSymbolELF>(Sym);
StringRef Name = Section.getSectionName();
auto NameIter = UsedNames.insert(std::make_pair(Name, false)).first;
Sym = new (&*NameIter, *this) MCSymbolELF(&*NameIter, /*isTemporary*/ false);
- return Sym;
+ return cast<MCSymbolELF>(Sym);
}
MCSymbol *MCContext::getOrCreateFrameAllocSymbol(StringRef FuncName,
More information about the llvm-commits
mailing list