summaryrefslogtreecommitdiffstats
path: root/llvm/tools/obj2yaml/macho2yaml.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-05-17 17:13:50 +0000
committerChris Bieneman <beanz@apple.com>2016-05-17 17:13:50 +0000
commit1c0f0b242da706ee4b31b5107273476358895049 (patch)
tree7a2ac124a86774b86ba682d66460ba070840de8c /llvm/tools/obj2yaml/macho2yaml.cpp
parentac9e15551dfccb2996708534648e6b7e8d4fee8a (diff)
downloadbcm5719-llvm-1c0f0b242da706ee4b31b5107273476358895049.tar.gz
bcm5719-llvm-1c0f0b242da706ee4b31b5107273476358895049.zip
Revert "[obj2yaml] [yaml2obj] Support for MachO load command structures"
This reverts commit r269782 because it broke bots with -fpermissive. llvm-svn: 269785
Diffstat (limited to 'llvm/tools/obj2yaml/macho2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/macho2yaml.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/llvm/tools/obj2yaml/macho2yaml.cpp b/llvm/tools/obj2yaml/macho2yaml.cpp
index eb875ffa1cf..ad6969cdd4a 100644
--- a/llvm/tools/obj2yaml/macho2yaml.cpp
+++ b/llvm/tools/obj2yaml/macho2yaml.cpp
@@ -9,9 +9,9 @@
#include "Error.h"
#include "obj2yaml.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Object/MachOUniversal.h"
#include "llvm/ObjectYAML/MachOYAML.h"
-#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
@@ -24,14 +24,6 @@ public:
Expected<std::unique_ptr<MachOYAML::Object>> dump();
};
-#define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
- case MachO::LCName: \
- memcpy((void *) & (LC.load_command_data.LCStruct), LoadCmd.Ptr, \
- sizeof(MachO::LCStruct)); \
- if (Obj.isLittleEndian() != sys::IsLittleEndianHost) \
- MachO::swapStruct(LC.load_command_data.LCStruct); \
- break;
-
Expected<std::unique_ptr<MachOYAML::Object>> MachODumper::dump() {
auto Y = make_unique<MachOYAML::Object>();
Y->Header.magic = Obj.getHeader().magic;
@@ -43,17 +35,10 @@ Expected<std::unique_ptr<MachOYAML::Object>> MachODumper::dump() {
Y->Header.flags = Obj.getHeader().flags;
Y->Header.reserved = 0;
- for (auto LoadCmd : Obj.load_commands()) {
- MachOYAML::LoadCommand LC;
- switch (LoadCmd.C.cmd) {
- default:
- memcpy((void *)&(LC.load_command_data.load_command), LoadCmd.Ptr,
- sizeof(MachO::load_command));
- if (Obj.isLittleEndian() != sys::IsLittleEndianHost)
- MachO::swapStruct(LC.load_command_data.load_command);
- break;
-#include "llvm/Support/MachO.def"
- }
+ for (auto load_command : Obj.load_commands()) {
+ auto LC = make_unique<MachOYAML::LoadCommand>();
+ LC->cmd = static_cast<MachO::LoadCommandType>(load_command.C.cmd);
+ LC->cmdsize = load_command.C.cmdsize;
Y->LoadCommands.push_back(std::move(LC));
}
OpenPOWER on IntegriCloud