[PATCH] D23351: [ELF] Implement LLVM-style casting for OutputSectionBase<ELFT> derived classes
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 10 11:03:19 PDT 2016
ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: ELF/OutputSections.h:52
@@ +51,3 @@
+ enum Kind {
+ Base,
+ BuildId,
----------------
I don't think we need `Base` because all OutputSectionBases are of Base class. You'll never need to do cast<OutputSectionBase<ELFT>>(P).
================
Comment at: ELF/OutputSections.h:138
@@ -110,1 +137,3 @@
uintX_t getNumEntries() const { return Entries.size(); }
+ typename Base::Kind getKind() const override { return Base::Got; }
+ static bool classof(const Base *B) { return B->getKind() == Base::Got; }
----------------
We usually pass a Kind to the base class's ctor, but this way seems OK because we already have virtual member functions.
https://reviews.llvm.org/D23351
More information about the llvm-commits
mailing list