summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-04-06 03:50:05 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-04-06 03:50:05 +0000
commit91af8e84b934ef64a96d0b548f870895ed47eb66 (patch)
treeb252204147b20dcaafac120189ff96db0681b6fd /llvm/lib/Object/MachOObjectFile.cpp
parent15e2a9cd57a052ad4034b0dec7687aeb8d2aa0fa (diff)
downloadbcm5719-llvm-91af8e84b934ef64a96d0b548f870895ed47eb66.tar.gz
bcm5719-llvm-91af8e84b934ef64a96d0b548f870895ed47eb66.zip
Remove last use of InMemoryStruct from MachOObjectFile.cpp.
llvm-svn: 178948
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index e2b0468b9a5..1eb14f31ff4 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -68,6 +68,21 @@ MachOObjectFile::getSymtabLoadCommand(LoadCommandInfo LCI) const {
return reinterpret_cast<const MachOFormat::SymtabLoadCommand*>(Data.data());
}
+const MachOFormat::SegmentLoadCommand *
+MachOObjectFile::getSegmentLoadCommand(LoadCommandInfo LCI) const {
+ StringRef Data = MachOObj->getData(LCI.Offset,
+ sizeof(MachOFormat::SegmentLoadCommand));
+ return reinterpret_cast<const MachOFormat::SegmentLoadCommand*>(Data.data());
+}
+
+const MachOFormat::Segment64LoadCommand *
+MachOObjectFile::getSegment64LoadCommand(LoadCommandInfo LCI) const {
+ StringRef Data = MachOObj->getData(LCI.Offset,
+ sizeof(MachOFormat::Segment64LoadCommand));
+ return
+ reinterpret_cast<const MachOFormat::Segment64LoadCommand*>(Data.data());
+}
+
void MachOObjectFile::moveToNextSymbol(DataRefImpl &DRI) const {
uint32_t LoadCommandCount = MachOObj->getHeader().NumLoadCommands;
while (DRI.d.a < LoadCommandCount) {
@@ -436,13 +451,13 @@ void MachOObjectFile::moveToNextSection(DataRefImpl &DRI) const {
while (DRI.d.a < LoadCommandCount) {
LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
if (LCI.Command.Type == macho::LCT_Segment) {
- InMemoryStruct<macho::SegmentLoadCommand> SegmentLoadCmd;
- MachOObj->ReadSegmentLoadCommand(LCI, SegmentLoadCmd);
+ const MachOFormat::SegmentLoadCommand *SegmentLoadCmd =
+ getSegmentLoadCommand(LCI);
if (DRI.d.b < SegmentLoadCmd->NumSections)
return;
} else if (LCI.Command.Type == macho::LCT_Segment64) {
- InMemoryStruct<macho::Segment64LoadCommand> Segment64LoadCmd;
- MachOObj->ReadSegment64LoadCommand(LCI, Segment64LoadCmd);
+ const MachOFormat::Segment64LoadCommand *Segment64LoadCmd =
+ getSegment64LoadCommand(LCI);
if (DRI.d.b < Segment64LoadCmd->NumSections)
return;
}
OpenPOWER on IntegriCloud