Fix quadratic runtime when adding items to tooling::Replacements.
authorManuel Klimek <klimek@google.com>
Wed, 3 Aug 2016 14:12:17 +0000 (14:12 +0000)
committerManuel Klimek <klimek@google.com>
Wed, 3 Aug 2016 14:12:17 +0000 (14:12 +0000)
commit7c12ee2f0bb2c9a06b9f59c288db1f441e55972d
tree4590bf39d74735a5a290b0e9fb8d38b856decb96
parentcd923188464cd004bcedf8e4cc5c9598c12b84c6
Fix quadratic runtime when adding items to tooling::Replacements.

Previously, we would search through all replacements when inserting a
new one to check for overlaps. Instead, make use of the fact that we
already have a set of replacments without overlaps to find the potential
overlap with lower_bound.

Differential Revision: https://reviews.llvm.org/D23119

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277597 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Tooling/Core/Replacement.cpp
unittests/Tooling/RefactoringTest.cpp