================
@@ -4099,7 +4099,9 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
   // calls to Decl::getASTContext() by Decl's methods will find the
   // TranslationUnitDecl without crashing.
   D->setDeclContext(Context.getTranslationUnitDecl());
-  Reader.Visit(D);
+
+  // Reading some declarations can result in deep recursion.
+  SemaObj->runWithSufficientStackSpace(DeclLoc, [&] { Reader.Visit(D); });
----------------
ilya-biryukov wrote:

Could you elaborate in which sense it is non-meaningful for the purpose of 
calling this method?
I believe SemaObj is never null here (because it's used during deserialization 
of declarations). The only logic we have in `runWithSufficientStackSpace`, is 
to warn about stack exhaustion only once and actually show this warning.

I would still be using `Wstack-exhausted` here, not sure there is much useful 
context to add here (maybe a note about deserializing declarations, but this 
case is so rare I think we can live without it).

https://github.com/llvm/llvm-project/pull/79875
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to