This is an archive of the discontinued LLVM Phabricator instance.

Fix quadratic runtime when adding items to tooling::Replacements.
ClosedPublic

Authored by klimek on Aug 3 2016, 5:40 AM.

Diff Detail

Event Timeline

klimek updated this revision to Diff 66650.Aug 3 2016, 5:40 AM
klimek retitled this revision from to Fix quadratic runtime when adding items to tooling::Replacements..
klimek updated this object.
klimek added reviewers: djasper, bkramer, ioeric.
klimek added a subscriber: cfe-commits.
klimek updated this revision to Diff 66651.Aug 3 2016, 5:59 AM

Remove re-implementation of overlaps check.

klimek updated this revision to Diff 66661.Aug 3 2016, 7:02 AM

Fix bugs around marker replacements that neither insert nor delete anything.

akuegel added a subscriber: akuegel.Aug 3 2016, 7:09 AM

lg

lib/Tooling/Core/Replacement.cpp
163

nit: "as there might an" -> "as there might be an".

This revision was automatically updated to reflect the committed changes.
ioeric added inline comments.Aug 3 2016, 7:34 AM
cfe/trunk/lib/Tooling/Core/Replacement.cpp
169 ↗(On Diff #66663)

I think we should ignore replacement text when checking equality between *I and R here.

klimek added inline comments.Aug 3 2016, 7:44 AM
cfe/trunk/lib/Tooling/Core/Replacement.cpp
169 ↗(On Diff #66663)

lower_bound already compares the replacement text, so as the comment says, unless I'm mistaken, this can only happen if R == AtEnd, which means that R has an empty replacement text.
Can you come up with a test that would break?