ioeric added a comment.
In https://reviews.llvm.org/D24717#546279, @djasper wrote:
> I actually think this is a good example. So lets assume we'd write a tool to
> fully quote binary expressions, e.g. that turns
> if (a * b + c * d == 10) ...
> if (((a * b) + (c * d)) == 10) ...
> So, here, we would be inserting two "(" and two ")" at the same locations.
> And, as you correctly mention, the order doesn't matter because we are
> inserting the same string twice. I think this is actually good behavior.
I agree that this is good behavior.
> Deduplication is an interesting concern, but I think we probably want to
> handle that at a different layer. E.g. in the use case above, deduplicating
> would be quite fatal :).
Okay, it does make more sense to handle deduplication in a different layer.
So, with this assumption, the implementation should be much easier now: when
there is conflict found in `add`, check this condition. If `A` and `B` are
`order-dependent` as defined above, we then
`merge(getReplacementInChangedCode(B))` into the set.
cfe-commits mailing list