[PATCH] D64281: [Object] Create MutableELFObject Class for Doing Mutations on ELFObjectFiles [Part 1]

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 13:59:41 PDT 2019


jakehehrlich added a comment.

Sorry there's a lot for me to catch up on it would seem. Would it be possible to get an  of how having a mutable subclass of ELFObjectFile works us towards our goal of having a library?



================
Comment at: llvm/include/llvm/Object/MutableELFObject.h:86-89
+template <typename ELFT>
+void MutableELFObject<ELFT>::moveSectionNext(DataRefImpl &Sec) const {
+  ++Sec.p;
+}
----------------
It seems like you're trynig to implement an iterator here. Why not make a mutable section iterator? 'getMutableSection would become dereference and this would become increment.


================
Comment at: llvm/include/llvm/Object/MutableELFObject.h:103
+template <typename ELFT>
+uint64_t MutableELFObject<ELFT>::getSectionAddress(DataRefImpl Sec) const {
+  MappingType Mapping = Sections[Sec.p];
----------------
Are we overriding these getFoo methods? They all seem really bad. Just make one method that returns a mutable section and let the user get the data they need from there.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64281/new/

https://reviews.llvm.org/D64281





More information about the llvm-commits mailing list