diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | main.cc | 6 | ||||
| -rwxr-xr-x | remove.sh | 2 | ||||
| -rw-r--r-- | removeFunctionCall.cpp | 4 |
4 files changed, 6 insertions, 8 deletions
@@ -1 +1 @@ -./remove.sh file.cpp -parameter "NAME_OF_FUNCTION_PARAMETER" -value <true/false/"value"> +./remove.sh file.cpp -parameter "NAME_OF_FUNCTION_PARAMETER" -value <true/false> @@ -1,6 +1,6 @@ #include <iostream> -bool displayHello() +bool configValue(const std::string& iKey) { bool result; std::cin >> result; @@ -16,11 +16,11 @@ bool coucouEveryone() int main() { - if (displayHello()) + if (configValue("aparam")) { coucouEveryone(); } - if (!displayHello()) + if (!configValue("")) { std::cout << "Mouhahahaha I am a villain!\n"; } @@ -1,5 +1,5 @@ #!/usr/bin/env bash echo "Removing calls..." -./build/remove-function-call $1 +./build/remove-function-call $1 $2 clang-tidy $1 -checks=-*,readability-simplify-boolean-expr -fix >/dev/null 2>&1 echo "Done." diff --git a/removeFunctionCall.cpp b/removeFunctionCall.cpp index 3e0d4cb..2be2d9d 100644 --- a/removeFunctionCall.cpp +++ b/removeFunctionCall.cpp @@ -127,14 +127,12 @@ int main(int argc, StandaloneToolExecutor Executor(std::move(OptionsParser.get())); - std::string ArgId = "arg"; - // auto Rule = makeRule( // callExpr(callee(functionDecl(hasName("AwesomeFunc"))), // hasArgument(0, expr(hasType(pointerType())).bind(ArgId))), // changeTo(node(ArgId), transformer::maybeDeref(ArgId))); - auto functionToRemove = functionDecl(matchesName("displayHello")); + auto functionToRemove = functionDecl(matchesName("configValue")); auto Rule = makeRule(callExpr(callee(functionToRemove)), changeTo(cat("true"))); AtomicChanges AllChanges; |
