[llvm] 45e4c9d - NFC: Inline unused variable

Kirill Bobyrev via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 23:31:10 PDT 2020


Author: Kirill Bobyrev
Date: 2020-06-16T08:29:52+02:00
New Revision: 45e4c9d70c3da84e3862b0ecfc8eb0048982dfea

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

LOG: NFC: Inline unused variable

The variable was not used anywhere except assert and causes build
warnings in the optimized builds.

Clanup after 913bc312b5516f0c7113fe14ea90097587ac5ca5

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp b/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
index 4fc000150feb..256c830a44a4 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
@@ -219,12 +219,12 @@ Error MachOLayoutBuilder::layoutTail(uint64_t Offset) {
   // If we are building the layout of an executable or dynamic library
   // which does not have any segments other than __LINKEDIT,
   // the Offset can be equal to zero by this time. It happens because of the
-  // convention that in such cases the file offsets specified by LC_SEGMENT start
-  // with zero (unlike the case of a relocatable object file).
-  const bool IsObject = O.Header.FileType == MachO::HeaderFileType::MH_OBJECT;
+  // convention that in such cases the file offsets specified by LC_SEGMENT
+  // start with zero (unlike the case of a relocatable object file).
   const uint64_t HeaderSize =
       Is64Bit ? sizeof(MachO::mach_header_64) : sizeof(MachO::mach_header);
-  assert((!IsObject || Offset >= HeaderSize + O.Header.SizeOfCmds) &&
+  assert((!(O.Header.FileType == MachO::HeaderFileType::MH_OBJECT) ||
+          Offset >= HeaderSize + O.Header.SizeOfCmds) &&
          "Incorrect tail offset");
   Offset = std::max(Offset, HeaderSize + O.Header.SizeOfCmds);
 


        


More information about the llvm-commits mailing list