[PATCH] D72531: Set traversal explicitly where needed in tests

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 15 05:53:25 PDT 2020


aaron.ballman added a comment.

In D72531#1845686 <https://reviews.llvm.org/D72531#1845686>, @shafik wrote:

> I was looking at the changes to `ASTImporterTest.cpp` and it not obvious to me how you determined where it was needed.


Some of the changes were reasonably obvious to me because they involved matching implicit nodes that require the as-is traversal. However, other changes did seem to come from out of nowhere (I commented on one such), and hopefully @steveire will explain.



================
Comment at: clang/unittests/Tooling/StencilTest.cpp:63
   ASTContext &Context = AstUnit->getASTContext();
-  auto Matches = ast_matchers::match(wrapMatcher(Matcher), Context);
+  auto Matches = ast_matchers::match(
+      traverse(ast_type_traits::TK_AsIs, wrapMatcher(Matcher)), Context);
----------------
Was this change made because you didn't want to accept the traversal mode as a parameter to `matchStmt` and force each caller to decide which mode they use? Or is there some other reason why this change was needed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72531





More information about the cfe-commits mailing list