[llvm] r178989 - Use getLoadCommandInfo instead of MachOObj->getLoadCommandInfo.
Rafael Espindola
rafael.espindola at gmail.com
Sun Apr 7 10:41:59 PDT 2013
Author: rafael
Date: Sun Apr 7 12:41:59 2013
New Revision: 178989
URL: http://llvm.org/viewvc/llvm-project?rev=178989&view=rev
Log:
Use getLoadCommandInfo instead of MachOObj->getLoadCommandInfo.
Modified:
llvm/trunk/lib/Object/MachOObjectFile.cpp
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=178989&r1=178988&r2=178989&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Sun Apr 7 12:41:59 2013
@@ -115,7 +115,7 @@ MachOObjectFile::getSegment64LoadCommand
void MachOObjectFile::moveToNextSymbol(DataRefImpl &DRI) const {
uint32_t LoadCommandCount = MachOObj->getHeader().NumLoadCommands;
while (DRI.d.a < LoadCommandCount) {
- LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
+ LoadCommandInfo LCI = getLoadCommandInfo(DRI.d.a);
if (LCI.Command.Type == macho::LCT_Symtab) {
const MachOFormat::SymtabLoadCommand *SymtabLoadCmd =
getSymtabLoadCommand(LCI);
@@ -130,7 +130,7 @@ void MachOObjectFile::moveToNextSymbol(D
const MachOFormat::SymbolTableEntry *
MachOObjectFile::getSymbolTableEntry(DataRefImpl DRI) const {
- LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
+ LoadCommandInfo LCI = getLoadCommandInfo(DRI.d.a);
const MachOFormat::SymtabLoadCommand *SymtabLoadCmd =
getSymtabLoadCommand(LCI);
@@ -151,7 +151,7 @@ MachOObjectFile::getSymbolTableEntry(Dat
const MachOFormat::Symbol64TableEntry*
MachOObjectFile::getSymbol64TableEntry(DataRefImpl DRI) const {
- LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
+ LoadCommandInfo LCI = getLoadCommandInfo(DRI.d.a);
const MachOFormat::SymtabLoadCommand *SymtabLoadCmd =
getSymtabLoadCommand(LCI);
@@ -180,7 +180,7 @@ error_code MachOObjectFile::getSymbolNex
error_code MachOObjectFile::getSymbolName(DataRefImpl DRI,
StringRef &Result) const {
- LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
+ LoadCommandInfo LCI = getLoadCommandInfo(DRI.d.a);
const MachOFormat::SymtabLoadCommand *SymtabLoadCmd =
getSymtabLoadCommand(LCI);
@@ -478,7 +478,7 @@ StringRef MachOObjectFile::getLoadName()
void MachOObjectFile::moveToNextSection(DataRefImpl &DRI) const {
uint32_t LoadCommandCount = MachOObj->getHeader().NumLoadCommands;
while (DRI.d.a < LoadCommandCount) {
- LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
+ LoadCommandInfo LCI = getLoadCommandInfo(DRI.d.a);
if (LCI.Command.Type == macho::LCT_Segment) {
const MachOFormat::SegmentLoadCommand *SegmentLoadCmd =
getSegmentLoadCommand(LCI);
@@ -504,7 +504,8 @@ error_code MachOObjectFile::getSectionNe
return object_error::success;
}
-static bool is64BitLoadCommand(const MachOObject *MachOObj, DataRefImpl DRI) {
+static bool is64BitLoadCommand(const MachOObjectFile *MachOObj,
+ DataRefImpl DRI) {
LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
if (LCI.Command.Type == macho::LCT_Segment64)
return true;
@@ -513,8 +514,8 @@ static bool is64BitLoadCommand(const Mac
}
const MachOFormat::Section *MachOObjectFile::getSection(DataRefImpl DRI) const {
- assert(!is64BitLoadCommand(MachOObj.get(), DRI));
- LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
+ assert(!is64BitLoadCommand(this, DRI));
+ LoadCommandInfo LCI = getLoadCommandInfo(DRI.d.a);
unsigned SectionOffset = LCI.Offset + sizeof(macho::SegmentLoadCommand) +
DRI.d.b * sizeof(MachOFormat::Section);
StringRef Data = MachOObj->getData(SectionOffset, sizeof(MachOFormat::Section));
@@ -530,8 +531,8 @@ std::size_t MachOObjectFile::getSectionI
const MachOFormat::Section64 *
MachOObjectFile::getSection64(DataRefImpl DRI) const {
- assert(is64BitLoadCommand(MachOObj.get(), DRI));
- LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
+ assert(is64BitLoadCommand(this, DRI));
+ LoadCommandInfo LCI = getLoadCommandInfo(DRI.d.a);
unsigned SectionOffset = LCI.Offset + sizeof(macho::Segment64LoadCommand) +
DRI.d.b * sizeof(MachOFormat::Section64);
StringRef Data = MachOObj->getData(SectionOffset, sizeof(MachOFormat::Section64));
@@ -547,7 +548,7 @@ static StringRef parseSegmentOrSectionNa
}
ArrayRef<char> MachOObjectFile::getSectionRawName(DataRefImpl DRI) const {
- if (is64BitLoadCommand(MachOObj.get(), DRI)) {
+ if (is64BitLoadCommand(this, DRI)) {
const MachOFormat::Section64 *sec = getSection64(DRI);
return ArrayRef<char>(sec->Name);
} else {
@@ -565,7 +566,7 @@ error_code MachOObjectFile::getSectionNa
ArrayRef<char>
MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const {
- if (is64BitLoadCommand(MachOObj.get(), Sec)) {
+ if (is64BitLoadCommand(this, Sec)) {
const MachOFormat::Section64 *sec = getSection64(Sec);
return ArrayRef<char>(sec->SegmentName, 16);
} else {
@@ -581,7 +582,7 @@ StringRef MachOObjectFile::getSectionFin
error_code MachOObjectFile::getSectionAddress(DataRefImpl DRI,
uint64_t &Result) const {
- if (is64BitLoadCommand(MachOObj.get(), DRI)) {
+ if (is64BitLoadCommand(this, DRI)) {
const MachOFormat::Section64 *Sect = getSection64(DRI);
Result = Sect->Address;
} else {
@@ -593,7 +594,7 @@ error_code MachOObjectFile::getSectionAd
error_code MachOObjectFile::getSectionSize(DataRefImpl DRI,
uint64_t &Result) const {
- if (is64BitLoadCommand(MachOObj.get(), DRI)) {
+ if (is64BitLoadCommand(this, DRI)) {
const MachOFormat::Section64 *Sect = getSection64(DRI);
Result = Sect->Size;
} else {
@@ -605,7 +606,7 @@ error_code MachOObjectFile::getSectionSi
error_code MachOObjectFile::getSectionContents(DataRefImpl DRI,
StringRef &Result) const {
- if (is64BitLoadCommand(MachOObj.get(), DRI)) {
+ if (is64BitLoadCommand(this, DRI)) {
const MachOFormat::Section64 *Sect = getSection64(DRI);
Result = MachOObj->getData(Sect->Offset, Sect->Size);
} else {
@@ -617,7 +618,7 @@ error_code MachOObjectFile::getSectionCo
error_code MachOObjectFile::getSectionAlignment(DataRefImpl DRI,
uint64_t &Result) const {
- if (is64BitLoadCommand(MachOObj.get(), DRI)) {
+ if (is64BitLoadCommand(this, DRI)) {
const MachOFormat::Section64 *Sect = getSection64(DRI);
Result = uint64_t(1) << Sect->Align;
} else {
@@ -629,7 +630,7 @@ error_code MachOObjectFile::getSectionAl
error_code MachOObjectFile::isSectionText(DataRefImpl DRI,
bool &Result) const {
- if (is64BitLoadCommand(MachOObj.get(), DRI)) {
+ if (is64BitLoadCommand(this, DRI)) {
const MachOFormat::Section64 *Sect = getSection64(DRI);
Result = Sect->Flags & macho::SF_PureInstructions;
} else {
@@ -730,7 +731,7 @@ relocation_iterator MachOObjectFile::get
}
relocation_iterator MachOObjectFile::getSectionRelEnd(DataRefImpl Sec) const {
uint32_t last_reloc;
- if (is64BitLoadCommand(MachOObj.get(), Sec)) {
+ if (is64BitLoadCommand(this, Sec)) {
const MachOFormat::Section64 *Sect = getSection64(Sec);
last_reloc = Sect->NumRelocationTableEntries;
} else {
More information about the llvm-commits
mailing list