31 WashCallbackFn callback_ptr;
33 WashMatchCallback(WashCallbackFn callback_ptr) : callback_ptr(callback_ptr), RefactoringCallback() {}
35 virtual void run(
const MatchFinder::MatchResult& Result) { callback_ptr(Result, this->getReplacements()); }
37 WashCallbackFn getCallback() {
return callback_ptr; }
40 os <<
"WashMatchCallback[ WashCallbackFn(" << obj.callback_ptr <<
")->" 41 <<
reinterpret_cast<const void*
>(obj.callback_ptr) <<
"]";
52 std::variant<StatementMatcher*, DeclarationMatcher*> matcher;
53 WashCallbackFn callbackfn_ptr;
56 : matcher(matcher_ptr), callbackfn_ptr(callback_ptr) {}
59 : matcher(matcher_ptr), callbackfn_ptr(callback_ptr) {}
61 WashCallbackFn getCallbackFn() {
return callbackfn_ptr; }
63 std::variant<StatementMatcher*, DeclarationMatcher*> getMatcher() {
return matcher; }
71 WashComputeFn computefn_ptr;
76 WashComputeFn getComputeFn() {
return computefn_ptr; }
84 const std::vector<std::string>* applicable_subset;
85 std::vector<WashRefactoringAction> ref_act;
86 std::vector<WashComputationAction> com_act;
92 : applicable_subset(std::holds_alternative<std::vector<std::string>*>(*actions.begin())
93 ? std::get<std::vector<std::string>*>(*actions.begin())
95 for (
auto i = actions.begin() + 1; i != actions.end(); i++) {
96 if (std::holds_alternative<WashRefactoringAction>(*i)) {
97 ref_act.push_back(std::get<WashRefactoringAction>(*i));
98 }
else if (std::holds_alternative<WashComputationAction>(*i)) {
99 com_act.push_back(std::get<WashComputationAction>(*i));
104 const std::vector<WashRefactoringAction>& actions()
const {
return ref_act; }
106 const std::vector<WashComputationAction>& computations()
const {
return com_act; }
108 const std::vector<std::string>* files()
const {
return applicable_subset; }
117 std::vector<RefactorPass> refactoring_stages;
121 : refactoring_stages(passes.begin(), passes.end()) {}
Developer defined registration of a refactoring action - a (<T>Matcher, CallbackFn) pair...
Definition: refactor.hpp:49
void runRefactoring(const WashOptions &opts)
Runs the wash refactoring application.
Definition: refactor.cpp:151
Define a function to be run at the end of the refactor pass. Computation Actions will be run in the o...
Definition: refactor.hpp:70
Options about how the Wash analysis will behave.
Definition: common.hpp:45
Contains methods to do with command line arugments and running on the command line.
A specialised refactoring callback type for Wash using custom function pointers instead of subclassin...
Definition: refactor.hpp:29
A pass of a refactoring tool over the source files running a series of actions defined.
Definition: refactor.hpp:82
Definition: arguments.cpp:3