[llvm] r178981 - Remove a use of InMemoryStruct in llvm-readobj.
Rafael Espindola
rafael.espindola at gmail.com
Sun Apr 7 08:05:13 PDT 2013
Author: rafael
Date: Sun Apr 7 10:05:12 2013
New Revision: 178981
URL: http://llvm.org/viewvc/llvm-project?rev=178981&view=rev
Log:
Remove a use of InMemoryStruct in llvm-readobj.
Modified:
llvm/trunk/include/llvm/Object/MachO.h
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=178981&r1=178980&r2=178981&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachO.h (original)
+++ llvm/trunk/include/llvm/Object/MachO.h Sun Apr 7 10:05:12 2013
@@ -154,6 +154,8 @@ public:
const MachOFormat::LinkeditDataLoadCommand *
getLinkeditDataLoadCommand(LoadCommandInfo LCI) const;
+ const MachOFormat::Section64 *getSection64(DataRefImpl DRI) const;
+ const MachOFormat::Section *getSection(DataRefImpl DRI) const;
const MachOObject *getObject() const { return MachOObj.get(); }
@@ -237,8 +239,6 @@ private:
const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const;
void moveToNextSymbol(DataRefImpl &DRI) const;
- const MachOFormat::Section *getSection(DataRefImpl DRI) const;
- const MachOFormat::Section64 *getSection64(DataRefImpl DRI) const;
const MachOFormat::RelocationEntry *getRelocation(DataRefImpl Rel) const;
const MachOFormat::SymtabLoadCommand *
getSymtabLoadCommand(LoadCommandInfo LCI) const;
Modified: llvm/trunk/tools/llvm-readobj/MachODumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/MachODumper.cpp?rev=178981&r1=178980&r2=178981&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/MachODumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/MachODumper.cpp Sun Apr 7 10:05:12 2013
@@ -165,13 +165,13 @@ static bool is64BitLoadCommand(const Mac
return false;
}
-static void getSection(const MachOObject *MachOObj,
+static void getSection(const MachOObjectFile *Obj,
DataRefImpl DRI,
MachOSection &Section) {
- LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
+ const MachOObject *MachOObj = Obj->getObject();
+
if (is64BitLoadCommand(MachOObj, DRI)) {
- InMemoryStruct<macho::Section64> Sect;
- MachOObj->ReadSection64(LCI, DRI.d.b, Sect);
+ const MachOFormat::Section64 *Sect = Obj->getSection64(DRI);
Section.Address = Sect->Address;
Section.Size = Sect->Size;
@@ -183,8 +183,7 @@ static void getSection(const MachOObject
Section.Reserved1 = Sect->Reserved1;
Section.Reserved2 = Sect->Reserved2;
} else {
- InMemoryStruct<macho::Section> Sect;
- MachOObj->ReadSection(LCI, DRI.d.b, Sect);
+ const MachOFormat::Section *Sect = Obj->getSection(DRI);
Section.Address = Sect->Address;
Section.Size = Sect->Size;
@@ -254,10 +253,8 @@ void MachODumper::printSections() {
++SectionIndex;
- const MachOObject *MachO = Obj->getObject();
-
MachOSection Section;
- getSection(MachO, SecI->getRawDataRefImpl(), Section);
+ getSection(Obj, SecI->getRawDataRefImpl(), Section);
DataRefImpl DR = SecI->getRawDataRefImpl();
StringRef Name;
More information about the llvm-commits
mailing list