Skip to content

feat(ast): function pointers, designator decay, and indirect call - #75

Merged
rieske merged 5 commits into
masterfrom
feature/function-pointers
Jul 25, 2026
Merged

feat(ast): function pointers, designator decay, and indirect call#75
rieske merged 5 commits into
masterfrom
feature/function-pointers

Conversation

@rieske

@rieske rieske commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Function designators decay to pointer-to-function (FunctionAddress IR)
  • Assignment fp = f / fp = &f and call-through fp() / (*fp)()
  • Indirect Call + StackMachine::callProcedureIndirect (callee in r10)
  • Functional FunctionPointersTest; designator-as-argument accepted; designator→int still rejected

Stack

PR F of remaining track. Base: #74 (initializers) → #73 (structs).

Test plan

  • Full local ctest
  • CI green / coverage non-regression

@mergify

mergify Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@rieske
rieske force-pushed the feature/initializers branch from 4a601af to f77f691 Compare July 24, 2026 13:39
@rieske
rieske force-pushed the feature/function-pointers branch from e5de99e to fd63bb8 Compare July 24, 2026 13:39
@rieske
rieske force-pushed the feature/initializers branch from f77f691 to 4c02dfb Compare July 24, 2026 13:57
@rieske
rieske force-pushed the feature/function-pointers branch from fd63bb8 to 68f37b7 Compare July 24, 2026 13:59
@coveralls

coveralls commented Jul 24, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 93.217% (+0.02%) from 93.196% — feature/function-pointers into master

@rieske
rieske force-pushed the feature/initializers branch from 4c02dfb to 6755713 Compare July 24, 2026 14:09
@rieske
rieske force-pushed the feature/function-pointers branch from 68f37b7 to 7f32ac9 Compare July 24, 2026 14:11
@rieske
rieske force-pushed the feature/initializers branch from 6755713 to ba5ca80 Compare July 25, 2026 06:32
@rieske
rieske force-pushed the feature/function-pointers branch from c38b703 to 7f8f730 Compare July 25, 2026 06:32
@rieske
rieske force-pushed the feature/initializers branch from ba5ca80 to 8fce1b7 Compare July 25, 2026 07:19
@rieske
rieske force-pushed the feature/function-pointers branch from 7f8f730 to fbae320 Compare July 25, 2026 07:19
@rieske
rieske force-pushed the feature/initializers branch from 8fce1b7 to eac2cee Compare July 25, 2026 07:31
@rieske
rieske force-pushed the feature/function-pointers branch from fbae320 to 7cabc36 Compare July 25, 2026 07:31
@rieske
rieske force-pushed the feature/initializers branch from eac2cee to 7e7148f Compare July 25, 2026 07:54
@rieske
rieske force-pushed the feature/function-pointers branch from 7cabc36 to 5c794b0 Compare July 25, 2026 07:54
rieske added a commit that referenced this pull request Jul 25, 2026
- Remove dead FP codegen (functionAddress, indirect Call, r10 helper)
- Call is direct-only until #75
- Drop unused FunctionDesignatorPlan from AddressPlan on this PR
- Unit tests: TypeQuery + AnnotationStore
- More StructsTest paths (errors, nested, sizeof, whole assign)
@rieske
rieske force-pushed the feature/initializers branch from 7e7148f to a1c41a5 Compare July 25, 2026 08:19
@rieske
rieske force-pushed the feature/function-pointers branch 2 times, most recently from 33b6104 to eb89c52 Compare July 25, 2026 11:30
@rieske
rieske force-pushed the feature/initializers branch from a1c41a5 to 28e11ea Compare July 25, 2026 11:30
@rieske
rieske force-pushed the feature/function-pointers branch from eb89c52 to b98f978 Compare July 25, 2026 11:33
@rieske
rieske force-pushed the feature/initializers branch from 28e11ea to 25bffc1 Compare July 25, 2026 11:33
@rieske
rieske force-pushed the feature/function-pointers branch from b98f978 to 3fcfb8c Compare July 25, 2026 11:44
@rieske
rieske force-pushed the feature/initializers branch from 25bffc1 to 20ee8fb Compare July 25, 2026 11:44
rieske added a commit that referenced this pull request Jul 25, 2026
- Cover unscopedSymbolName and non-function call error paths
- Unit-test functionAddress and callProcedureIndirect (reg + mem)
- Drop dead designator/call fallbacks SA never takes
Base automatically changed from feature/initializers to master July 25, 2026 12:07
rieske added 3 commits July 25, 2026 15:07
- Expression::FunctionDesignator + FunctionDesignatorPlan on store
- CallPlan.indirect for indirect calls; FunctionAddress IR
- resolveCallee Direct|Indirect; collapsed designator lookup
- FunctionPointersTest + fuzz coverage
Re-introduce FunctionDesignatorPlan, indirect Call, and StackMachine
functionAddress / callProcedureIndirect on the FP tip after #73 removed
them to recover Coveralls.
- Cover unscopedSymbolName and non-function call error paths
- Unit-test functionAddress and callProcedureIndirect (reg + mem)
- Drop dead designator/call fallbacks SA never takes
@rieske
rieske force-pushed the feature/function-pointers branch from 3a99003 to d1f5e6a Compare July 25, 2026 12:07
rieske added 2 commits July 25, 2026 15:21
- Drop designatorName from Expression; FunctionDesignatorPlan is the label
- CallPlan.kind is Direct|Indirect (remove unused Normal + bool)
- resolveCallee returns optional Callee; typecheck before setCallPlan
- CG * on pointer-to-function uses TypeQuery, not missing lvalue
- Remove unused FunctionCall setSymbol/getSymbol (call shape is store-only)
- IR Call carries CallPlan::Kind instead of a parallel bool
- Assert designator form always has FunctionDesignatorPlan
@rieske
rieske merged commit aede15c into master Jul 25, 2026
4 checks passed
@rieske
rieske deleted the feature/function-pointers branch July 25, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants