This patch depends on https://reviews.llvm.org/D36075 and https://reviews.llvm.org/D36156.
It introduces the clang-refactor tool alongside the local-rename action which is uses the existing renaming engine used by clang-rename. The tool doesn't actually perform the source transformations yet, it just provides testing support. I've moved one test from clang-rename over right now, but will move the others if the general direction of this patch is accepted.
The following options are supported by clang-refactor:
- -v: use verbose output
- -dump: dump results instead of applying them
- -no-dbs: avoid searching/loading databases like compilation database and/or indexer stores/databases
- -selection: The source range that corresponds to the portion of the source that's selected (currently only special command test:<file> is supported).
The testing support provided by clang-refactor is described below:
When -selection=test:<file> is given, clang-refactor will parse the selection commands from that file. The selection commands are grouped and the specified refactoring action invoked by the tool. Each command in a group is expected to produce an identical result. The precise syntax for the selection commands is described in a comment for findTestSelectionRangesIn in TestSupport.h.
Thanks for taking a look!
Please add documentation for the class.
I appreciate your RFC that explains all these concepts; it would be nice if you could move some key concepts into the code documentation since we couldn't expect future readers to refer to the RFC. Thanks! ;)