[PATCH] D93688: [ASTMatchers] Ensure that we can match inside lambdas

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 14:36:40 PST 2021


alexfh added a comment.

In D93688#2525947 <https://reviews.llvm.org/D93688#2525947>, @alexfh wrote:

> This patch causes practically infinite traversal times on code that contains deeply nested lambdas. I'll try to get a suitable repro, but could you maybe revert this in the meantime?

Actually, there's a very simple test case:

  void f() {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    [] {
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
    }();
  }

It looks like each lambda traversal triggers multiple traversals of the same AST fragment causing exponential growth of the traversal time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93688



More information about the cfe-commits mailing list