diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index f79d400ec789..16a9e8d4cf4c 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -650,25 +650,22 @@ OutputSectionFactory::create(InputSectionBase *C, OutputSectionBase *&Sec = Map[Key]; if (Sec) return {Sec, false}; - Sec = createAux(C, Key); - return {Sec, true}; -} -template -OutputSectionBase * -OutputSectionFactory::createAux(InputSectionBase *C, - const SectionKey &Key) { switch (C->SectionKind) { case InputSectionBase::Regular: - return new OutputSection(Key.Name, Key.Type, Key.Flags); + Sec = new OutputSection(Key.Name, Key.Type, Key.Flags); + break; case InputSectionBase::EHFrame: - return new EHOutputSection(Key.Name, Key.Type, Key.Flags); + Sec = new EHOutputSection(Key.Name, Key.Type, Key.Flags); + break; case InputSectionBase::Merge: - return new MergeOutputSection(Key.Name, Key.Type, Key.Flags); + Sec = new MergeOutputSection(Key.Name, Key.Type, Key.Flags); + break; case InputSectionBase::MipsReginfo: - return new MipsReginfoOutputSection(); + Sec = new MipsReginfoOutputSection(); + break; } - llvm_unreachable("Unknown output section type"); + return {Sec, true}; } template