-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Overview
Build a control flow graph (CFG) for Zig functions to enable path-sensitive lint rules.
What it unlocks
- Unreachable code detection
- Guaranteed null/error handling on all paths
- Use-after-free / use-after-move patterns
- Variable definitely-assigned checks
- Implement zlint rule 'returned-stack-reference' #13 (returned-stack-reference)
- Implement zlint rule 'useless-error-return' #17 (useless-error-return)
What's involved
- Build a CFG from the AST — basic blocks connected by edges for branches (
if,switch,while,for),break,continue,return,try/catch - Handle Zig-specific constructs —
errdefer,defer, comptime branches, labeled blocks - Path analysis — walk all paths for "does X happen on every/any path" questions
ZIR may help since it linearizes some of these constructs already.
Status
Not yet committed to. Tracking this so rules that need it have a place to point to.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request