[PATCH] D124915: Check for resource exhaustion when recursively parsing declarators

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 09:55:20 PDT 2022


erichkeane added a comment.

I don't see how you can test this behavior without figuring out how to get a 'perfect' number to warn but not crash... The only way to validate that I would expect would be to do some bizarre flag that has us just 'don't run' in the case where the warning is emitted, but that would be strange/only used for the test.

Note that I think you might have an improper comment on the `Parser::runWithSufficientStackSpace`, else we perhaps wish to combine the Sema.cpp and Parser.cpp implementations in some way.



================
Comment at: clang/include/clang/Parse/Parser.h:802
+  /// more in that case. Use this in code that may recurse deeply (for example,
+  /// in template instantiation) to avoid stack overflow.
+  void runWithSufficientStackSpace(SourceLocation Loc,
----------------
Hmm... The Parser version of this might be used for Template Instantiation?  Should we remove the SEMA one and move all uses to the Parser then?


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

https://reviews.llvm.org/D124915



More information about the cfe-commits mailing list