Skip to content

Commit

Permalink
[llvm-objcopy][MachO] Minor code cleanup
Browse files Browse the repository at this point in the history
Remove unnecessary template in MachOReader.cpp. NFC.
  • Loading branch information
Alexander Shaposhnikov committed Jun 29, 2021
1 parent 6d234a6 commit c94cf97
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void MachOReader::readHeader(Object &O) const {
}

template <typename SectionType>
static Section constructSectionCommon(SectionType Sec, uint32_t Index) {
static Section constructSectionCommon(const SectionType &Sec, uint32_t Index) {
StringRef SegName(Sec.segname, strnlen(Sec.segname, sizeof(Sec.segname)));
StringRef SectName(Sec.sectname, strnlen(Sec.sectname, sizeof(Sec.sectname)));
Section S(SegName, SectName);
Expand All @@ -46,14 +46,11 @@ static Section constructSectionCommon(SectionType Sec, uint32_t Index) {
return S;
}

template <typename SectionType>
Section constructSection(SectionType Sec, uint32_t Index);

template <> Section constructSection(MachO::section Sec, uint32_t Index) {
static Section constructSection(const MachO::section &Sec, uint32_t Index) {
return constructSectionCommon(Sec, Index);
}

template <> Section constructSection(MachO::section_64 Sec, uint32_t Index) {
static Section constructSection(const MachO::section_64 &Sec, uint32_t Index) {
Section S = constructSectionCommon(Sec, Index);
S.Reserved3 = Sec.reserved3;
return S;
Expand Down

0 comments on commit c94cf97

Please sign in to comment.