Merge two small functions. NFC.

llvm-svn: 257418
This commit is contained in:
Rui Ueyama 2016-01-11 23:50:55 +00:00
parent 1602605bf8
commit f949f7f15e
1 changed files with 9 additions and 12 deletions

View File

@ -650,25 +650,22 @@ OutputSectionFactory<ELFT>::create(InputSectionBase<ELFT> *C,
OutputSectionBase<ELFT> *&Sec = Map[Key];
if (Sec)
return {Sec, false};
Sec = createAux(C, Key);
return {Sec, true};
}
template <class ELFT>
OutputSectionBase<ELFT> *
OutputSectionFactory<ELFT>::createAux(InputSectionBase<ELFT> *C,
const SectionKey<ELFT::Is64Bits> &Key) {
switch (C->SectionKind) {
case InputSectionBase<ELFT>::Regular:
return new OutputSection<ELFT>(Key.Name, Key.Type, Key.Flags);
Sec = new OutputSection<ELFT>(Key.Name, Key.Type, Key.Flags);
break;
case InputSectionBase<ELFT>::EHFrame:
return new EHOutputSection<ELFT>(Key.Name, Key.Type, Key.Flags);
Sec = new EHOutputSection<ELFT>(Key.Name, Key.Type, Key.Flags);
break;
case InputSectionBase<ELFT>::Merge:
return new MergeOutputSection<ELFT>(Key.Name, Key.Type, Key.Flags);
Sec = new MergeOutputSection<ELFT>(Key.Name, Key.Type, Key.Flags);
break;
case InputSectionBase<ELFT>::MipsReginfo:
return new MipsReginfoOutputSection<ELFT>();
Sec = new MipsReginfoOutputSection<ELFT>();
break;
}
llvm_unreachable("Unknown output section type");
return {Sec, true};
}
template <class ELFT>