NFC: Inline unused variable
authorKirill Bobyrev <kbobyrev@google.com>
Tue, 16 Jun 2020 06:29:52 +0000 (08:29 +0200)
committerKirill Bobyrev <kbobyrev@google.com>
Tue, 16 Jun 2020 06:29:52 +0000 (08:29 +0200)
The variable was not used anywhere except assert and causes build
warnings in the optimized builds.

Clanup after 913bc312b5516f0c7113fe14ea90097587ac5ca5

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

index 4fc0001..256c830 100644 (file)
@@ -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);