From: Dan Gohman Date: Sat, 3 Dec 2016 23:55:57 +0000 (+0000) Subject: [MC] Generalize MCContext's SectionSymbols field. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bbaf9cd246d7e63c0c7be0e87a022c7fee48a401;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288607 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index 4c1367343db..2ce2780d4f2 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -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 SectionSymbols; + DenseMap SectionSymbols; /// A mapping from a local label number and an instance count to a symbol. /// For example, in the assembly diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 77fe015eefe..afe8ee84918 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -125,15 +125,15 @@ MCSymbol *MCContext::getOrCreateSymbol(const Twine &Name) { } MCSymbolELF *MCContext::getOrCreateSectionSymbol(const MCSectionELF &Section) { - MCSymbolELF *&Sym = SectionSymbols[&Section]; + MCSymbol *&Sym = SectionSymbols[&Section]; if (Sym) - return Sym; + return cast(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(Sym); } MCSymbol *MCContext::getOrCreateFrameAllocSymbol(StringRef FuncName,