From 305b826f92e0dc7b670238e7caa35ab6e1cf341a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sun, 7 Apr 2013 14:50:40 +0000 Subject: [PATCH] Make getObject const. Remove a const_cast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178980 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/MachO.h | 2 +- tools/llvm-objdump/MachODump.cpp | 4 ++-- tools/llvm-readobj/MachODumper.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index f026e6c69d4..41484485e44 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -155,7 +155,7 @@ public: const MachOFormat::LinkeditDataLoadCommand * getLinkeditDataLoadCommand(LoadCommandInfo LCI) const; - MachOObject *getObject() { return MachOObj.get(); } + const MachOObject *getObject() const { return MachOObj.get(); } static inline bool classof(const Binary *v) { return v->isMachO(); diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index 894e769115c..282f04db2e4 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -108,7 +108,7 @@ struct SymbolSorter { // Print additional information about an address, if available. static void DumpAddress(uint64_t Address, ArrayRef Sections, - MachOObject *MachOObj, raw_ostream &OS) { + const MachOObject *MachOObj, raw_ostream &OS) { for (unsigned i = 0; i != Sections.size(); ++i) { uint64_t SectAddr = 0, SectSize = 0; Sections[i].getAddress(SectAddr); @@ -241,7 +241,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) { OwningPtr MachOOF(static_cast( ObjectFile::createMachOObjectFile(Buff.take()))); - MachOObject *MachOObj = MachOOF->getObject(); + const MachOObject *MachOObj = MachOOF->getObject(); const Target *TheTarget = GetTarget(MachOObj); if (!TheTarget) { diff --git a/tools/llvm-readobj/MachODumper.cpp b/tools/llvm-readobj/MachODumper.cpp index 0354e767ba9..006158e027a 100644 --- a/tools/llvm-readobj/MachODumper.cpp +++ b/tools/llvm-readobj/MachODumper.cpp @@ -254,7 +254,7 @@ void MachODumper::printSections() { ++SectionIndex; - const MachOObject *MachO = const_cast(Obj)->getObject(); + const MachOObject *MachO = Obj->getObject(); MachOSection Section; getSection(MachO, SecI->getRawDataRefImpl(), Section);