From f949f7f15e3bd006e0f1f0980979aa6420193fd5 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 11 Jan 2016 23:50:55 +0000 Subject: [PATCH] Merge two small functions. NFC. llvm-svn: 257418 --- lld/ELF/Writer.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) 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