[PATCH] D80606: [libTooling] Fix Transformer to work with ambient traversal kinds

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 28 02:08:35 PDT 2020


gribozavr2 accepted this revision.
gribozavr2 added inline comments.


================
Comment at: clang/lib/Tooling/Transformer/RewriteRule.cpp:154
+    const RewriteRule &Rule,
+    ast_type_traits::TraversalKind DefaultTraversalKind) {
   // Map the cases into buckets of matchers -- one for each "root" AST kind,
----------------
I don't see any callers using the new argument. Do we need this flexibility?


================
Comment at: clang/unittests/Tooling/TransformerTest.cpp:574
 
+// Verifies that a rule with a matcher for an implicit node (like
+// `implicitCastExpr`) does not change the code, when the traversal kind is not
----------------
a matcher => a top-level matcher


================
Comment at: clang/unittests/Tooling/TransformerTest.cpp:575
+// Verifies that a rule with a matcher for an implicit node (like
+// `implicitCastExpr`) does not change the code, when the traversal kind is not
+// explicitly set ti TK_AsIs). In this test, only the rule with the
----------------
I'd say "when the AST traversal skips implicit nodes".


================
Comment at: clang/unittests/Tooling/TransformerTest.cpp:576
+// `implicitCastExpr`) does not change the code, when the traversal kind is not
+// explicitly set ti TK_AsIs). In this test, only the rule with the
+// explicit-node matcher will fire.
----------------
ti => to

AsIs) => AsIs


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80606/new/

https://reviews.llvm.org/D80606





More information about the cfe-commits mailing list