Make getObject const. Remove a const_cast.

llvm-svn: 178980
This commit is contained in:
Rafael Espindola 2013-04-07 14:50:40 +00:00
parent b7b11f7bac
commit 0944c13e6b
3 changed files with 4 additions and 4 deletions

View File

@ -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();

View File

@ -108,7 +108,7 @@ struct SymbolSorter {
// Print additional information about an address, if available.
static void DumpAddress(uint64_t Address, ArrayRef<SectionRef> 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<MachOObjectFile> MachOOF(static_cast<MachOObjectFile*>(
ObjectFile::createMachOObjectFile(Buff.take())));
MachOObject *MachOObj = MachOOF->getObject();
const MachOObject *MachOObj = MachOOF->getObject();
const Target *TheTarget = GetTarget(MachOObj);
if (!TheTarget) {

View File

@ -254,7 +254,7 @@ void MachODumper::printSections() {
++SectionIndex;
const MachOObject *MachO = const_cast<MachOObjectFile*>(Obj)->getObject();
const MachOObject *MachO = Obj->getObject();
MachOSection Section;
getSection(MachO, SecI->getRawDataRefImpl(), Section);