summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit6f5d6c7e7857615e70fc9d233ea7689997835ca7 (patch)
treef1f71f1b8a4357bb2335374b1c9d4ac08c7930f1 /llvm
parent0944c13e6b6a4b24ac3e38088939619e2e2ed843 (diff)
downloadbcm5719-llvm-6f5d6c7e7857615e70fc9d233ea7689997835ca7.tar.gz
bcm5719-llvm-6f5d6c7e7857615e70fc9d233ea7689997835ca7.zip
Remove a use of InMemoryStruct in llvm-readobj.
llvm-svn: 178981
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Object/MachO.h4
-rw-r--r--llvm/tools/llvm-readobj/MachODumper.cpp15
2 files changed, 8 insertions, 11 deletions
diff --git a/llvm/include/llvm/Object/MachO.h b/llvm/include/llvm/Object/MachO.h
index 41484485e44..ba0ffa8b32d 100644
--- a/llvm/include/llvm/Object/MachO.h
+++ b/llvm/include/llvm/Object/MachO.h
@@ -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;
diff --git a/llvm/tools/llvm-readobj/MachODumper.cpp b/llvm/tools/llvm-readobj/MachODumper.cpp
index 006158e027a..717569cd43b 100644
--- a/llvm/tools/llvm-readobj/MachODumper.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud