defer: enable loop lowering

This commit is contained in:
Li Jie
2025-10-15 13:36:52 +08:00
parent 3f8c95cf87
commit 16709411a0
18 changed files with 418 additions and 52 deletions

View File

@@ -261,7 +261,7 @@ All Go syntax (including `cgo`) is already supported. Here are some examples:
### Defer
LLGo `defer` does not support usage in loops. This is not a bug but a feature, because we think that using `defer` in a loop is a very unrecommended practice.
LLGo now supports `defer` within loops, matching Go's semantics of executing defers in LIFO order for every iteration. The usual caveat from Go still applies: be mindful of loop-heavy defer usage because it allocates per iteration.
### Garbage Collection (GC)