1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/tools/obj2yaml/macho2yaml.cpp
Chris Bieneman 80178ca710 Initial add for MachO support for obj2yaml
Adding the initial files for adding MachO support to obj2yaml. Passing a MachO file will result in a new not_implemented error.

I will be implementing obj2yaml and yaml2obj for MachO in parallel so that one can be used to test the other.

llvm-svn: 269243
2016-05-11 22:07:45 +00:00

36 lines
1.1 KiB
C++

//===------ macho2yaml.cpp - obj2yaml conversion tool -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "Error.h"
#include "obj2yaml.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Object/MachOUniversal.h"
using namespace llvm;
std::error_code macho2yaml(raw_ostream &Out,
const object::MachOObjectFile &Obj) {
return obj2yaml_error::not_implemented;
}
std::error_code macho2yaml(raw_ostream &Out,
const object::MachOUniversalBinary &Obj) {
return obj2yaml_error::not_implemented;
}
std::error_code macho2yaml(raw_ostream &Out, const object::ObjectFile &Obj) {
if (const auto *MachOObj = dyn_cast<object::MachOUniversalBinary>(&Obj))
return macho2yaml(Out, *MachOObj);
if (const auto *MachOObj = dyn_cast<object::MachOObjectFile>(&Obj))
return macho2yaml(Out, *MachOObj);
return obj2yaml_error::unsupported_obj_file_format;
}