[llvm] 2ca68b6 - [llvm-objcopy][MachO] Clean up the interface of Object

Alexander Shaposhnikov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 18:27:13 PDT 2020


Author: Alexander Shaposhnikov
Date: 2020-09-18T18:23:27-07:00
New Revision: 2ca68b6542cf1df79613ac99d41ac58b2a7cea48

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

LOG: [llvm-objcopy][MachO] Clean up the interface of Object

Remove the method addLoadCommand which was used only in a single place.
NFC.

Test plan: make check-all

Added: 
    

Modified: 
    llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
    llvm/tools/llvm-objcopy/MachO/Object.cpp
    llvm/tools/llvm-objcopy/MachO/Object.h

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp b/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
index de372ac0d138..fff3f01a60f4 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
@@ -215,7 +215,7 @@ static Error processLoadCommands(const CopyConfig &Config, Object &Obj) {
                                "rpath " + RPath +
                                    " would create a duplicate load command");
     RPaths.insert(RPath);
-    Obj.addLoadCommand(buildRPathLoadCommand(RPath));
+    Obj.LoadCommands.push_back(buildRPathLoadCommand(RPath));
   }
 
   return Error::success();

diff  --git a/llvm/tools/llvm-objcopy/MachO/Object.cpp b/llvm/tools/llvm-objcopy/MachO/Object.cpp
index de8cb0af108d..0359e2a3e924 100644
--- a/llvm/tools/llvm-objcopy/MachO/Object.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/Object.cpp
@@ -111,10 +111,6 @@ Error Object::removeSections(
   return Error::success();
 }
 
-void Object::addLoadCommand(LoadCommand LC) {
-  LoadCommands.push_back(std::move(LC));
-}
-
 template <typename SegmentType>
 static void constructSegment(SegmentType &Seg,
                              llvm::MachO::LoadCommandType CmdType,

diff  --git a/llvm/tools/llvm-objcopy/MachO/Object.h b/llvm/tools/llvm-objcopy/MachO/Object.h
index e825d1867b09..102aeedc292f 100644
--- a/llvm/tools/llvm-objcopy/MachO/Object.h
+++ b/llvm/tools/llvm-objcopy/MachO/Object.h
@@ -331,8 +331,6 @@ struct Object {
 
   void updateLoadCommandIndexes();
 
-  void addLoadCommand(LoadCommand LC);
-
   /// Creates a new segment load command in the object and returns a reference
   /// to the newly created load command. The caller should verify that SegName
   /// is not too long (SegName.size() should be less than or equal to 16).


        


More information about the llvm-commits mailing list