Rename one of the getOffset methods.

It is sufficiently different in that it returns an offset in the input
file, not the output section.

llvm-svn: 297290
This commit is contained in:
Rafael Espindola 2017-03-08 15:57:17 +00:00
parent 373c182a07
commit 35ae65ee2b
4 changed files with 7 additions and 6 deletions

View File

@ -107,7 +107,7 @@ std::string elf::ObjectFile<ELFT>::getLineInfo(InputSectionBase *S,
// section. See comments for ObjectInfo class.
DILineInfo Info;
Tbl->getFileLineInfoForAddress(
S->getOffset() + Offset, nullptr,
S->getOffsetInFile() + Offset, nullptr,
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, Info);
if (Info.Line == 0)
return "";

View File

@ -93,7 +93,7 @@ size_t InputSectionBase::getSize() const {
return Data.size();
}
uint64_t InputSectionBase::getOffset() const {
uint64_t InputSectionBase::getOffsetInFile() const {
const uint8_t *FileStart = (const uint8_t *)File->MB.getBufferStart();
const uint8_t *SecStart = Data.begin();
return SecStart - FileStart;

View File

@ -63,7 +63,7 @@ public:
uint32_t Link;
uint32_t Info;
uint64_t getOffset() const;
uint64_t getOffsetInFile() const;
static InputSectionBase Discarded;

View File

@ -1733,7 +1733,8 @@ static InputSectionBase *findSection(ArrayRef<InputSectionBase *> Arr,
uint64_t Offset) {
for (InputSectionBase *S : Arr)
if (S && S != &InputSection::Discarded)
if (Offset >= S->getOffset() && Offset < S->getOffset() + S->getSize())
if (Offset >= S->getOffsetInFile() &&
Offset < S->getOffsetInFile() + S->getSize())
return S;
return nullptr;
}
@ -1752,8 +1753,8 @@ readAddressArea(DWARFContext &Dwarf, InputSection *Sec, size_t CurrentCU) {
for (std::pair<uint64_t, uint64_t> &R : Ranges)
if (InputSectionBase *S = findSection<ELFT>(Sections, R.first))
Ret.push_back({S, R.first - S->getOffset(), R.second - S->getOffset(),
CurrentCU});
Ret.push_back({S, R.first - S->getOffsetInFile(),
R.second - S->getOffsetInFile(), CurrentCU});
++CurrentCU;
}
return Ret;