Skip to content

[AUTOMATED] Parse qualified C++ template and operator-function names - #3

Merged
mahaloz merged 30 commits into
Noelo-Lab:mainfrom
sjkim1127:codex/cpp-qualified-expressions
Nov 9, 2026
Merged

mahaloz merged 30 commits into
Noelo-Lab:mainfrom
sjkim1127:codex/cpp-qualified-expressions

Conversation

@sjkim1127

@sjkim1127 sjkim1127 commented Oct 19, 2026 •

Copy link
Copy Markdown

[AUTOMATED]

Current-head verification (2026-10-27)

Rechecked PR head 3f0a618567a94701f2ace8fbc49af97063fc643f against upstream base 9f8cad170d6b6883fe08627fa524ecb28128380d. Rust: 221 tests passed; formatting and clippy with warnings denied passed. Python: 155 tests run, 16 skipped in the local environment. A fresh capture from unchanged PyJoern 4.0.150.4 / Joern 4.0.150 across the eight checked-in C++ inputs matched directed CFG topology, entry/exit roles, and degeneracy for 22/22 exported functions. This does not establish CPG label, type, effect or execution parity. No remote CI checks are currently reported for this head.

Additional fixed-input diagnostic audit: all eight sampled whole TUs remain strict rejections both before and after. In the Windows MinGW Snappy TU the diagnostic count changes from 334 to 418; 164 diagnostics appear and 80 disappear, including 111 newly reported unsupported constructor-initializer diagnostics. This may reflect newly recognized syntax as well as changed recovery; it is not yet a proven improvement or regression in semantic completeness. The other sampled inputs and full diagnostic multisets were retained locally. This audit does not replace the earlier saved-output replay or establish compiler-validity/CFG parity for these whole TUs.

Operator-template follow-up (base 52a8899, 2026-10-22)

Preserve calls, returns and comma/short-circuit condition operands for explicit
operator-template calls such as operator!=<>(a,b) and
box.template operator()<int>(). The expression scanner and recovery checks
now use the same name boundary. C++ call leaf extraction also ignores ::
inside template arguments instead of renaming a call to an argument's type.

  • No new dependencies, diagnostic suppression, function/address guards,
    default loop-option changes, compiler repair or DecBench pin/profile changes.
  • Seven added Rust regressions; 221 all-targets tests pass. Release build,
    Clippy with warnings denied, fmt and diff checks pass.
  • Python with the DecBench checkout available: 166 run, 161 passed /5 skipped
    (four hardcoded sibling-checkout requirements and one platform library-discovery
    requirement). DecBench focused experimental C++ lane against this library:
    316 passed /5 platform skips. Full DecBench tests are not rerun.
  • Seven header-free C++17 witnesses accepted by Apple Clang 17 and Homebrew
    Clang 22 (-pedantic-errors -fsyntax-only). All seven selected f graphs
    match unchanged original Joern in directed topology, entry/exit roles and
    degeneracy after correction; five did not match before. Auxiliary operator
    declaration export-name differences remain in some controls, so this is not
    all-export or full-CPG parity. Two new source/reference fixtures bring the
    retained full selected-function fixture suite to 8 inputs /22 functions.
  • Two isolated fixed-input audits are identical: 1,026 unique prepared
    source/producer inputs, 993 unchanged CPGs, 26 rejected by both,
    7 changed CPGs (all producer-side), zero parse-success losses or definition-set
    changes
    . Six changed CPGs retain CFG topology/roles/degeneracy; one changes
    as previously dropped calls/conditions are retained.
  • Comparison requests joern_loop_conditions=True explicitly. The independent
    upstream constant-true-loop policy is not silently adopted in this audit.

Remaining limits

The existing 87 original-reference inputs remain 82 matches /4 unavailable
exports /1 mismatch
. The one large Ghidra pseudocode CFG was already
non-isomorphic: 194 nodes/289 edges before, 210/313 after, original 199/297.
The full input is not qualified as complete valid C++; preserving its calls
is not certified recovery parity or an eligibility decision. These limits are
recorded in docs/divergences.md and docs/eval/cpp-operator-templates.md.

The historical 8,808-case audit and full 250-function metric evaluation are
not rerun here. No fresh score, official C++ admission, execution parity or
ranking improvement is claimed.
DecBench joernio#103's production pin, cache
versions, profiles and published results are unchanged. This PR stays draft;
parser adoption still needs separate metric/loop-policy and qualification review.
No GitHub checks are currently reported for this branch; local verification is
not remote CI green.

Earlier revision (52a8899)

Scope

AI-assisted frontend fix for C++ qualified expression names. This is separate from DecBench metric policy or producer-output validation.

  • Consume a qualified name component by component, including nested template-ids before :: and operator-function-ids such as operator[], operator(), operator+, and operator new.
  • Reuse that scanner for primary/member expressions and qualified-call statement disambiguation. Preserve call operands and member receiver evaluation; do not lower template arguments into runtime comparisons.
  • Avoid consuming a later shift/cast as part of a bound identifier's comparison.
  • Distinguish template parameter class/default arguments from the actual record introducer.
  • Keep explicitly qualified member targets unresolved rather than guessing a same-named receiver/global method; full C++ qualified/base lookup is outside this patch.
  • Document the parser-versus-validity contract in docs/cpp-expression-contract.md.

No new dependencies or diagnostic suppression are introduced.

Validation

  • cargo test --all-targets: 214 passed, including 10 new call/operand/CFG regression tests.
  • Python unittest discover: successful (Ran 166 tests; OK, skipped=5). Four existing tests require a sibling DecBench checkout at a hardcoded path; one native-DDG audit has platform-specific library discovery.
  • cargo clippy --all-targets -- -D warnings, cargo fmt --all --check, debug and release builds passed locally.
  • Six complete C++17 fixtures accepted by both Clang 20.1.8 and 22.1.8 with -fsyntax-only.
  • Fresh references from unchanged PyJoern 4.0.150.4 / Joern v4.0.150, isolated interpreters/temp working directories, no native shim: 17/17 selected functions match in coverage, directed topology, entry/exit roles and degeneracy. Source/reference hashes and original flags are included. Two controls contain branches, short-circuit, loop/break or receiver-side effects.
  • The historical 8,808-case external audit has not been rerun. Local tests are not remote CI evidence.

Saved-output replay and limits

Against upstream base 9f8cad170d6b6883fe08627fa524ecb28128380d, 1,000 frozen producer outputs (4 tools × 250 fixed requests, 972 nonempty) were parsed with identical prepared bytes:

Tool Native graph available before After Previously available outputs lost
Fission 249 250 0
Kuna 246 250 0
angr 177 200 0
Ghidra 209 220 0

These are frontend availability counts, not valid C++ eligibility or GED scores. Eight of the 39 newly parsed outputs contain already-confirmed angr duplicate-binding defects. The other 31 have not been qualified as complete valid C++. None is admitted into a scoring population; the DecBench dependency pin and metric/Union policies remain unchanged.

Thirty-seven previously available CPGs also change, notably explicit operator calls previously represented as ordinary assignment/allocation expressions. Actual-row CPGs are not claimed to have full original-Joern or execution parity. A repeated release replay matches the debug candidate's complete JSON for all 1,000 inputs; no corpus program or recovered source was executed.

Strict mode rejects reported parser errors, not every C++ syntax, binding or type error. Duplicate declarations, malformed recovery and ABI pseudocode still require caller validation. This draft does not add template instantiation/specialization matching, complete C++ name lookup, or official benchmark admission policy.

@sjkim1127
sjkim1127 marked this pull request as ready for review October 27, 2026 11: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.
sjkim1127 and others added 16 commits October 29, 2026 10:06
mahaloz and others added 7 commits November 9, 2026 16:11
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
Copilot AI balanced review requested due to automatic review settings November 9, 2026 16:57
@mahaloz
mahaloz merged commit f80c31a into Noelo-Lab:main Nov 9, 2026

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.

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