[PATCH] D43996: [llvm-objcopy] Implement support for .group sections.

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 11:15:46 PST 2018


alexshap added a comment.

Many thanks for the comments and your attention, 
i can try to explain what improving the initialize method (and changing the class Section)  
would (ideally) buy us (imo): 
separation of concerns and better management of the complexity + (hopefully) less code.
(all of this is mostly motivated by the "single responsibility principle" and avoiding duplication).
So basically the idea is the following: the hierarchy of Section* classes should take care of all the details of sections internals + mutation of their content,
the higher-level class Object should manage the sections (by interacting with them via calling their methods in the appropriate order etc).
After some thinking it seems to me, that, in fact, the name of the class Section is not an issue here, it depends on how you view its responsibility: 
basically leaving the content unchanged can be considered as a "default" behavior (zero mutation) which can be overridden by the subclasses for particular types of sections.
To move forward here: what would you say to the following approach - i can play a little bit more with this code and then try to update this patch (to take a look at the bigger picture), 
then we'll see if it works out, if it doesn't & you strongly dislike the changes - then okay, we will fallback on your suggestions.


Repository:
  rL LLVM

https://reviews.llvm.org/D43996





More information about the llvm-commits mailing list