[clang] [clang-tools-extra] [Clang] Add support for the C `defer` TS (PR #162848)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 4 01:01:33 PST 2025


================
@@ -2000,6 +2004,80 @@ void CodeGenFunction::EmitDefaultStmt(const DefaultStmt &S,
   EmitStmt(S.getSubStmt());
 }
 
+namespace {
+struct EmitDeferredStatement final : EHScopeStack::Cleanup {
+  const DeferStmt &Stmt;
+  EmitDeferredStatement(const DeferStmt *Stmt) : Stmt(*Stmt) {}
+
+  void Emit(CodeGenFunction &CGF, Flags) override {
+    // Take care that any cleanups pushed by the body of the 'defer' don't
+    // clobber the current cleanup slot value.
----------------
cor3ntin wrote:

```suggestion
    // Take care that any cleanups pushed by the body of a 'defer' statement don't
    // clobber the current cleanup slot value.
```

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


More information about the cfe-commits mailing list