Now two replacements are considered order-independent if applying them in
either order produces the same result. These include (but not restricted
to) replacements that:
- don't overlap (being directly adjacent is fine) and
- are overlapping deletions.
- are insertions at the same offset and applying them in either order has the same effect, i.e. X + Y = Y + X if one inserts text X and the other inserts text Y.
Discussion about this design can be found in D24717
sorry, probably i am late to the party,
however i'd like to ask how this method is supposed to be used by the customers of this code.
If i'm not mistaken we have some concrete examples in clang-extra-tools: for instance @omtcyfz referred to this diff on https://reviews.llvm.org/D24914.
Basically after this diff the class Replacements contains several methods (add, mergeIfOrderIndependent etc), but mergeIfOrderIndependent potentially will copy a lot of replacements (i don't know if the perf is a real issue here, but at least it looks a bit strange to me).
Another question - how are the customers of this code supposed to use the method add ? still suppress the error (like what was happening on https://reviews.llvm.org/D24914) ?
Am i missing smth ?
cc: @klimek, @djasper.