[clang] [clang] Deduplicate the logic that only warns once when stack is almost full (PR #112371)

Boaz Brickner via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 16 02:01:23 PDT 2024


================
@@ -1183,7 +1181,7 @@ class Sema final : public SemaBase {
   std::optional<std::unique_ptr<DarwinSDKInfo>> CachedDarwinSDKInfo;
   bool WarnedDarwinSDKInfoMissing = false;
 
-  bool WarnedStackExhausted = false;
+  SingleWarningStackAwareExecutor StackAwareExecutor;
----------------
bricknerb wrote:

Yes, I considered that and it seems somewhat to add some complexity.
Assuming the same code might hit this in both Sema and CodeGen, I don't see a reason the user should see this warning twice.
If Sema and CodeGen would typically be hitting different use cases, it might make sense, but I don't think that's the case.
It's anyways beyond the scope of this change, and we could consider it as a future improvement, though I doubt it should be high priority.

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


More information about the cfe-commits mailing list