[llvm-objcopy] Fix "unused-function" warning in NDEBUG builds
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Mon, 29 Jun 2020 14:56:35 +0000 (16:56 +0200)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Mon, 29 Jun 2020 14:59:15 +0000 (16:59 +0200)
Fixup of commit b925ca37a8f28851 to allow building with
-Werror -Wunused-function.

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

index 2586ef2..16332a7 100644 (file)
@@ -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) &&