20 class DeclNameOption final :
public OptionalRefactoringOption<std::string> {
22 StringRef getName()
const {
return "name"; }
23 StringRef getDescription()
const {
24 return "Name of the extracted declaration";
30 class ExtractRefactoring final :
public RefactoringAction {
32 StringRef getCommand()
const override {
return "extract"; }
34 StringRef getDescription()
const override {
35 return "(WIP action; use with caution!) Extracts code into a new function";
42 Rules.push_back(createRefactoringActionRule<ExtractFunction>(
43 CodeRangeASTSelectionRequirement(),
44 OptionRequirement<DeclNameOption>()));
49 class OldQualifiedNameOption :
public RequiredRefactoringOption<std::string> {
51 StringRef getName()
const override {
return "old-qualified-name"; }
52 StringRef getDescription()
const override {
53 return "The old qualified name to be renamed";
57 class NewQualifiedNameOption :
public RequiredRefactoringOption<std::string> {
59 StringRef getName()
const override {
return "new-qualified-name"; }
60 StringRef getDescription()
const override {
61 return "The new qualified name to change the symbol to";
65 class NewNameOption :
public RequiredRefactoringOption<std::string> {
67 StringRef getName()
const override {
return "new-name"; }
68 StringRef getDescription()
const override {
69 return "The new name to change the symbol to";
75 class LocalRename final :
public RefactoringAction {
77 StringRef getCommand()
const override {
return "local-rename"; }
79 StringRef getDescription()
const override {
80 return "Finds and renames symbols in code with no indexer support";
87 Rules.push_back(createRefactoringActionRule<RenameOccurrences>(
88 SourceRangeSelectionRequirement(), OptionRequirement<NewNameOption>()));
90 Rules.push_back(createRefactoringActionRule<QualifiedRenameRule>(
91 OptionRequirement<OldQualifiedNameOption>(),
92 OptionRequirement<NewQualifiedNameOption>()));
100 std::vector<std::unique_ptr<RefactoringAction>> Actions;
102 Actions.push_back(llvm::make_unique<LocalRename>());
103 Actions.push_back(llvm::make_unique<ExtractRefactoring>());
110 return createActionRules();
Dataflow Directional Tag Classes.
Provides an action to rename every symbol at a point.