[RuntimeDyld] Add accessors to `SectionEntry`; NFC
Summary:
Remove naked access to the data members in `SectionEntry` and route
accesses through accessor functions. This makes it obvious how the
instances of the class are used, and will also facilitate adding bounds
checking to `advanceStubOffset` in a later change.
Reviewers: lhames, loladiro, andrew.w.kaylor
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14674
llvm-svn: 253918
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
index 18a555a..58ce88a 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
@@ -799,11 +799,10 @@
unsigned SectionID = SectionInfo->SectionID;
uint64_t Addr;
if (IsInsideLoad)
- Addr =
- static_cast<uint64_t>(
- reinterpret_cast<uintptr_t>(getRTDyld().Sections[SectionID].Address));
+ Addr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(
+ getRTDyld().Sections[SectionID].getAddress()));
else
- Addr = getRTDyld().Sections[SectionID].LoadAddress;
+ Addr = getRTDyld().Sections[SectionID].getLoadAddress();
return std::make_pair(Addr, std::string(""));
}
@@ -835,11 +834,11 @@
uint64_t Addr;
if (IsInsideLoad) {
- uintptr_t SectionBase =
- reinterpret_cast<uintptr_t>(getRTDyld().Sections[SectionID].Address);
+ uintptr_t SectionBase = reinterpret_cast<uintptr_t>(
+ getRTDyld().Sections[SectionID].getAddress());
Addr = static_cast<uint64_t>(SectionBase) + StubOffset;
} else {
- uint64_t SectionBase = getRTDyld().Sections[SectionID].LoadAddress;
+ uint64_t SectionBase = getRTDyld().Sections[SectionID].getLoadAddress();
Addr = SectionBase + StubOffset;
}
@@ -855,16 +854,16 @@
const auto &SymInfo = pos->second;
uint8_t *SectionAddr = getRTDyld().getSectionAddress(SymInfo.getSectionID());
return StringRef(reinterpret_cast<const char *>(SectionAddr) +
- SymInfo.getOffset(),
- getRTDyld().Sections[SymInfo.getSectionID()].Size -
- SymInfo.getOffset());
+ SymInfo.getOffset(),
+ getRTDyld().Sections[SymInfo.getSectionID()].getSize() -
+ SymInfo.getOffset());
}
void RuntimeDyldCheckerImpl::registerSection(
StringRef FilePath, unsigned SectionID) {
StringRef FileName = sys::path::filename(FilePath);
const SectionEntry &Section = getRTDyld().Sections[SectionID];
- StringRef SectionName = Section.Name;
+ StringRef SectionName = Section.getName();
Stubs[FileName][SectionName].SectionID = SectionID;
}
@@ -874,7 +873,7 @@
const RuntimeDyldImpl::StubMap &RTDyldStubs) {
StringRef FileName = sys::path::filename(FilePath);
const SectionEntry &Section = getRTDyld().Sections[SectionID];
- StringRef SectionName = Section.Name;
+ StringRef SectionName = Section.getName();
Stubs[FileName][SectionName].SectionID = SectionID;