Lines Matching full:replacements
158 Replacements::getReplacementInChangedCode(const Replacement &R) const {
171 "existing replacements";
192 Replacements Replacements::getCanonicalReplacements() const {
194 // Merge adjacent replacements.
206 "Existing replacements must not overlap.");
214 return Replacements(NewReplacesImpl.begin(), NewReplacesImpl.end());
218 // has the same effect, so we need to compare replacements associated to
220 llvm::Expected<Replacements>
221 Replacements::mergeIfOrderIndependent(const Replacement &R) const {
222 Replacements Rs(R);
223 // A Replacements set containing a single replacement that is `R` referring to
224 // the code after the existing replacements `Replaces` are applied.
225 Replacements RsShiftedByReplaces(getReplacementInChangedCode(R));
226 // A Replacements set that is `Replaces` referring to the code after `R` is
228 Replacements ReplacesShiftedByRs;
237 // Since empty or segmented replacements around existing replacements might be
238 // produced above, we need to compare replacements in canonical forms.
246 llvm::Error Replacements::add(const Replacement &R) {
258 // This replacement cannot conflict with replacements that end before
260 // We also know that there currently are no overlapping replacements.
261 // Thus, we know that all replacements that start after the end of the current
290 // with any replacement before `I` since all replacements before `I` must
323 // replacements to see if they are order-independent. If they are, merge `R`
324 // with them and replace them with the merged replacements.
334 Replacements OverlapReplaces(MergeBegin, MergeEnd);
335 llvm::Expected<Replacements> Merged =
348 // overlapping replacements from 'First' and 'Second' in mergeReplacements.
351 // Offsets and lengths of the replacements can generally refer to two different
352 // coordinate spaces. Replacements from 'First' refer to the original text
353 // whereas replacements from 'Second' refer to the text after applying 'First'.
359 // We can correctly calculate this projection as we look at the replacements in
364 // versa. Within each set, the replacements are non-overlapping.
444 Replacements Replacements::merge(const Replacements &ReplacesToMerge) const {
450 // Delta is the amount of characters that replacements from 'Second' need to
457 // subsequent replacements as long as they overlap. See more details in the
479 return Replacements(Result.begin(), Result.end());
511 calculateRangesAfterReplacements(const Replacements &Replaces,
514 // - Turn \p Ranges into Replacements at (offset, length) with an empty
517 // - The new ranges will be the affected ranges of the merged replacements.
521 tooling::Replacements FakeReplaces;
527 "Replacements must not conflict since ranges have been merged.");
535 std::vector<Range> Replacements::getAffectedRanges() const {
547 unsigned Replacements::getShiftedCodePosition(unsigned Position) const {
568 bool applyAllReplacements(const Replacements &Replaces, Rewriter &Rewrite) {
581 const Replacements &Replaces) {
611 std::map<std::string, Replacements> groupReplacementsByFile(
613 const std::map<std::string, Replacements> &FileToReplaces) {
614 std::map<std::string, Replacements> Result;