From cf1afd9352f56d8765b66f785bd01964213f59c2 Mon Sep 17 00:00:00 2001 From: Aotrix <9aotrix@protonmail.com> Date: Wed, 30 Sep 2026 19:16:12 +0200 Subject: Bind call expression --- removeFunctionCall.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'removeFunctionCall.cpp') diff --git a/removeFunctionCall.cpp b/removeFunctionCall.cpp index b60070d..42d4645 100644 --- a/removeFunctionCall.cpp +++ b/removeFunctionCall.cpp @@ -151,8 +151,14 @@ int main(int argc, // changeTo(node(ArgId), transformer::maybeDeref(ArgId))); auto FunctionToRemove = functionDecl(matchesName("configValue")); - auto Rule = makeRule(callExpr(hasArgument(0, expr().bind("keyName")), callee(FunctionToRemove)), - changeTo(cat("true"))); + // FIXME: do not clean a function call if it used by strictly more than one parameter + // for instance if there is a ternary operator somewhere... + const std::string FunctionCallId{"x"}; + const std::string ExpectedValue("true"); + auto Rule = + makeRule(callExpr(hasArgument(0, hasDescendant(stringLiteral())), callee(FunctionToRemove)) + .bind(FunctionCallId), + transformer::changeTo(node(FunctionCallId), cat(ExpectedValue))); AtomicChanges AllChanges; -- cgit v1.2.3