klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

LG



================
Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:468
+    // Memoize result even doing a single-level match, it might be expensive.
+    Key.Type = MaxDepth == 1 ? MatchType::Child : MatchType::Descendants;
     MemoizationMap::iterator I = ResultCache.find(Key);
----------------
sammccall wrote:
> sammccall wrote:
> > This line looks a lot like a cache-poisoning bug, until realizing that 
> > MaxDepth is never actually used as an integer, it's a boolean - 1 means 
> > non-recursive and 0 means recursive. (Note that the recursive call passes 
> > MaxDepth, not MaxDepth-1).
> > I guess we should just fix the type, actually bounding the depth doesn't 
> > seem likely to be done anytime soon.
> er, 1 means non-recursive and anything else means recursive...
That sounds like a historical reason - feel free to change :) (I don't even 
remember how that came to be).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82771



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to