To factor out the common part.
Details
Diff Detail
- Repository
- rLLD LLVM Linker
- Build Status
Buildable 29869 Build 29868: arc lint + arc unit
Event Timeline
I'm not sure if this is an improvement. Sometimes, I actually like separating functions even if the separated functions have some amount of common code. It's like writing documents in a natural language -- sometimes you want to repeat the same thing in two different paragraphs to make it easier to understand. It feels to me that this is that kind of situation.
I agree with this point: making duplication if it helps readability. And I noticed that rLLD357373 was the recent interpretation of this rule. I did think over before creating this, and i think it slightly improves readability.
IMHO, after merging, the common/different parts are emphasized and it stops a reader from asking "what the two functions have in common and what are their differences?" (I asked myself this question while reading it because the shared parts are not too trivial: if (!shouldDefineSym(Cmd)), uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT;, replaceSymbol<Defined> and the different choices of placeholder st_value).