diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 23af66c4bb102..075e27ec61758 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -161,9 +161,6 @@ class WinCOFFObjectWriter : public MCObjectWriter { COFFSymbol *GetOrCreateCOFFSymbol(const MCSymbol *Symbol); COFFSection *createSection(StringRef Name); - template - object_t *createCOFFEntity(StringRef Name, list_t &List); - void defineSection(MCSectionCOFF const &Sec); COFFSymbol *getLinkedSymbol(const MCSymbol &Symbol); @@ -226,27 +223,20 @@ WinCOFFObjectWriter::WinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW, } COFFSymbol *WinCOFFObjectWriter::createSymbol(StringRef Name) { - return createCOFFEntity(Name, Symbols); + Symbols.push_back(make_unique(Name)); + return Symbols.back().get(); } COFFSymbol *WinCOFFObjectWriter::GetOrCreateCOFFSymbol(const MCSymbol *Symbol) { COFFSymbol *&Ret = SymbolMap[Symbol]; if (!Ret) - Ret = createCOFFEntity(Symbol->getName(), Symbols); + Ret = createSymbol(Symbol->getName()); return Ret; } COFFSection *WinCOFFObjectWriter::createSection(StringRef Name) { - return createCOFFEntity(Name, Sections); -} - -/// A template used to lookup or create a symbol/section, and initialize it if -/// needed. -template -object_t *WinCOFFObjectWriter::createCOFFEntity(StringRef Name, list_t &List) { - List.push_back(make_unique(Name)); - - return List.back().get(); + Sections.emplace_back(make_unique(Name)); + return Sections.back().get(); } /// This function takes a section data object from the assembler