[clang] [clang] Fix segmentation fault caused by stack overflow on deeply nested expressions (PR #111701)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 02:47:34 PDT 2024


================
@@ -1596,6 +1597,19 @@ void CodeGenModule::ErrorUnsupported(const Decl *D, const char *Type) {
   getDiags().Report(Context.getFullLoc(D->getLocation()), DiagID) << Msg;
 }
 
+void CodeGenModule::warnStackExhausted(SourceLocation Loc) {
+  // Only warn about this once.
+  if (!WarnedStackExhausted) {
+    getDiags().Report(Loc, diag::warn_stack_exhausted);
+    WarnedStackExhausted = true;
+  }
+}
----------------
ilya-biryukov wrote:

SGTM and also feels like something that we could do in a follow-up, even if the code here is duplicated for some short period of time.

I suspect there's some wiring up to figure out for sharing this in the same class, so it'd be good to land this while that's still happening.

https://github.com/llvm/llvm-project/pull/111701


More information about the cfe-commits mailing list