diff options
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; |
