[llvm] r178980 - Make getObject const. Remove a const_cast.
Rafael Espindola
rafael.espindola at gmail.com
Sun Apr 7 07:50:41 PDT 2013
Author: rafael
Date: Sun Apr 7 09:50:40 2013
New Revision: 178980
URL: http://llvm.org/viewvc/llvm-project?rev=178980&view=rev
Log:
Make getObject const. Remove a const_cast.
Modified:
llvm/trunk/include/llvm/Object/MachO.h
llvm/trunk/tools/llvm-objdump/MachODump.cpp
llvm/trunk/tools/llvm-readobj/MachODumper.cpp
Modified: llvm/trunk/include/llvm/Object/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=178980&r1=178979&r2=178980&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachO.h (original)
+++ llvm/trunk/include/llvm/Object/MachO.h Sun Apr 7 09:50:40 2013
@@ -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();
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=178980&r1=178979&r2=178980&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Sun Apr 7 09:50:40 2013
@@ -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(StringR
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) {
Modified: llvm/trunk/tools/llvm-readobj/MachODumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/MachODumper.cpp?rev=178980&r1=178979&r2=178980&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/MachODumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/MachODumper.cpp Sun Apr 7 09:50:40 2013
@@ -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);
More information about the llvm-commits
mailing list