[all-commits] [llvm/llvm-project] 1ad946: [AST] Use data-recursion when building ParentMap, ...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Sep 24 13:50:28 PDT 2020


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

  Changed paths:
    M clang/lib/AST/ParentMapContext.cpp

  Log Message:
  -----------
  [AST] Use data-recursion when building ParentMap, avoid stack overflow.

The following crashes on my system before this patch, but not after:

  void foo(int i) {
    switch (i) {
      case 1:
      case 2:
      ... 100000 cases ...
        ;
    }
  }

  clang-query -c="match stmt(hasAncestor(stmt()))" deep.c

I'm not sure it's actually a sane testcase to run though, it's pretty slow :-)

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




More information about the All-commits mailing list