[llvm] cc83695 - [llvm-objcopy] Fix "unused-function" warning in NDEBUG builds

Bjorn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 07:59:40 PDT 2020


Author: Bjorn Pettersson
Date: 2020-06-29T16:59:15+02:00
New Revision: cc836950ab2a4309ae68d78a1b2330fd922fa3a2

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

LOG: [llvm-objcopy] Fix "unused-function" warning in NDEBUG builds

Fixup of commit b925ca37a8f28851 to allow building with
-Werror -Wunused-function.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp b/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
index 2586ef21f9b4..16332a7f1084 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
@@ -22,6 +22,7 @@ using namespace object;
 using SectionPred = std::function<bool(const std::unique_ptr<Section> &Sec)>;
 using LoadCommandPred = std::function<bool(const LoadCommand &LC)>;
 
+#ifndef NDEBUG
 static bool isLoadCommandWithPayloadString(const LoadCommand &LC) {
   // TODO: Add support for LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB and
   // LC_LAZY_LOAD_DYLIB
@@ -30,6 +31,7 @@ static bool isLoadCommandWithPayloadString(const LoadCommand &LC) {
          LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_LOAD_DYLIB ||
          LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_LOAD_WEAK_DYLIB;
 }
+#endif
 
 static StringRef getPayloadString(const LoadCommand &LC) {
   assert(isLoadCommandWithPayloadString(LC) &&


        


More information about the llvm-commits mailing list