This is an archive of the discontinued LLVM Phabricator instance.

Add `replace` interface with range in AtomicChange.
ClosedPublic

Authored by hokein on Mar 30 2017, 2:20 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Mar 30 2017, 2:20 AM
ioeric edited edge metadata.Mar 30 2017, 2:27 AM

Please see comment from a previous patch (https://reviews.llvm.org/D27054?id=79099#inline-234270). Generally, AtomicChange is a higher level of abstraction than Replacement, and we don't want users to deal with Replacement and the related errors.

hokein updated this revision to Diff 93456.Mar 30 2017, 2:43 AM

Get rid of Replacement, and implement "replace" interface with range.

hokein retitled this revision from Add `addReplacement` interface in AtomicChange. to Add `replace` interface with range in AtomicChange..Mar 30 2017, 2:44 AM

to avoid misunderstanding - are the tools like clang-rename, change-namespace and clang-reorder-fields supposed to use AtomicChange (via the methods insert, replace etc) ?
(i am asking just to make sure i understand correctly the intentions behind AtomicChange interface)

In D31492#713908, @alexshap wrote:

to avoid misunderstanding - are the tools like clang-rename, change-namespace and clang-reorder-fields supposed to use AtomicChange (via the methods insert, replace etc) ?
(i am asking just to make sure i understand correctly the intentions behind AtomicChange interface)

In the future, yes. We have a plan to redesign ClangTool interface and the refactoring infrastructure (e.g. to support multi-TU/codebase-wide refactoring) which would use AtomicChange interface in the user level.

hokein updated this revision to Diff 93467.Mar 30 2017, 4:55 AM

Rebase to master.

Could you add a simple test?

hokein updated this revision to Diff 93472.Mar 30 2017, 6:04 AM

Add unittest.

ioeric accepted this revision.Mar 30 2017, 6:06 AM

Looks good and thanks for the cleanup.

This revision is now accepted and ready to land.Mar 30 2017, 6:06 AM
This revision was automatically updated to reflect the committed changes.

are the tools like clang-rename, change-namespace and clang-reorder-fields supposed to use AtomicChange (via the methods insert, replace etc) ?

Yeah. We are using AtomicChange in clang-rename refinement (D31176).