[llvm] 273ba73 - [llvm-objcopy][MachO] Minor refactoring of MachOLayoutBuilder
Alexander Shaposhnikov via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 7 20:26:41 PST 2020
Author: Alexander Shaposhnikov
Date: 2020-11-07T20:25:49-08:00
New Revision: 273ba73689f4f47b195708be2c2107a30cef6e77
URL: https://github.com/llvm/llvm-project/commit/273ba73689f4f47b195708be2c2107a30cef6e77
DIFF: https://github.com/llvm/llvm-project/commit/273ba73689f4f47b195708be2c2107a30cef6e77.diff
LOG: [llvm-objcopy][MachO] Minor refactoring of MachOLayoutBuilder
Move the implementation of getStringTableBuilderKind into
MachOLayoutBuilder.cpp. NFC.
Test plan: make check-all
Added:
Modified:
llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.h
Removed:
################################################################################
diff --git a/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp b/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
index ea01e8519a5c..8e2bf36238ec 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
@@ -15,6 +15,14 @@ namespace llvm {
namespace objcopy {
namespace macho {
+StringTableBuilder::Kind
+MachOLayoutBuilder::getStringTableBuilderKind(const Object &O, bool Is64Bit) {
+ if (O.Header.FileType == MachO::HeaderFileType::MH_OBJECT)
+ return Is64Bit ? StringTableBuilder::MachO64 : StringTableBuilder::MachO;
+ return Is64Bit ? StringTableBuilder::MachO64Linked
+ : StringTableBuilder::MachOLinked;
+}
+
uint32_t MachOLayoutBuilder::computeSizeOfCmds() const {
uint32_t Size = 0;
for (const LoadCommand &LC : O.LoadCommands) {
diff --git a/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.h b/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.h
index a0ed02e41db4..5fe6683e27f3 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.h
+++ b/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.h
@@ -34,12 +34,7 @@ class MachOLayoutBuilder {
Error layoutTail(uint64_t Offset);
static StringTableBuilder::Kind getStringTableBuilderKind(const Object &O,
- bool Is64Bit) {
- if (O.Header.FileType == MachO::HeaderFileType::MH_OBJECT)
- return Is64Bit ? StringTableBuilder::MachO64 : StringTableBuilder::MachO;
- return Is64Bit ? StringTableBuilder::MachO64Linked
- : StringTableBuilder::MachOLinked;
- }
+ bool Is64Bit);
public:
MachOLayoutBuilder(Object &O, bool Is64Bit, uint64_t PageSize)
More information about the llvm-commits
mailing list