From f6cfc15705140cc958b784a1bc98f7f0f09be6be Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 9 Apr 2013 14:49:08 +0000 Subject: Convert MachOObjectFile to a template. For now it is templated only on being 64 or 32 bits. I will add little/big endian next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179097 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-objdump/MachODump.cpp | 8 ++++---- tools/llvm-objdump/llvm-objdump.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tools/llvm-objdump') diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index 7c65658..b0a1aca 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -52,7 +52,7 @@ static cl::opt static cl::opt DSYMFile("dsym", cl::desc("Use .dSYM file for debug info")); -static const Target *GetTarget(const MachOObjectFile *MachOObj) { +static const Target *GetTarget(const MachOObjectFileBase *MachOObj) { // Figure out the target triple. if (TripleName.empty()) { llvm::Triple TT("unknown-unknown-unknown"); @@ -108,7 +108,7 @@ struct SymbolSorter { // Print additional information about an address, if available. static void DumpAddress(uint64_t Address, ArrayRef Sections, - const MachOObjectFile *MachOObj, raw_ostream &OS) { + const MachOObjectFileBase *MachOObj, raw_ostream &OS) { for (unsigned i = 0; i != Sections.size(); ++i) { uint64_t SectAddr = 0, SectSize = 0; Sections[i].getAddress(SectAddr); @@ -200,7 +200,7 @@ static void emitDOTFile(const char *FileName, const MCFunction &f, } static void getSectionsAndSymbols(const MachOFormat::Header *Header, - MachOObjectFile *MachOObj, + MachOObjectFileBase *MachOObj, std::vector &Sections, std::vector &Symbols, SmallVectorImpl &FoundFns) { @@ -238,7 +238,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) { return; } - OwningPtr MachOOF(static_cast( + OwningPtr MachOOF(static_cast( ObjectFile::createMachOObjectFile(Buff.take()))); const Target *TheTarget = GetTarget(MachOOF.get()); diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 9a36e82..4790d7a 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -255,7 +255,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { std::sort(Rels.begin(), Rels.end(), RelocAddressLess); StringRef SegmentName = ""; - if (const MachOObjectFile *MachO = dyn_cast(Obj)) { + if (const MachOObjectFileBase *MachO = dyn_cast(Obj)) { DataRefImpl DR = i->getRawDataRefImpl(); SegmentName = MachO->getSectionFinalSegmentName(DR); } @@ -591,7 +591,7 @@ static void PrintSymbolTable(const ObjectFile *o) { else if (Section == o->end_sections()) outs() << "*UND*"; else { - if (const MachOObjectFile *MachO = dyn_cast(o)) { + if (const MachOObjectFileBase *MachO = dyn_cast(o)) { DataRefImpl DR = Section->getRawDataRefImpl(); StringRef SegmentName = MachO->getSectionFinalSegmentName(DR); outs() << SegmentName << ","; -- cgit v1.1