[all-commits] [llvm/llvm-project] 625761: [ASTMatchers] Avoid recursion in ancestor matching...

Sam McCall via All-commits all-commits at lists.llvm.org
Tue Sep 22 10:44:15 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 625761825620f19a44c7a1482ce05d678a1b0deb
      https://github.com/llvm/llvm-project/commit/625761825620f19a44c7a1482ce05d678a1b0deb
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-09-22 (Tue, 22 Sep 2020)

  Changed paths:
    M clang/lib/ASTMatchers/ASTMatchFinder.cpp

  Log Message:
  -----------
  [ASTMatchers] Avoid recursion in ancestor matching to save stack space.

A recent change increased the stack size of memoizedMatchesAncestorOfRecursively
leading to stack overflows on real code involving large fold expressions.
It's not totally unreasonable to choke on very deep ASTs, but as common
infrastructure it's be nice if ASTMatchFinder is more robust.
(It already uses data recursion for the regular "downward" traversal.)

Differential Revision: https://reviews.llvm.org/D86964




More information about the All-commits mailing list