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

Boaz Brickner via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 00:48:18 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;
+  }
+}
----------------
bricknerb wrote:

I was thinking that as a follow up I will extract this small logic into a class which both Sema and CodeGen would own.
I also have https://github.com/llvm/llvm-project/pull/111799 to make them more similar.

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


More information about the cfe-commits mailing list