ΒΆclang::transformer::EditGenerator
rewriteDescendants(
std::string NodeId,
clang::transformer::RewriteRule Rule)
clang::transformer::EditGenerator
rewriteDescendants(
std::string NodeId,
clang::transformer::RewriteRule Rule)
Description
Applies `Rule` to all descendants of the node bound to `NodeId`. `Rule` can refer to nodes bound by the calling rule. `Rule` is not applied to the node itself. For example, ``` auto InlineX = makeRule(declRefExpr(to(varDecl(hasName("x")))), changeTo(cat("3"))); makeRule(functionDecl(hasName("f"), hasBody(stmt().bind("body"))).bind("f"), flatten( changeTo(name("f"), cat("newName")), rewriteDescendants("body", InlineX))); ``` Here, we find the function `f`, change its name to `newName` and change all appearances of `x` in its body to `3`.
Declared at: clang/include/clang/Tooling/Transformer/RewriteRule.h:461
Parameters
- std::string NodeId
- clang::transformer::RewriteRule Rule