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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 05:29:42 PDT 2020


sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
sammccall requested review of this revision.

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 :-)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88222

Files:
  clang/lib/AST/ParentMapContext.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88222.294028.patch
Type: text/x-patch
Size: 5448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200924/25541ee1/attachment.bin>


More information about the cfe-commits mailing list