[llvm] c94cf97 - [llvm-objcopy][MachO] Minor code cleanup

Alexander Shaposhnikov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 22:51:35 PDT 2021


Author: Alexander Shaposhnikov
Date: 2021-06-28T22:51:02-07:00
New Revision: c94cf97b53566a26245c54ea0c41b0dc83daf8a0

URL: https://github.com/llvm/llvm-project/commit/c94cf97b53566a26245c54ea0c41b0dc83daf8a0
DIFF: https://github.com/llvm/llvm-project/commit/c94cf97b53566a26245c54ea0c41b0dc83daf8a0.diff

LOG: [llvm-objcopy][MachO] Minor code cleanup

Remove unnecessary template in MachOReader.cpp. NFC.

Added: 
    

Modified: 
    llvm/tools/llvm-objcopy/MachO/MachOReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp b/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
index 050dd976f3f3..4b0aeb970267 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
@@ -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);
@@ -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;


        


More information about the llvm-commits mailing list