This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Implement LLVM-style casting for OutputSectionBase<ELFT> derived classes
ClosedPublic

Authored by evgeny777 on Aug 10 2016, 7:25 AM.

Details

Reviewers
ruiu
Summary

This will be useful for linker script symbol processing, because symbols inside OutputSection, MergeOutputSection and EhOutputSection should be process in different ways.

Diff Detail

Event Timeline

evgeny777 updated this revision to Diff 67518.Aug 10 2016, 7:25 AM
evgeny777 retitled this revision from to [ELF] Implement LLVM-style casting for OutputSectionBase<ELFT> derived classes.
evgeny777 updated this object.
evgeny777 added a reviewer: ruiu.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: grimar, emaste, davide and 2 others.
grimar added inline comments.Aug 10 2016, 7:47 AM
ELF/OutputSections.h
73

Unsorted.

108

Do you need this ?

evgeny777 updated this revision to Diff 67520.Aug 10 2016, 7:53 AM
evgeny777 removed rL LLVM as the repository for this revision.

Addressed review comments

ruiu accepted this revision.Aug 10 2016, 11:03 AM
ruiu edited edge metadata.

LGTM

ELF/OutputSections.h
52

I don't think we need Base because all OutputSectionBases are of Base class. You'll never need to do cast<OutputSectionBase<ELFT>>(P).

139

We usually pass a Kind to the base class's ctor, but this way seems OK because we already have virtual member functions.

This revision is now accepted and ready to land.Aug 10 2016, 11:03 AM
evgeny777 added inline comments.Aug 10 2016, 11:05 AM
ELF/OutputSections.h
52

Out<ELFT>::ProgramHeaders are of type OutputSectionBase<ELFT>, so I can't make getKind() pure virtual in this class.

evgeny777 closed this revision.Aug 11 2016, 5:38 AM