This patch adds initial support for refactoring options. One can now use optional and required std::string options.
The options are implemented in the following manner:
- A base interface RefactoringOption declares methods that describe the option's name, description and whether or not it's required. It also declares a method that takes in a RefactoringOptionConsumer that will visit the option and its typed value.
- A visitor interface RefactoringOptionConsumer declares the handle methods that provide an overload for each valid option type (std::string, etc).
- Classes OptionalRequiredOption and RequiredRefactoringOption partially implement the RefactoringOption interface, store the value and provide a getter for the value. The individual options then just have to implement getName and getDescription.
- The RefactoringOptionsRequirement is a base requirement class the declares a method that can returns all of the options used in a single requirement.
- The OptionRequirement class is a helper class that implements a refactoring action rule requirement for a particular option.
clang-refactor now creates command-line arguments for each unique option used by all rules in an action.
This patch also adds a NewNameOption for the local-rename refactoring action to ensure that options work.
Thought it a bit more: it requires all of the requirements are satisfied, I think we need to support "one-of" option. For example, we have two option "-a" and "-b", only one of them is allowed to be present at the same time.