Skip to content

[AUTOMATED] Support C++20 range-for init-statements - #18

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

mahaloz merged 27 commits into
Noelo-Lab:mainfrom
sjkim1127:codex/cpp-range-for-init

Conversation

@sjkim1127

Copy link
Copy Markdown

[AUTOMATED]

for (int i = start(); const auto& x : values) currently drops the initializer and loop body. Preserve C++20 range-for init-statements and evaluate them before the range expression. The initializer's variables resolve in the range and body, then go out of scope. The iterator test and advance remain abstract CFG nodes.

btop's Linux collector uses this form. Joern 4.0.150 also omits the loop on the same reduced input. Clang C++20 controls verified initializer-before-range order, one evaluation even on an empty range, continue, break, and restoration of a shadowed outer binding. Regressions cover declaration, expression, and empty init-statements, including a conditional range.

Depends on #15 and #17. The feature itself is commit 6ea7b2d, tested against the combination of those two PRs. 209 Rust tests, Clippy and formatting passed. Python ran 154 tests with 16 skips. All 12 fixed corpus responses matched that baseline byte for byte.

sjkim1127 and others added 27 commits October 27, 2026 20:38
[AUTOMATED] Share parser-local scope maps until mutation, preserving nested shadowing and existing graph output.
[AUTOMATED] Preserve explicit constructor and destructor bodies when owner names match, while retaining unsupported initializer diagnostics.
Keep the GNU case-range operator in the generated table, and the C++ pack-size spelling in the lexical bridge, so the operator port does not change either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNTKZkNX6ZRBmB96eA
Every other restorable divergence has a joern_* option that original-reference comparisons request. Add joern_cpp_control_flow for the C++ evaluation-order fixes, starting with noexcept operands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNTKZkNX6ZRBmB96eA
Keep the lowering this change replaced, so original-reference comparisons can still request it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKNTKZkNX6ZRBmB96eA
@mahaloz
mahaloz marked this pull request as ready for review November 9, 2026 16:56
@mahaloz
mahaloz merged commit 2c5d58c 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.

2 participants