Skip to content

[AUTOMATED] Parse ternary C++ range-for initializers - #17

Merged
mahaloz merged 9 commits into
Noelo-Lab:mainfrom
sjkim1127:codex/cpp-range-for-ternary
Nov 9, 2026
Merged

mahaloz merged 9 commits into
Noelo-Lab:mainfrom
sjkim1127:codex/cpp-range-for-ternary

Conversation

@sjkim1127

Copy link
Copy Markdown

[AUTOMATED]

for (int value : choose ? a : b) treats the ternary colon as a second range delimiter and silently drops the entire loop. Recognize only the colon outside a conditional expression as the range delimiter. This preserves the conditional AST and the loop body.

Reproduced with the range header from Stockfish and minimal declarations. On the same reduced C++17 input, the restored normalized CFG matches Joern 4.0.150 in directed topology and entry/exit roles. Clang ran the reduction and selected the expected array for both values of the condition.

205 Rust tests, Clippy and formatting passed. Python ran 154 tests with 16 skips. All 12 corpus responses matched byte for byte, including eight successes and four existing rejections. Median CLI time on one unchanged C++ input was 16.73 vs 16.47 ms over ten alternating runs.

This is independent of #15, which fixes the separate range-for CFG lowering defect.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 00:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@mahaloz
mahaloz merged commit 2b730e0 into Noelo-Lab:main Nov 9, 2026
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.

3 participants