[PATCH] D82771: [ASTMatcher] Fix a performance regression: memorize the child match.

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 29 08:37:32 PDT 2020


klimek added inline comments.


================
Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:467
     Key.Traversal = Ctx.getParentMapContext().getTraversalKind();
-    Key.Type = MatchType::Descendants;
+    // Memorize result even doing a single-level match, it might be expensive.
+    Key.Type = MaxDepth == 1 ? MatchType::Child : MatchType::Descendants;
----------------
Here and below: s/memorize/memoize/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82771





More information about the cfe-commits mailing list