summaryrefslogtreecommitdiffstats
path: root/tools/llvm-readobj
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-04-07 15:35:18 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-04-07 15:35:18 +0000
commit1efa60453be658242f468f4be4f8d4855ace60d1 (patch)
treeae4a77e9250020b99ea20e475848b4a7474335da /tools/llvm-readobj
parent6e43efe071c5bfaa5cebf4d42d93d0f117c1aa2a (diff)
downloadexternal_llvm-1efa60453be658242f468f4be4f8d4855ace60d1.zip
external_llvm-1efa60453be658242f468f4be4f8d4855ace60d1.tar.gz
external_llvm-1efa60453be658242f468f4be4f8d4855ace60d1.tar.bz2
Remove usage of InMemoryStruct in getSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178984 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-readobj')
-rw-r--r--tools/llvm-readobj/MachODumper.cpp32
1 files changed, 6 insertions, 26 deletions
diff --git a/tools/llvm-readobj/MachODumper.cpp b/tools/llvm-readobj/MachODumper.cpp
index 717569c..8f37b9a 100644
--- a/tools/llvm-readobj/MachODumper.cpp
+++ b/tools/llvm-readobj/MachODumper.cpp
@@ -197,38 +197,20 @@ static void getSection(const MachOObjectFile *Obj,
}
}
-static void getSymbolTableEntry(const MachOObject *MachO,
- DataRefImpl DRI,
- InMemoryStruct<macho::SymbolTableEntry> &Res) {
- InMemoryStruct<macho::SymtabLoadCommand> SymtabLoadCmd;
- LoadCommandInfo LCI = MachO->getLoadCommandInfo(DRI.d.a);
- MachO->ReadSymtabLoadCommand(LCI, SymtabLoadCmd);
- MachO->ReadSymbolTableEntry(SymtabLoadCmd->SymbolTableOffset, DRI.d.b, Res);
-}
-
-static void getSymbol64TableEntry(const MachOObject *MachO,
- DataRefImpl DRI,
- InMemoryStruct<macho::Symbol64TableEntry> &Res) {
- InMemoryStruct<macho::SymtabLoadCommand> SymtabLoadCmd;
- LoadCommandInfo LCI = MachO->getLoadCommandInfo(DRI.d.a);
- MachO->ReadSymtabLoadCommand(LCI, SymtabLoadCmd);
- MachO->ReadSymbol64TableEntry(SymtabLoadCmd->SymbolTableOffset, DRI.d.b, Res);
-}
-
-static void getSymbol(const MachOObject *MachOObj,
+static void getSymbol(const MachOObjectFile *Obj,
DataRefImpl DRI,
MachOSymbol &Symbol) {
+ const MachOObject *MachOObj = Obj->getObject();
if (MachOObj->is64Bit()) {
- InMemoryStruct<macho::Symbol64TableEntry> Entry;
- getSymbol64TableEntry(MachOObj, DRI, Entry);
+ const MachOFormat::Symbol64TableEntry *Entry =
+ Obj->getSymbol64TableEntry( DRI);
Symbol.StringIndex = Entry->StringIndex;
Symbol.Type = Entry->Type;
Symbol.SectionIndex = Entry->SectionIndex;
Symbol.Flags = Entry->Flags;
Symbol.Value = Entry->Value;
} else {
- InMemoryStruct<macho::SymbolTableEntry> Entry;
- getSymbolTableEntry(MachOObj, DRI, Entry);
+ const MachOFormat::SymbolTableEntry *Entry = Obj->getSymbolTableEntry(DRI);
Symbol.StringIndex = Entry->StringIndex;
Symbol.Type = Entry->Type;
Symbol.SectionIndex = Entry->SectionIndex;
@@ -397,10 +379,8 @@ void MachODumper::printSymbol(symbol_iterator SymI) {
if (SymI->getName(SymbolName))
SymbolName = "";
- const MachOObject *MachO = const_cast<MachOObjectFile*>(Obj)->getObject();
-
MachOSymbol Symbol;
- getSymbol(MachO, SymI->getRawDataRefImpl(), Symbol);
+ getSymbol(Obj, SymI->getRawDataRefImpl(), Symbol);
StringRef SectionName;
section_iterator SecI(Obj->end_sections());