summaryrefslogtreecommitdiff
path: root/tools/llvm-readobj
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-04-07 15:05:12 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-04-07 15:05:12 +0000
commit7ea2e4869496fb27876d35b93fe99397be29b978 (patch)
treedcae71ea785feb5488bd31e4d06d96cbf737116c /tools/llvm-readobj
parent305b826f92e0dc7b670238e7caa35ab6e1cf341a (diff)
downloadllvm-7ea2e4869496fb27876d35b93fe99397be29b978.tar.gz
llvm-7ea2e4869496fb27876d35b93fe99397be29b978.tar.bz2
llvm-7ea2e4869496fb27876d35b93fe99397be29b978.tar.xz
Remove a use of InMemoryStruct in llvm-readobj.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178981 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-readobj')
-rw-r--r--tools/llvm-readobj/MachODumper.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/tools/llvm-readobj/MachODumper.cpp b/tools/llvm-readobj/MachODumper.cpp
index 006158e027..717569cd43 100644
--- a/tools/llvm-readobj/MachODumper.cpp
+++ b/tools/llvm-readobj/MachODumper.cpp
@@ -165,13 +165,13 @@ static bool is64BitLoadCommand(const MachOObject *MachOObj, DataRefImpl DRI) {
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 *MachOObj,
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;