This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Add getOffset to ELFSectionRef and enable LLVM casting for it
ClosedPublic

Authored by evgeny777 on Oct 28 2016, 7:58 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 76191.Oct 28 2016, 7:58 AM
evgeny777 retitled this revision from to [ELF] Add getOffset to ELFSectionRef and enable LLVM casting for it.
evgeny777 updated this object.
evgeny777 added reviewers: rafael, hans, grimar.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: ikudrin, llvm-commits.
ruiu added inline comments.Oct 28 2016, 11:28 AM
include/llvm/Object/ELFObjectFile.h
99–101 ↗(On Diff #76191)

Why do you want this?

I have Sectio

include/llvm/Object/ELFObjectFile.h
99–101 ↗(On Diff #76191)

I have SectionRef object and I want to get section offset, which is ELF section property.
With this I can write:

cast<ELFSectionRef>(S)->getOffset();

Without it I have to use this one:

cast<ELFObjectFileBase>(S->getObject())->getSectionOffset(S->getRawDataRefImpl());
rafael edited edge metadata.Oct 28 2016, 1:09 PM

The part adding getSectionOffset LGTM, but I agree with Rui that it is odd to have classof in only part of the hierarchy.

rafael accepted this revision.Oct 28 2016, 1:09 PM
rafael edited edge metadata.
This revision is now accepted and ready to land.Oct 28 2016, 1:09 PM
This revision was automatically updated to reflect the committed changes.