diff options
| author | Aotrix <[email protected]> | 2026-09-30 19:16:12 +0200 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2026-09-30 19:18:05 +0200 |
| commit | cf1afd9352f56d8765b66f785bd01964213f59c2 (patch) | |
| tree | c26e418190254729d8fe90e9411986b0abc47197 /removeFunctionCall.cpp | |
| parent | 3b441e77a5cd9eff9939e4c8e4a31a4f8f2845a2 (diff) | |
Bind call expression
Diffstat (limited to 'removeFunctionCall.cpp')
| -rw-r--r-- | removeFunctionCall.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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; |
